AI Compare
​
​
ToolsArticlesServices
Best for
    All tools

    Sales

    AI tools for finding leads, qualifying them, preparing quotes, following up and keeping the CRM up to date.

    Marketing

    AI tools for content, social media, images, video, SEO and campaigns.

    Customer service

    AI tools for answering customer emails, chats and calls, handling requests and escalating the hard cases.

    Operations

    AI tools for running the daily work: workflows, scheduling, projects, purchasing and delivery.

    Finance

    AI tools for invoices, bookkeeping, reconciliation, spreadsheets and financial reporting.

    Management & Admin

    AI tools for owners, managers and office staff: planning, reports, documents, meetings, scheduling and everyday admin.

    HR

    AI tools for hiring, screening candidates, onboarding, training and answering employee questions.

    Legal & Compliance

    AI tools for reviewing contracts, tracking deadlines and preparing compliance work for a qualified person to check.

    IT & Development

    AI tools for developers and IT teams: coding, AI models, agents, infrastructure and integrations.

Find AI tools for your team
AllAssistantsWriting & DocsImagesVideoAudioAI AgentsAutomationCode
← Back to tools

•

2023-11-22

InternVL logo

InternVL

Not rated yet

10.1K GitHub stars

Type:

Tool

Platforms:

Github

Task:

Chat with AIStudy and learnRun AI models locally

Best for:

IT & Development
Visit websiteView on GitHub

Pricing


Starting price

$0

Type

Freemium

Overview

Model Date HF Link MS Link Note Mini‑InternVL‑Chat‑4B‑V1‑5 2024.05.28 🤗 link 🤖 link 🚀🚀 16% of the model size, 90% of the performance Mini-InternVL-Chat-2B-V1-5 2024.05.19 🤗 link 🤖 link 🚀 8% of the model size, 80% of the performance InternVL-Chat-V1-5 2024.04.18 🤗 link 🤖 link support 4K image; super strong OCR; Approaching the performance of GPT-4V and Gemini Pro on various benchmarks like MMMU, DocVQA, ChartQA, MathVista, etc.

To maintain consistency with earlier generations, we provide two model formats: the GitHub format, consistent with prior releases, and the HF format, aligned with the official Transformers standard.

README

InternVL Family: Closing the Gap to Commercial Multimodal Models with Open-Source Suites —— A Pioneering Open-Source Alternative to GPT-5

image

[🆕 Blog] [🤔 FAQs] [🗨️ Chat Demo] [📖 Document] [🌐 API] [🚀 Quick Start]

[🔥 InternVL3.5 Report] [📜 InternVL3.0 Report] [📜 InternVL2.5 MPO] [📜 InternVL2.5 Report]

[📜 Mini-InternVL Paper] [📜 InternVL2 Blog] [📜 InternVL 1.5 Paper] [📜 InternVL 1.0 Paper]

[📖 2.0 中文解读] [📖 1.5 中文解读] [📖 1.0 中文解读]

Switch to the Chinese version (切换至中文版)

OpenGVLab%2FInternVL | Trendshift image

image/jpg

News 🚀🚀🚀

  • 2025/08/30: 🔥 We open-source the training code of InternVL3_5-GPT-OSS-20B-A4B and CascadeRL, which consists of a offline RL stage and a online RL stage. The training data for these two stages (MMPR-v1.2 and MMPR-Tiny) are also open-sourced.
  • 2025/08/26: 🚀 We introduce InternVL3.5, a new family of open-source multimodal models that significantly advances versatility, reasoning capability, and inference efficiency along the InternVL series. Our largest model, i.e., InternVL3.5-241B-A28B, attains state-of-the-art results among open-source MLLMs across general multimodal, reasoning, text, and agentic tasks. We also provide a 20B-A4B version (i.e., InternVL3_5-GPT-OSS-20B-A4B), which is built up on GPT-OSS-20B-A4B. Notably, we provide two model formats: the GitHub format, consistent with prior releases, and the HF format, aligned with the official transformers standard.
  • 2025/04/17: We open-source the data construction pipeline and training scripts of MPO and VisualPRM. Additionally, the data construction scripts for MPO and VisualPRM are also released for reference.
  • 2025/04/11: We introduce InternVL3, an advanced multimodal large language model (MLLM) series that demonstrates superior overall performance. InternVL3-78B achieves SoTA performance in both perception and reasoning performance among open-source MLLMs. The key designs of InternVL3-78B include Variable Visual Position Encoding, Native Multimodal Pre-Training, Mixed Preference Optimization, and Multimodal Test-Time Scaling.
  • 2025/03/13: We introduce VisualPRM, an advanced multimodal Process Reward Model (PRM) with 8B parameters, which improves the overall reasoning performance of InternVL2.5-8B and InternVL2.5-78B by 8.4 and 5.9 points, respectively. The training data for this model, termed VisualPRM400K, is also open-sourced. Please refer to our paper and project page for more details.
  • 2024/12/20: We release the InternVL2.5-MPO, which is finetuned with Mixed Preference Optimization on MMPR-v1.1. The resulting models outperform their counterparts without MPO by an average of 2 points across all model scales on the OpenCompass leaderboard. These models are available at HF link.
  • 2024/12/17: InternVL2/2.5 is supported in PaddleMIX by Paddle Team.
  • 2024/12/05: We release the InternVL2.5, an advanced multimodal large language model (MLLM) series with parameter coverage ranging from 1B to 78B. InternVL2_5-78B is the first open-source MLLMs to achieve over 70% on the MMMU benchmark, matching the performance of leading closed-source commercial models like GPT-4o. These models are available at HF link.
  • 2024/11/14: We introduce MMPR, a high-quality, large-scale multimodal reasoning preference dataset, and MPO, an effective preference optimization algorithm. The resulting model, InternVL2-8B-MPO, achieves an accuracy of 67.0 on MathVista. Please refer to our paper, project page and document for more details.
More News
  • 2024/10/21: We release the Mini-InternVL series. These models achieve impressive performance with minimal size: the 4B model achieves 90% of the performance with just 5% of the model size. For more details, please check our project page and document.
  • 2024/08/01: The Chartmimic team evaluated the InternVL2 series models on their benchmark. The InternVL2-26B and 76B models achieved the top two performances among open-source models, with the InternVL2 76B model surpassing GeminiProVision and exhibiting comparable results to Claude-3-opus.
  • 2024/08/01: InternVL2-Pro achieved the SOTA performance among open-source models on the CharXiv dataset, surpassing many closed-source models such as GPT-4V, Gemini 1.5 Flash, and Claude 3 Sonnet.
  • 2024/07/24: The MLVU team evaluated InternVL-1.5 on their benchmark. The average performance on the multiple-choice task was 50.4%, while the performance on the generative tasks was 4.02. The performance on the multiple-choice task ranked #1 among all open-source MLLMs.
  • 2024/07/04: We release the InternVL2 series. InternVL2-Pro achieved a 62.0% accuracy on the MMMU benchmark, matching the performance of leading closed-source commercial models like GPT-4o.
  • 2024/07/18: InternVL2-40B achieved SOTA performance among open-source models on the Video-MME dataset, scoring 61.2 when inputting 16 frames and 64.4 when inputting 32 frames. It significantly outperforms other open-source models and is the closest open-source model to GPT-4o mini.
  • 2024/07/18: InternVL2-Pro achieved the SOTA performance on the DocVQA and InfoVQA benchmarks.
  • 2024/06/19: We propose Needle In A Multimodal Haystack (MM-NIAH), the first benchmark designed to systematically evaluate the capability of existing MLLMs to comprehend long multimodal documents.
  • 2024/05/30: We release ShareGPT-4o, a large-scale dataset that we plan to open-source with 200K images, 10K videos, and 10K audios with detailed descriptions.
  • 2024/05/28: Thanks to the lmdeploy team for providing AWQ quantization support. The 4-bit model is available at OpenGVLab/InternVL-Chat-V1-5-AWQ.
  • 2024/05/13: InternVL 1.0 can now be used as the text encoder for diffusion models to support multilingual generation natively in over 110 languages worldwide. See MuLan for more details.
  • 2024/04/18: InternVL-Chat-V1-5 has been released at HF link, approaching the performance of GPT-4V and Gemini Pro on various benchmarks like MMMU, DocVQA, ChartQA, MathVista, etc.
  • 2024/02/27: InternVL is accepted by CVPR 2024 (Oral)! 🎉
  • 2024/02/21: InternVL-Chat-V1-2-Plus achieved SOTA performance on MathVista (59.9), MMBench (83.8), and MMVP (58.7). See our blog for more details.
  • 2024/02/12: InternVL-Chat-V1-2 has been released. It achieves 51.6 on MMMU val and 82.3 on MMBench test. For more details, please refer to our blog and SFT data. The model is now available on HuggingFace, and both training / evaluation data and scripts are open-sourced.
  • 2024/01/24: InternVL-Chat-V1-1 is released, it supports Chinese and has stronger OCR capability, see here.
  • 2024/01/16: We release our customized mmcv/mmsegmentation/mmdetection code, integrated with DeepSpeed, which can be used for training large-scale detection and segmentation models.

Documents

🌟 Get Started

  • Installation: 🌱 Installation Guide | 📄 requirements.txt
  • Chat Data Format: 📝 Meta File | ✏️ Text | 🖼️ Single-Image | 🖼️🖼️ Multi-Image | 🎥 Video
  • Local Chat Demo: 🤖 Streamlit Demo
  • InternVL-Chat API: 🌐 InternVL2.5 API
  • Tutorials: 🚀 Enhancing InternVL2 on COCO Caption Using LoRA Fine-Tuning

🏆 InternVL Family

  • InternVL 3.0: 📖 Intro | ⚡ Quick Start | ✨ Finetune | 📊 Evaluate | 📦 Deploy | 🎯 MPO
  • InternVL 2.5: 📖 Intro | ⚡ Quick Start | ✨ Finetune | 📊 Evaluate | 📦 Deploy | 🎯 MPO
  • InternVL 2.0: 📖 Intro | ⚡ Quick Start | ✨ Finetune | 📊 Evaluate | 📦 Deploy | 🎯 MPO
  • InternVL 1.5: 📖 Intro | ⚡ Quick Start | ✨ Finetune | 📊 Evaluate | 📦 Deploy
  • InternVL 1.2: 📖 Intro | ⚡ Quick Start | ✨ Finetune | 📊 Evaluate
  • InternVL 1.1: 📖 Intro | ⚡ Quick Start | 📊 Evaluation
  • InternVL 1.0: 🖼️ Classification | 📊 CLIP-Benchmark | 🎨 Segmentation | 💬 Chat-LLaVA | ✨ InternVL-G

Model Zoo

Multimodal Large Language Model (InternVL 3.5)

To maintain consistency with earlier generations, we provide two model formats: the GitHub format, consistent with prior releases, and the HF format, aligned with the official Transformers standard.

If you want to convert the checkpoint between these two formats, please refer to the scripts about custom2hf and hf2custom.

Github Format

Model#Vision Param#Language Param#Total ParamHF LinkModelScope Link
InternVL3.5-1B0.3B0.8B1.1B🤗 link🤖 link
InternVL3.5-2B0.3B2.0B2.3B🤗 link🤖 link
InternVL3.5-4B0.3B4.4B4.7B🤗 link🤖 link
InternVL3.5-8B0.3B8.2B8.5B🤗 link🤖 link
InternVL3.5-14B0.3B14.8B15.1B🤗 link🤖 link
InternVL3.5-38B5.5B32.8B38.4B🤗 link🤖 link
InternVL3.5-20B-A4B0.3B20.9B21.2B-A4B🤗 link🤖 link
InternVL3.5-30B-A3B0.3B30.5B30.8B-A3B🤗 link🤖 link
InternVL3.5-241B-A28B5.5B235.1B240.7B-A28B🤗 link🤖 link

HuggingFace Format

Model#Vision Param#Language Param#Total ParamHF LinkModelScope Link
InternVL3.5-1B-HF0.3B0.8B1.1B🤗 link🤖 link
InternVL3.5-2B-HF0.3B2.0B2.3B🤗 link🤖 link
InternVL3.5-4B-HF0.3B4.4B4.7B🤗 link🤖 link
InternVL3.5-8B-HF0.3B8.2B8.5B🤗 link🤖 link
InternVL3.5-14B-HF0.3B14.8B15.1B🤗 link🤖 link
InternVL3.5-38B-HF5.5B32.8B38.4B🤗 link🤖 link
InternVL3.5-20B-A4B-HF0.3B20.9B21.2B-A4B🤗 link🤖 link
InternVL3.5-30B-A3B-HF0.3B30.5B30.8B-A3B🤗 link🤖 link
InternVL3.5-241B-A28B-HF5.5B235.1B240.7B-A28B🤗 link🤖 link

Multimodal Large Language Model (InternVL 3.0)

Model NameVision PartLanguage PartHF LinkMS Link
InternVL3-1BInternViT‑300M‑448px‑V2_5Qwen2.5‑0.5B🤗 link🤖 link
InternVL3-2BInternViT-300M-448px-V2_5Qwen2.5-1.5B🤗 link🤖 link
InternVL3-8BInternViT-300M-448px-V2_5Qwen2.5-7B🤗 link🤖 link
InternVL3-9BInternViT-300M-448px-V2_5internlm3-8b-instruct🤗 link🤖 link
InternVL3-14BInternViT-300M-448px-V2_5Qwen2.5-14B🤗 link🤖 link
InternVL3-38BInternViT-6B-448px-V2_5Qwen2.5-32B🤗 link🤖 link
InternVL3-78BInternViT-6B-448px-V2_5Qwen2.5-72B🤗 link🤖 link

Multimodal Large Language Model (InternVL 2.5)

Model NameVision PartLanguage PartHF LinkMS Link
InternVL2_5-1BInternViT‑300M‑448px‑V2_5Qwen2.5‑0.5B‑Instruct🤗 link🤖 link
InternVL2_5-2BInternViT-300M-448px-V2_5internlm2_5-1_8b-chat🤗 link🤖 link
InternVL2_5-4BInternViT-300M-448px-V2_5Qwen2.5-3B-Instruct🤗 link🤖 link
InternVL2_5-8BInternViT-300M-448px-V2_5internlm2_5-7b-chat🤗 link🤖 link
InternVL2_5-26BInternViT-6B-448px-V2_5internlm2_5-20b-chat🤗 link🤖 link
InternVL2_5-38BInternViT-6B-448px-V2_5Qwen2.5-32B-Instruct🤗 link🤖 link
InternVL2_5-78BInternViT-6B-448px-V2_5Qwen2.5-72B-Instruct🤗 link🤖 link
Model NameVision PartLanguage PartHF LinkMS Link
InternVL2_5-1B-MPOInternViT‑300M‑448px‑V2_5Qwen2.5‑0.5B‑Instruct🤗 link🤖 link
InternVL2_5-2B-MPOInternViT-300M-448px-V2_5internlm2_5-1_8b-chat🤗 link🤖 link
InternVL2_5-4B-MPOInternViT-300M-448px-V2_5Qwen2.5-3B-Instruct🤗 link🤖 link
InternVL2_5-8B-MPOInternViT-300M-448px-V2_5internlm2_5-7b-chat🤗 link🤖 link
InternVL2_5-26B-MPOInternViT-6B-448px-V2_5internlm2_5-20b-chat🤗 link🤖 link
InternVL2_5-38B-MPOInternViT-6B-448px-V2_5Qwen2.5-32B-Instruct🤗 link🤖 link
InternVL2_5-78B-MPOInternViT-6B-448px-V2_5Qwen2.5-72B-Instruct🤗 link🤖 link

Multimodal Large Language Model (InternVL 2.0)

Model NameVision PartLanguage PartHF LinkMS Link
InternVL2-1BInternViT-300M-448pxQwen2-0.5B-Instruct🤗 link🤖 link
InternVL2-2BInternViT-300M-448pxinternlm2-chat-1-8b🤗 link🤖 link
InternVL2-4BInternViT-300M-448pxPhi‑3‑mini‑128k‑instruct🤗 link🤖 link
InternVL2-8BInternViT-300M-448pxinternlm2_5-7b-chat🤗 link🤖 link
InternVL2-26BInternViT-6B-448px-V1-5internlm2-chat-20b🤗 link🤖 link
InternVL2-40BInternViT‑6B‑448px‑V1‑5Nous‑Hermes‑2‑Yi‑34B🤗 link🤖 link
InternVL2‑Llama3-76BInternViT-6B-448px-V1-5Hermes‑2‑Theta‑
Llama‑3‑70B
🤗 link🤖 link

Multimodal Large Language Model (InternVL 1.0-1.5)

ModelDateHF LinkMS LinkNote
Mini‑InternVL‑Chat‑4B‑V1‑52024.05.28🤗 link🤖 link🚀🚀 16% of the model size, 90% of the performance
Mini-InternVL-Chat-2B-V1-52024.05.19🤗 link🤖 link🚀 8% of the model size, 80% of the performance
InternVL-Chat-V1-52024.04.18🤗 link🤖 linksupport 4K image; super strong OCR; Approaching the performance of GPT-4V and Gemini Pro on various benchmarks like MMMU, DocVQA, ChartQA, MathVista, etc.
InternVL-Chat-V1-2-Plus2024.02.21🤗 link🤖 linkmore SFT data and stronger
InternVL-Chat-V1-22024.02.11🤗 link🤖 linkscaling up LLM to 34B
InternVL-Chat-V1-12024.01.24🤗 link🤖 linksupport Chinese and stronger OCR
InternVL-Chat-19B2023.12.25🤗 link🤖 linkEnglish multimodal dialogue
InternVL-Chat-13B2023.12.25🤗 link🤖 linkEnglish multimodal dialogue

CLIP-like Model (InternVL 1.0-2.5)

ModelDateHF LinkMS LinkNote
InternViT-300M-448px-V2_52024.12.05🤗 link🤖 link🚀🚀 A more powerful lightweight visual encoder. (🔥new)
InternViT-6B-448px-V2_52024.12.05🤗 link🤖 link🚀🚀 A stronger visual encoder to extract visual features. (🔥new)
InternViT-300M-448px2024.05.25🤗 link🤖 linkdistilled small vision foundation model with 300M parameters
InternViT‑6B‑448px‑V1‑52024.04.20🤗 link🤖 linksupport dynamic resolution and super strong OCR feature extraction capability by incremental pre-training
InternViT-6B-448px-V1-22024.02.11🤗 link🤖 linksupport 448 resolution by incremental pre-training
InternViT-6B-448px-V1-02024.01.30🤗 link🤖 linksupport 448 resolution by incremental pre-training
InternViT-6B-224px2023.12.22🤗 link🤖 linkthe first version of InternViT-6B, extracted from InternVL‑14B‑224px

Vision-Language Foundation Model (InternVL 1.0)

ModelDateHF LinkMS LinkNote
InternVL‑14B‑224px2023.12.22🤗 link🤖 linkvision-language foundation model, InternViT-6B + QLLaMA, can be used for image-text retrieval like CLIP

TODO List

  • Release training / evaluation code for InternVL2.5 series
  • Support liger kernels to save GPU memory
  • Release the code, model, and data of MPO
  • Support multimodal packed dataset
  • Support vLLM and Ollama
  • Support video and PDF input in online demo
  • Release InternVL2 with VisionLLMv2 integration
  • Rebuild documents using readthedocs
  • Support fine-tuning different LLMs with LoRA
  • Release requirements.txt for InternVL2
  • Release training / evaluation code for InternVL2 series
  • Release Streamlit web UI for InternVL1.5 and InternVL2

What can InternVL do?

Visual Perception (click to expand)
  • Linear-Probe Image Classification [see details]

    ViT-22B uses the private JFT-3B dataset.

    method#paramIN-1KIN-ReaLIN-V2IN-AIN-RIN-Sketch
    OpenCLIP-G1.8B86.289.477.263.887.866.4
    DINOv2-g1.1B86.589.678.475.978.862.5
    EVA-01-CLIP-g1.1B86.589.377.470.587.763.1
    MAWS-ViT-6.5B6.5B87.8-----
    ViT-22B*21.7B89.590.983.283.887.4-
    InternViT-6B (ours)5.9B88.290.479.977.589.869.1
  • Semantic Segmentation [see details]

    methoddecoder#param (train/total)crop sizemIoU
    OpenCLIP-G (frozen)Linear0.3M / 1.8B51239.3
    ViT-22B (frozen)Linear0.9M / 21.7B50434.6
    InternViT-6B (frozen)Linear0.5M / 5.9B50447.2 (+12.6)
    ViT-22B (frozen)UperNet0.8B / 22.5B50452.7
    InternViT-6B (frozen)UperNet0.4B / 6.3B50454.9 (+2.2)
    ViT-22BUperNet22.5B / 22.5B50455.3
    InternViT-6BUperNet6.3B / 6.3B50458.9 (+3.6)
  • Zero-Shot Image Classification [see details]

    methodIN-1KIN-AIN-RIN-V2IN-SketchObjectNet
    OpenCLIP-G80.169.392.173.668.973.0
    EVA-02-CLIP-E+82.082.194.575.771.679.6
    ViT-22B*85.990.196.080.9-87.6
    InternVL-C (ours)83.283.895.577.373.980.6
  • Multilingual Zero-Shot Image Classification [see details]

    EN: English, ZH: Chinese, JP: Japanese, Ar: Arabic, IT: Italian

    methodIN-1K (EN)IN-1K (ZH)IN-1K (JP)IN-1K (AR)IN-1K (IT)
    Taiyi-CLIP-ViT-H-54.4---
    WuKong-ViT-L-G-57.5---
    CN-CLIP-ViT-H-59.6---
    AltCLIP-ViT-L74.559.6---
    EVA-02-CLIP-E+82.0---41.2
    OpenCLIP-XLM-R-H77.055.753.137.056.8
    InternVL-C (ours)83.264.561.544.965.7
  • Zero-Shot Video Classification

    method#frameK400K600K700
    OpenCLIP-G165.966.159.2
    EVA-02-CLIP-E+169.869.363.4
    InternVL-C (ours)171.071.365.7
    ViCLIP875.773.566.4
    InternVL-C (ours)879.478.871.5
Cross-Modal Retrieval (click to expand)
  • English Zero-Shot Image-Text Retrieval [see details]

    modelFlickr30KCOCOavg
    image-to-texttext-to-imageimage-to-texttext-to-image
    R@1R@5R@10R@1R@5R@10R@1R@5R@10R@1R@5R@10
    OpenCLIP-G92.999.399.879.595.097.167.386.992.651.474.983.085.0
    EVA-02-CLIP-E+93.999.499.878.894.296.868.887.892.851.175.082.785.1
    EVA-CLIP-8B95.699.699.980.895.597.670.389.393.953.076.083.486.2
    InternVL-C (ours)94.799.699.981.796.098.270.689.093.554.177.384.686.6
    InternVL-G (ours)95.799.799.985.097.098.674.991.395.258.681.388.088.8
  • Chinese Zero-Shot Image-Text Retrieval [see details]

    modelFlickr30K-CNCOCO-CNavg
    image-to-texttext-to-imageimage-to-texttext-to-image
    R@1R@5R@10R@1R@5R@10R@1R@5R@10R@1R@5R@10
    CN-CLIP-ViT-H81.697.598.871.291.495.563.086.692.969.289.996.186.1
    OpenCLIP-XLM-R-H86.197.599.271.090.594.970.091.597.066.190.896.087.6
    InternVL-C (ours)90.398.899.775.192.996.468.892.096.768.991.996.589.0
    InternVL-G (ours)92.999.499.877.794.897.371.493.997.773.894.498.190.9
  • Multilingual Zero-Shot Image-Text Retrieval on XTD [see details]

    methodENESFRZHITKORUJPaverage
    AltCLIP95.494.192.995.194.294.491.891.793.7
    OpenCLIP-XLM-R-H97.396.194.594.796.090.293.994.094.6
    InternVL-C (ours)97.395.795.195.696.092.293.395.595.1
    InternVL-G (ours)98.697.796.596.796.995.194.896.196.6
Multimodal Dialogue

Quick Start with HuggingFace

using InternViT-6B for visual feature extraction (click to expand)
import torch
from PIL import Image
from transformers import AutoModel, CLIPImageProcessor

model = AutoModel.from_pretrained(
    'OpenGVLab/InternViT-6B-448px-V2_5',
    torch_dtype=torch.bfloat16,
    low_cpu_mem_usage=True,
    trust_remote_code=True).cuda().eval()

image = Image.open('./examples/image1.jpg').convert('RGB')

image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternViT-6B-448px-V1-5')

pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
pixel_values = pixel_values.to(torch.bfloat16).cuda()

outputs = model(pixel_values)
using InternVL-C(ontrastive) and InternVL-G(enerative) for cross-modal retrieval (click to expand)
import torch
from PIL import Image
from transformers import AutoModel, CLIPImageProcessor
from transformers import AutoTokenizer


model = AutoModel.from_pretrained(
    'OpenGVLab/InternVL-14B-224px',
    torch_dtype=torch.bfloat16,
    low_cpu_mem_usage=True,
    trust_remote_code=True).cuda().eval()

image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternVL-14B-224px')

tokenizer = AutoTokenizer.from_pretrained(
    'OpenGVLab/InternVL-14B-224px', use_fast=False, add_eos_token=True)
tokenizer.pad_token_id = 0  # set pad_token_id to 0

images = [
    Image.open('./examples/image1.jpg').convert('RGB'),
    Image.open('./examples/image2.jpg').convert('RGB'),
    Image.open('./examples/image3.jpg').convert('RGB')
]
prefix = 'summarize:'
texts = [
    prefix + 'a photo of a red panda',  # English
    prefix + '一张熊猫的照片',  # Chinese
    prefix + '二匹の猫の写真'  # Japanese
]

pixel_values = image_processor(images=images, return_tensors='pt').pixel_values
pixel_values = pixel_values.to(torch.bfloat16).cuda()
input_ids = tokenizer(texts, return_tensors='pt', max_length=80,
                      truncation=True, padding='max_length').input_ids.cuda()

# InternVL-C
logits_per_image, logits_per_text = model(
    image=pixel_values, text=input_ids, mode='InternVL-C')
probs = logits_per_image.softmax(dim=-1)
# tensor([[9.9609e-01, 5.2185e-03, 6.0070e-08],
#         [2.2949e-02, 9.7656e-01, 5.9903e-06],
#         [3.2932e-06, 7.4863e-05, 1.0000e+00]], device='cuda:0',
#        dtype=torch.bfloat16, grad_fn=<SoftmaxBackward0>)

# InternVL-G
logits_per_image, logits_per_text = model(
    image=pixel_values, text=input_ids, mode='InternVL-G')
probs = logits_per_image.softmax(dim=-1)
# tensor([[9.9609e-01, 3.1738e-03, 3.6322e-08],
#         [8.6060e-03, 9.9219e-01, 2.8759e-06],
#         [1.7583e-06, 3.1233e-05, 1.0000e+00]], device='cuda:0',
#        dtype=torch.bfloat16, grad_fn=<SoftmaxBackward0>)

# please set add_eos_token to False for generation
tokenizer.add_eos_token = False
image = Image.open('./examples/image1.jpg').convert('RGB')
pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
pixel_values = pixel_values.to(torch.bfloat16).cuda()

tokenized = tokenizer("English caption:", return_tensors='pt')
pred = model.generate(
    pixel_values=pixel_values,
    input_ids=tokenized.input_ids.cuda(),
    attention_mask=tokenized.attention_mask.cuda(),
    num_beams=5,
    min_new_tokens=8,
)
caption = tokenizer.decode(pred[0].cpu(), skip_special_tokens=True).strip()
# English caption: a red panda sitting on top of a wooden platform
using InternVL 2.5 for multimodal chat (click to expand)

Here, we take the smaller OpenGVLab/InternVL2_5-8B as an example:

import numpy as np
import torch
import torchvision.transforms as T
from decord import VideoReader, cpu
from PIL import Image
from torchvision.transforms.functional import InterpolationMode
from transformers import AutoModel, AutoTokenizer

IMAGENET_MEAN = (0.485, 0.456, 0.406)
IMAGENET_STD = (0.229, 0.224, 0.225)

def build_transform(input_size):
    MEAN, STD = IMAGENET_MEAN, IMAGENET_STD
    transform = T.Compose([
        T.Lambda(lambda img: img.convert('RGB') if img.mode != 'RGB' else img),
        T.Resize((input_size, input_size), interpolation=InterpolationMode.BICUBIC),
        T.ToTensor(),
        T.Normalize(mean=MEAN, std=STD)
    ])
    return transform

def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height, image_size):
    best_ratio_diff = float('inf')
    best_ratio = (1, 1)
    area = width * height
    for ratio in target_ratios:
        target_aspect_ratio = ratio[0] / ratio[1]
        ratio_diff = abs(aspect_ratio - target_aspect_ratio)
        if ratio_diff < best_ratio_diff:
            best_ratio_diff = ratio_diff
            best_ratio = ratio
        elif ratio_diff == best_ratio_diff:
            if area > 0.5 * image_size * image_size * ratio[0] * ratio[1]:
                best_ratio = ratio
    return best_ratio

def dynamic_preprocess(image, min_num=1, max_num=12, image_size=448, use_thumbnail=False):
    orig_width, orig_height = image.size
    aspect_ratio = orig_width / orig_height

    # calculate the existing image aspect ratio
    target_ratios = set(
        (i, j) for n in range(min_num, max_num + 1) for i in range(1, n + 1) for j in range(1, n + 1) if
        i * j <= max_num and i * j >= min_num)
    target_ratios = sorted(target_ratios, key=lambda x: x[0] * x[1])

    # find the closest aspect ratio to the target
    target_aspect_ratio = find_closest_aspect_ratio(
        aspect_ratio, target_ratios, orig_width, orig_height, image_size)

    # calculate the target width and height
    target_width = image_size * target_aspect_ratio[0]
    target_height = image_size * target_aspect_ratio[1]
    blocks = target_aspect_ratio[0] * target_aspect_ratio[1]

    # resize the image
    resized_img = image.resize((target_width, target_height))
    processed_images = []
    for i in range(blocks):
        box = (
            (i % (target_width // image_size)) * image_size,
            (i // (target_width // image_size)) * image_size,
            ((i % (target_width // image_size)) + 1) * image_size,
            ((i // (target_width // image_size)) + 1) * image_size
        )
        # split the image
        split_img = resized_img.crop(box)
        processed_images.append(split_img)
    assert len(processed_images) == blocks
    if use_thumbnail and len(processed_images) != 1:
        thumbnail_img = image.resize((image_size, image_size))
        processed_images.append(thumbnail_img)
    return processed_images

def load_image(image_file, input_size=448, max_num=12):
    image = Image.open(image_file).convert('RGB')
    transform = build_transform(input_size=input_size)
    images = dynamic_preprocess(image, image_size=input_size, use_thumbnail=True, max_num=max_num)
    pixel_values = [transform(image) for image in images]
    pixel_values = torch.stack(pixel_values)
    return pixel_values

# If you have an 80G A100 GPU, you can put the entire model on a single GPU.
# Otherwise, you need to load a model using multiple GPUs, please refer to the `Multiple GPUs` section.
path = 'OpenGVLab/InternVL2_5-8B'
model = AutoModel.from_pretrained(
    path,
    torch_dtype=torch.bfloat16,
    low_cpu_mem_usage=True,
    trust_remote_code=True).eval().cuda()
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True, use_fast=False)

# set the max number of tiles in `max_num`
pixel_values = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
generation_config = dict(max_new_tokens=1024, do_sample=False)

# pure-text conversation (纯文本对话)
question = 'Hello, who are you?'
response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
print(f'User: {question}\nAssistant: {response}')

question = 'Can you tell me a story?'
response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)
print(f'User: {question}\nAssistant: {response}')

# single-image single-round conversation (单图单轮对话)
question = '<image>\nPlease describe the image shortly.'
response = model.chat(tokenizer, pixel_values, question, generation_config)
print(f'User: {question}\nAssistant: {response}')

# single-image multi-round conversation (单图多轮对话)
question = '<image>\nPlease describe the image in detail.'
response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
print(f'User: {question}\nAssistant: {response}')

question = 'Please write a poem according to the image.'
response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)
print(f'User: {question}\nAssistant: {response}')

# multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)
pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)

question = '<image>\nDescribe the two images in detail.'
response, history = model.chat(tokenizer, pixel_values, question, generation_config,
                               history=None, return_history=True)
print(f'User: {question}\nAssistant: {response}')

question = 'What are the similarities and differences between these two images.'
response, history = model.chat(tokenizer, pixel_values, question, generation_config,
                               history=history, return_history=True)
print(f'User: {question}\nAssistant: {response}')

# multi-image multi-round conversation, separate images (多图多轮对话,独立图像)
pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]

question = 'Image-1: <image>\nImage-2: <image>\nDescribe the two images in detail.'
response, history = model.chat(tokenizer, pixel_values, question, generation_config,
                               num_patches_list=num_patches_list,
                               history=None, return_history=True)
print(f'User: {question}\nAssistant: {response}')

question = 'What are the similarities and differences between these two images.'
response, history = model.chat(tokenizer, pixel_values, question, generation_config,
                               num_patches_list=num_patches_list,
                               history=history, return_history=True)
print(f'User: {question}\nAssistant: {response}')

# batch inference, single image per sample (单图批处理)
pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)

questions = ['<image>\nDescribe the image in detail.'] * len(num_patches_list)
responses = model.batch_chat(tokenizer, pixel_values,
                             num_patches_list=num_patches_list,
                             questions=questions,
                             generation_config=generation_config)
for question, response in zip(questions, responses):
    print(f'User: {question}\nAssistant: {response}')

# video multi-round conversation (视频多轮对话)
def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):
    if bound:
        start, end = bound[0], bound[1]
    else:
        start, end = -100000, 100000
    start_idx = max(first_idx, round(start * fps))
    end_idx = min(round(end * fps), max_frame)
    seg_size = float(end_idx - start_idx) / num_segments
    frame_indices = np.array([
        int(start_idx + (seg_size / 2) + np.round(seg_size * idx))
        for idx in range(num_segments)
    ])
    return frame_indices

def load_video(video_path, bound=None, input_size=448, max_num=1, num_segments=32):
    vr = VideoReader(video_path, ctx=cpu(0), num_threads=1)
    max_frame = len(vr) - 1
    fps = float(vr.get_avg_fps())

    pixel_values_list, num_patches_list = [], []
    transform = build_transform(input_size=input_size)
    frame_indices = get_index(bound, fps, max_frame, first_idx=0, num_segments=num_segments)
    for frame_index in frame_indices:
        img = Image.fromarray(vr[frame_index].asnumpy()).convert('RGB')
        img = dynamic_preprocess(img, image_size=input_size, use_thumbnail=True, max_num=max_num)
        pixel_values = [transform(tile) for tile in img]
        pixel_values = torch.stack(pixel_values)
        num_patches_list.append(pixel_values.shape[0])
        pixel_values_list.append(pixel_values)
    pixel_values = torch.cat(pixel_values_list)
    return pixel_values, num_patches_list

video_path = './examples/red-panda.mp4'
pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)
pixel_values = pixel_values.to(torch.bfloat16).cuda()
video_prefix = ''.join([f'Frame-{i+1}: <image>\n' for i in range(len(num_patches_list))])
question = video_prefix + 'What is the red panda doing?'
# Frame1: <image>\nFrame2: <image>\n...\nFrame8: <image>\n{question}
response, history = model.chat(tokenizer, pixel_values, question, generation_config,
                               num_patches_list=num_patches_list, history=None, return_history=True)
print(f'User: {question}\nAssistant: {response}')

question = 'Describe this video in detail.'
response, history = model.chat(tokenizer, pixel_values, question, generation_config,
                               num_patches_list=num_patches_list, history=history, return_history=True)
print(f'User: {question}\nAssistant: {response}')

License

This project is released under the MIT license. Parts of this project contain code and models from other sources, which are subject to their respective licenses.

Citation

If you find this project useful in your research, please consider cite:

@article{wang2025internvl3_5,
  title={InternVL3.5: Advancing Open-Source Multimodal Models in Versatility, Reasoning, and Efficiency},
  author={Wang, Weiyun and Gao, Zhangwei and Gu, Lixin and Pu, Hengjun and Cui, Long and Wei, Xingguang and Liu, Zhaoyang and Jing, Linglin and Ye, Shenglong and Shao, Jie and others},
  journal={arXiv preprint arXiv:2508.18265},
  year={2025}
}
@article{zhu2025internvl3,
  title={Internvl3: Exploring advanced training and test-time recipes for open-source multimodal models},
  author={Zhu, Jinguo and Wang, Weiyun and Chen, Zhe and Liu, Zhaoyang and Ye, Shenglong and Gu, Lixin and Tian, Hao and Duan, Yuchen and Su, Weijie and Shao, Jie and others},
  journal={arXiv preprint arXiv:2504.10479},
  year={2025}
}
@article{chen2024expanding,
  title={Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling},
  author={Chen, Zhe and Wang, Weiyun and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Cui, Erfei and Zhu, Jinguo and Ye, Shenglong and Tian, Hao and Liu, Zhaoyang and others},
  journal={arXiv preprint arXiv:2412.05271},
  year={2024}
}
@article{wang2024mpo,
  title={Enhancing the Reasoning Ability of Multimodal Large Language Models via Mixed Preference Optimization},
  author={Wang, Weiyun and Chen, Zhe and Wang, Wenhai and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Zhu, Jinguo and Zhu, Xizhou and Lu, Lewei and Qiao, Yu and Dai, Jifeng},
  journal={arXiv preprint arXiv:2411.10442},
  year={2024}
}
@article{gao2024mini,
  title={Mini-InternVL: a flexible-transfer pocket multi-modal model with 5\% parameters and 90\% performance},
  author={Gao, Zhangwei and Chen, Zhe and Cui, Erfei and Ren, Yiming and Wang, Weiyun and Zhu, Jinguo and Tian, Hao and Ye, Shenglong and He, Junjun and Zhu, Xizhou and others},
  journal={Visual Intelligence},
  volume={2},
  number={1},
  pages={1--17},
  year={2024},
  publisher={Springer}
}
@article{chen2024far,
  title={How far are we to gpt-4v? closing the gap to commercial multimodal models with open-source suites},
  author={Chen, Zhe and Wang, Weiyun and Tian, Hao and Ye, Shenglong and Gao, Zhangwei and Cui, Erfei and Tong, Wenwen and Hu, Kongzhi and Luo, Jiapeng and Ma, Zheng and others},
  journal={Science China Information Sciences},
  volume={67},
  number={12},
  pages={220101},
  year={2024},
  publisher={Springer}
}
@inproceedings{chen2024internvl,
  title={Internvl: Scaling up vision foundation models and aligning for generic visual-linguistic tasks},
  author={Chen, Zhe and Wu, Jiannan and Wang, Wenhai and Su, Weijie and Chen, Guo and Xing, Sen and Zhong, Muyan and Zhang, Qinglong and Zhu, Xizhou and Lu, Lewei and others},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={24185--24198},
  year={2024}
}

Acknowledgement

InternVL is built with reference to the code of the following projects: OpenAI CLIP, Open CLIP, CLIP Benchmark, EVA, InternImage, ViT-Adapter, MMSegmentation, Transformers, DINOv2, BLIP-2, Qwen-VL, and LLaVA-1.5. Thanks for their awesome work!


Scan the following QR Code, join our WeChat group.

image

Releases

Release information has not been added yet.

Complete your AI stack

Add specialist tools for research, coding, visual content, video, and automation.

Perplexity logo
Perplexity
Research

AI-powered search and research assistant

View tool
Cursor logo
Cursor
Coding

AI coding editor and autonomous software development platform

View tool
Midjourney logo
Midjourney
Images

AI image and video generation with advanced personalization

View tool
Runway logo
Runway
Video

AI video generation and creative production platform

View tool
n8n logo
n8n
Automation

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

View tool
Best alternatives

Compare similar tools in the same category.

CodeRabbit logo

CodeRabbit

AI-powered code review assistant for pull requests.

OpenClaw logo

OpenClaw

Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞

Cursor logo

Cursor

AI coding editor and autonomous software development platform

DeepSeek logo

DeepSeek

AI assistant for reasoning, coding, research, and agent tasks

ECC logo

ECC

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

View all in this category
Help
Pick an answer below
Hi! I can point you to the right tool or guide. What are you looking for?
Browse all articles