zhicao commited on
Commit
ae7e9ed
·
verified ·
1 Parent(s): 1067393

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. InternVL/.flake8 +5 -0
  3. InternVL/.github/CONTRIBUTING.md +234 -0
  4. InternVL/.github/ISSUE_TEMPLATE/1-bug-report.yml +54 -0
  5. InternVL/.github/ISSUE_TEMPLATE/2-feature-request.yml +31 -0
  6. InternVL/.github/ISSUE_TEMPLATE/3-documentation.yml +23 -0
  7. InternVL/.gitignore +174 -0
  8. InternVL/.isort.cfg +26 -0
  9. InternVL/.pre-commit-config.yaml +32 -0
  10. InternVL/INSTALLATION.md +69 -0
  11. InternVL/LICENSE +21 -0
  12. InternVL/README.md +1230 -0
  13. InternVL/README_zh.md +1158 -0
  14. InternVL/classification/README.md +238 -0
  15. InternVL/classification/config.py +299 -0
  16. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu.yaml +35 -0
  17. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenet_a.yaml +36 -0
  18. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenet_r.yaml +36 -0
  19. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenet_real.yaml +36 -0
  20. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenet_sketch.yaml +36 -0
  21. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenetv2.yaml +36 -0
  22. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu.yaml +36 -0
  23. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenet_a.yaml +37 -0
  24. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenet_r.yaml +37 -0
  25. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenet_real.yaml +37 -0
  26. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenet_sketch.yaml +37 -0
  27. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenetv2.yaml +37 -0
  28. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu.yaml +36 -0
  29. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenet_a.yaml +37 -0
  30. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenet_r.yaml +37 -0
  31. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenet_real.yaml +37 -0
  32. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenet_sketch.yaml +37 -0
  33. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenetv2.yaml +37 -0
  34. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu.yaml +36 -0
  35. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenet_a.yaml +37 -0
  36. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenet_r.yaml +37 -0
  37. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenet_real.yaml +37 -0
  38. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenet_sketch.yaml +37 -0
  39. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenetv2.yaml +37 -0
  40. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu.yaml +36 -0
  41. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenet_a.yaml +37 -0
  42. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenet_r.yaml +37 -0
  43. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenet_real.yaml +37 -0
  44. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenet_sketch.yaml +37 -0
  45. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenetv2.yaml +37 -0
  46. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu.yaml +36 -0
  47. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu_imagenet_a.yaml +37 -0
  48. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu_imagenet_r.yaml +37 -0
  49. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu_imagenet_real.yaml +37 -0
  50. InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu_imagenet_sketch.yaml +37 -0
.gitattributes CHANGED
@@ -540,3 +540,4 @@ third_party/libero/libero/libero/init_files/libero_90/LIVING_ROOM_SCENE2_pick_up
540
  third_party/libero/libero/libero/init_files/libero_90/LIVING_ROOM_SCENE2_pick_up_the_milk_and_put_it_in_the_basket.init filter=lfs diff=lfs merge=lfs -text
541
  third_party/libero/libero/libero/init_files/libero_90/LIVING_ROOM_SCENE2_pick_up_the_orange_juice_and_put_it_in_the_basket.init filter=lfs diff=lfs merge=lfs -text
542
  third_party/libero/libero/libero/init_files/libero_90/LIVING_ROOM_SCENE2_pick_up_the_tomato_sauce_and_put_it_in_the_basket.init filter=lfs diff=lfs merge=lfs -text
 
 
540
  third_party/libero/libero/libero/init_files/libero_90/LIVING_ROOM_SCENE2_pick_up_the_milk_and_put_it_in_the_basket.init filter=lfs diff=lfs merge=lfs -text
541
  third_party/libero/libero/libero/init_files/libero_90/LIVING_ROOM_SCENE2_pick_up_the_orange_juice_and_put_it_in_the_basket.init filter=lfs diff=lfs merge=lfs -text
542
  third_party/libero/libero/libero/init_files/libero_90/LIVING_ROOM_SCENE2_pick_up_the_tomato_sauce_and_put_it_in_the_basket.init filter=lfs diff=lfs merge=lfs -text
543
+ InternVL/streamlit_demo/static/SimHei.ttf filter=lfs diff=lfs merge=lfs -text
InternVL/.flake8 ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ [flake8]
2
+ ignore = E501, F403, C901, W504, W605, E251, E122, E126, E127, E722, W503, E128, E741, E731, E701
3
+ select = E1, E3, E502, E7, E9, W1, W5, W6
4
+ max-line-length = 180
5
+ exclude=*.egg/*,build,dist,detection/configs/*
InternVL/.github/CONTRIBUTING.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Contributing to InternLM
2
+
3
+ Welcome to the InternLM community, all kinds of contributions are welcomed, including but not limited to
4
+
5
+ **Fix bug**
6
+
7
+ You can directly post a Pull Request to fix typo in code or documents
8
+
9
+ The steps to fix the bug of code implementation are as follows.
10
+
11
+ 1. If the modification involve significant changes, you should create an issue first and describe the error information and how to trigger the bug. Other developers will discuss with you and propose an proper solution.
12
+
13
+ 2. Posting a pull request after fixing the bug and adding corresponding unit test.
14
+
15
+ **New Feature or Enhancement**
16
+
17
+ 1. If the modification involve significant changes, you should create an issue to discuss with our developers to propose an proper design.
18
+ 2. Post a Pull Request after implementing the new feature or enhancement and add corresponding unit test.
19
+
20
+ **Document**
21
+
22
+ You can directly post a pull request to fix documents. If you want to add a document, you should first create an issue to check if it is reasonable.
23
+
24
+ ### Pull Request Workflow
25
+
26
+ If you're not familiar with Pull Request, don't worry! The following guidance will tell you how to create a Pull Request step by step. If you want to dive into the develop mode of Pull Request, you can refer to the [official documents](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests)
27
+
28
+ #### 1. Fork and clone
29
+
30
+ If you are posting a pull request for the first time, you should fork the OpenMMLab repositories by clicking the **Fork** button in the top right corner of the GitHub page, and the forked repositories will appear under your GitHub profile.
31
+
32
+ <img src="https://user-images.githubusercontent.com/57566630/167305749-43c7f4e9-449b-4e98-ade5-0c9276d5c9ce.png" width="1200">
33
+
34
+ Then, you can clone the repositories to local:
35
+
36
+ ```shell
37
+ git clone git@github.com:{username}/lmdeploy.git
38
+ ```
39
+
40
+ After that, you should add official repository as the upstream repository
41
+
42
+ ```bash
43
+ git remote add upstream git@github.com:InternLM/lmdeploy.git
44
+ ```
45
+
46
+ Check whether remote repository has been added successfully by `git remote -v`
47
+
48
+ ```bash
49
+ origin git@github.com:{username}/lmdeploy.git (fetch)
50
+ origin git@github.com:{username}/lmdeploy.git (push)
51
+ upstream git@github.com:InternLM/lmdeploy.git (fetch)
52
+ upstream git@github.com:InternLM/lmdeploy.git (push)
53
+ ```
54
+
55
+ > Here's a brief introduction to origin and upstream. When we use "git clone", we create an "origin" remote by default, which points to the repository cloned from. As for "upstream", we add it ourselves to point to the target repository. Of course, if you don't like the name "upstream", you could name it as you wish. Usually, we'll push the code to "origin". If the pushed code conflicts with the latest code in official("upstream"), we should pull the latest code from upstream to resolve the conflicts, and then push to "origin" again. The posted Pull Request will be updated automatically.
56
+
57
+ #### 2. Configure pre-commit
58
+
59
+ You should configure [pre-commit](https://pre-commit.com/#intro) in the local development environment to make sure the code style matches that of InternLM. **Note**: The following code should be executed under the lmdeploy directory.
60
+
61
+ ```shell
62
+ pip install -U pre-commit
63
+ pre-commit install
64
+ ```
65
+
66
+ Check that pre-commit is configured successfully, and install the hooks defined in `.pre-commit-config.yaml`.
67
+
68
+ ```shell
69
+ pre-commit run --all-files
70
+ ```
71
+
72
+ <img src="https://user-images.githubusercontent.com/57566630/173660750-3df20a63-cb66-4d33-a986-1f643f1d8aaf.png" width="1200">
73
+
74
+ <img src="https://user-images.githubusercontent.com/57566630/202368856-0465a90d-8fce-4345-918e-67b8b9c82614.png" width="1200">
75
+
76
+ If the installation process is interrupted, you can repeatedly run `pre-commit run ... ` to continue the installation.
77
+
78
+ If the code does not conform to the code style specification, pre-commit will raise a warning and fixes some of the errors automatically.
79
+
80
+ <img src="https://user-images.githubusercontent.com/57566630/202369176-67642454-0025-4023-a095-263529107aa3.png" width="1200">
81
+
82
+ If we want to commit our code bypassing the pre-commit hook, we can use the `--no-verify` option(**only for temporarily commit**).
83
+
84
+ ```shell
85
+ git commit -m "xxx" --no-verify
86
+ ```
87
+
88
+ #### 3. Create a development branch
89
+
90
+ After configuring the pre-commit, we should create a branch based on the master branch to develop the new feature or fix the bug. The proposed branch name is `username/pr_name`
91
+
92
+ ```shell
93
+ git checkout -b yhc/refactor_contributing_doc
94
+ ```
95
+
96
+ In subsequent development, if the master branch of the local repository is behind the master branch of "upstream", we need to pull the upstream for synchronization, and then execute the above command:
97
+
98
+ ```shell
99
+ git pull upstream master
100
+ ```
101
+
102
+ #### 4. Commit the code and pass the unit test
103
+
104
+ - lmdeploy introduces mypy to do static type checking to increase the robustness of the code. Therefore, we need to add Type Hints to our code and pass the mypy check. If you are not familiar with Type Hints, you can refer to [this tutorial](https://docs.python.org/3/library/typing.html).
105
+
106
+ - The committed code should pass through the unit test
107
+
108
+ ```shell
109
+ # Pass all unit tests
110
+ pytest tests
111
+
112
+ # Pass the unit test of runner
113
+ pytest tests/test_runner/test_runner.py
114
+ ```
115
+
116
+ If the unit test fails for lack of dependencies, you can install the dependencies referring to the [guidance](#unit-test)
117
+
118
+ - If the documents are modified/added, we should check the rendering result referring to [guidance](#document-rendering)
119
+
120
+ #### 5. Push the code to remote
121
+
122
+ We could push the local commits to remote after passing through the check of unit test and pre-commit. You can associate the local branch with remote branch by adding `-u` option.
123
+
124
+ ```shell
125
+ git push -u origin {branch_name}
126
+ ```
127
+
128
+ This will allow you to use the `git push` command to push code directly next time, without having to specify a branch or the remote repository.
129
+
130
+ #### 6. Create a Pull Request
131
+
132
+ (1) Create a pull request in GitHub's Pull request interface
133
+
134
+ <img src="https://user-images.githubusercontent.com/57566630/201533288-516f7ac4-0b14-4dc8-afbd-912475c368b5.png" width="1200">
135
+
136
+ (2) Modify the PR description according to the guidelines so that other developers can better understand your changes
137
+
138
+ <img src="https://user-images.githubusercontent.com/57566630/202242953-c91a18ff-e388-4ff9-8591-5fae0ead6c1e.png" width="1200">
139
+
140
+ Find more details about Pull Request description in [pull request guidelines](#pr-specs).
141
+
142
+ **note**
143
+
144
+ (a) The Pull Request description should contain the reason for the change, the content of the change, and the impact of the change, and be associated with the relevant Issue (see [documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue))
145
+
146
+ (b) If it is your first contribution, please sign the CLA
147
+
148
+ <img src="https://user-images.githubusercontent.com/57566630/167307569-a794b967-6e28-4eac-a942-00deb657815f.png" width="1200">
149
+
150
+ (c) Check whether the Pull Request pass through the CI
151
+
152
+ <img src="https://user-images.githubusercontent.com/57566630/167307490-f9ebf9fa-63c0-4d83-8ba1-081ea169eb3a.png" width="1200">
153
+
154
+ IternLM will run unit test for the posted Pull Request on different platforms (Linux, Window, Mac), based on different versions of Python, PyTorch, CUDA to make sure the code is correct. We can see the specific test information by clicking `Details` in the above image so that we can modify the code.
155
+
156
+ (3) If the Pull Request passes the CI, then you can wait for the review from other developers. You'll modify the code based on the reviewer's comments, and repeat the steps [4](#4-commit-the-code-and-pass-the-unit-test)-[5](#5-push-the-code-to-remote) until all reviewers approve it. Then, we will merge it ASAP.
157
+
158
+ <img src="https://user-images.githubusercontent.com/57566630/202145400-cc2cd8c4-10b0-472f-ba37-07e6f50acc67.png" width="1200">
159
+
160
+ #### 7. Resolve conflicts
161
+
162
+ If your local branch conflicts with the latest master branch of "upstream", you'll need to resolove them. There are two ways to do this:
163
+
164
+ ```shell
165
+ git fetch --all --prune
166
+ git rebase upstream/master
167
+ ```
168
+
169
+ or
170
+
171
+ ```shell
172
+ git fetch --all --prune
173
+ git merge upstream/master
174
+ ```
175
+
176
+ If you are very good at handling conflicts, then you can use rebase to resolve conflicts, as this will keep your commit logs tidy. If you are not familiar with `rebase`, then you can use `merge` to resolve conflicts.
177
+
178
+ ### Guidance
179
+
180
+ #### Document rendering
181
+
182
+ If the documents are modified/added, we should check the rendering result. We could install the dependencies and run the following command to render the documents and check the results:
183
+
184
+ ```shell
185
+ pip install -r requirements/docs.txt
186
+ cd docs/zh_cn/
187
+ # or docs/en
188
+ make html
189
+ # check file in ./docs/zh_cn/_build/html/index.html
190
+ ```
191
+
192
+ ### Code style
193
+
194
+ #### Python
195
+
196
+ We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style.
197
+
198
+ We use the following tools for linting and formatting:
199
+
200
+ - [flake8](https://github.com/PyCQA/flake8): A wrapper around some linter tools.
201
+ - [isort](https://github.com/timothycrosley/isort): A Python utility to sort imports.
202
+ - [yapf](https://github.com/google/yapf): A formatter for Python files.
203
+ - [codespell](https://github.com/codespell-project/codespell): A Python utility to fix common misspellings in text files.
204
+ - [mdformat](https://github.com/executablebooks/mdformat): Mdformat is an opinionated Markdown formatter that can be used to enforce a consistent style in Markdown files.
205
+ - [docformatter](https://github.com/myint/docformatter): A formatter to format docstring.
206
+
207
+ We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`, `markdown files`,
208
+ fixes `end-of-files`, `double-quoted-strings`, `python-encoding-pragma`, `mixed-line-ending`, sorts `requirments.txt` automatically on every commit.
209
+ The config for a pre-commit hook is stored in [.pre-commit-config](../.pre-commit-config.yaml).
210
+
211
+ #### C++ and CUDA
212
+
213
+ The clang-format config is stored in [.clang-format](../.clang-format). And it's recommended to use clang-format version **11**. Please do not use older or newer versions as they will result in differences after formatting, which can cause the [lint](https://github.com/InternLM/lmdeploy/blob/main/.github/workflows/lint.yml#L25) to fail.
214
+
215
+ ### PR Specs
216
+
217
+ 1. Use [pre-commit](https://pre-commit.com) hook to avoid issues of code style
218
+
219
+ 2. One short-time branch should be matched with only one PR
220
+
221
+ 3. Accomplish a detailed change in one PR. Avoid large PR
222
+
223
+ - Bad: Support Faster R-CNN
224
+ - Acceptable: Add a box head to Faster R-CNN
225
+ - Good: Add a parameter to box head to support custom conv-layer number
226
+
227
+ 4. Provide clear and significant commit message
228
+
229
+ 5. Provide clear and meaningful PR description
230
+
231
+ - Task name should be clarified in title. The general format is: \[Prefix\] Short description of the PR (Suffix)
232
+ - Prefix: add new feature \[Feature\], fix bug \[Fix\], related to documents \[Docs\], in developing \[WIP\] (which will not be reviewed temporarily)
233
+ - Introduce main changes, results and influences on other modules in short description
234
+ - Associate related issues and pull requests with a milestone
InternVL/.github/ISSUE_TEMPLATE/1-bug-report.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 🐞 Bug report
2
+ description: Create a report to help us reproduce and fix the bug
3
+ title: "[Bug] "
4
+ labels: ['Bug']
5
+
6
+ body:
7
+ - type: checkboxes
8
+ attributes:
9
+ label: Checklist
10
+ options:
11
+ - label: 1. I have searched related issues but cannot get the expected help.
12
+ - label: 2. The bug has not been fixed in the latest version.
13
+ - label: 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.
14
+ - type: textarea
15
+ attributes:
16
+ label: Describe the bug
17
+ description: A clear and concise description of what the bug is.
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ attributes:
22
+ label: Reproduction
23
+ description: |
24
+ 1. What command or script did you run?
25
+ placeholder: |
26
+ A placeholder for the command.
27
+ validations:
28
+ required: true
29
+ - type: textarea
30
+ attributes:
31
+ label: Environment
32
+ description: |
33
+ 1. Please run `lmdeploy check_env` to collect necessary environment information and paste it here.
34
+ 2. You may add addition that may be helpful for locating the problem, such as
35
+ - Which **model** are you using?
36
+ - How you installed PyTorch \[e.g., pip, conda, source\]
37
+ - Other environment variables that may be related (such as `$PATH`, `$LD_LIBRARY_PATH`, `$PYTHONPATH`, etc.)
38
+ placeholder: Environment here.
39
+ render: Shell
40
+ validations:
41
+ required: true
42
+ - type: textarea
43
+ attributes:
44
+ label: Error traceback
45
+ description: |
46
+ If applicable, paste the error trackback here.
47
+ placeholder: Logs and traceback here.
48
+ render: Shell
49
+ - type: markdown
50
+ attributes:
51
+ value: >
52
+ If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
53
+
54
+ Thanks for your bug report. We appreciate it a lot.
InternVL/.github/ISSUE_TEMPLATE/2-feature-request.yml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 🚀 Feature request
2
+ description: Suggest an idea for this project
3
+ title: "[Feature] "
4
+
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ We strongly appreciate you creating a PR to implement this feature [here](https://github.com/OpenGVLab/InternVL/pulls)!
10
+ If you need our help, please fill in as much of the following form as you're able to.
11
+
12
+ **The less clear the description, the longer it will take to solve it.**
13
+ - type: textarea
14
+ attributes:
15
+ label: Motivation
16
+ description: |
17
+ A clear and concise description of the motivation of the feature.
18
+ Ex1. It is inconvenient when \[....\].
19
+ validations:
20
+ required: true
21
+ - type: textarea
22
+ attributes:
23
+ label: Related resources
24
+ description: |
25
+ If there is an official code release or third-party implementations, please also provide the information here, which would be very helpful.
26
+ - type: textarea
27
+ attributes:
28
+ label: Additional context
29
+ description: |
30
+ Add any other context or screenshots about the feature request here.
31
+ If you would like to implement the feature and create a PR, please leave a comment here and that would be much appreciated.
InternVL/.github/ISSUE_TEMPLATE/3-documentation.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: 📚 Documentation
2
+ description: Report an issue related to the documentation.
3
+ labels: "kind/doc,status/unconfirmed"
4
+ title: "[Docs] "
5
+
6
+ body:
7
+ - type: textarea
8
+ attributes:
9
+ label: 📚 The doc issue
10
+ description: >
11
+ A clear and concise description the issue.
12
+ validations:
13
+ required: true
14
+
15
+ - type: textarea
16
+ attributes:
17
+ label: Suggest a potential alternative/fix
18
+ description: >
19
+ Tell us how we could improve the documentation in this regard.
20
+ - type: markdown
21
+ attributes:
22
+ value: >
23
+ Thanks for contributing 🎉!
InternVL/.gitignore ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
161
+
162
+ .idea/
163
+
164
+ .DS_Store
165
+ data_process/
166
+ internvl_chat/work_dirs/
167
+ internvl_chat/unittest/
168
+ internvl_chat/data/
169
+ Husky2/*
170
+ data_process/
171
+ *distillation*
172
+
173
+ batchscript-*
174
+ results/
InternVL/.isort.cfg ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [isort]
2
+ line-length = 180
3
+ multi_line_output = 0
4
+ extra_standard_library = setuptools
5
+ known_third_party = PIL,asynctest,cityscapesscripts,cv2,gather_models,matplotlib,mmcv,numpy,onnx,onnxruntime,pycocotools,pytest,pytorch_sphinx_theme,requests,scipy,seaborn,six,terminaltables,torch,ts,yaml
6
+ no_lines_before = STDLIB,LOCALFOLDER
7
+ default_section = THIRDPARTY
8
+
9
+ [yapf]
10
+ BASED_ON_STYLE = pep8
11
+ BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = true
12
+ SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = true
13
+
14
+ [codespell]
15
+ skip = *.ipynb
16
+ quiet-level = 3
17
+ ignore-words-list = patten,nd,ty,mot,hist,formating,winn,gool,datas,wan,confids,TOOD,tood
18
+ © 2022 GitHub, Inc.
19
+ Terms
20
+ Privacy
21
+ Security
22
+ Status
23
+ Docs
24
+ Contact GitHub
25
+ Pricing
26
+ API
InternVL/.pre-commit-config.yaml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ exclude: ^internvl_chat_llava/
2
+ repos:
3
+ - repo: https://github.com/PyCQA/flake8
4
+ rev: 5.0.4
5
+ hooks:
6
+ - id: flake8
7
+ - repo: https://github.com/PyCQA/isort
8
+ rev: 5.11.5
9
+ hooks:
10
+ - id: isort
11
+ - repo: https://github.com/pre-commit/pre-commit-hooks
12
+ rev: v4.3.0
13
+ hooks:
14
+ - id: trailing-whitespace
15
+ - id: check-yaml
16
+ - id: end-of-file-fixer
17
+ - id: requirements-txt-fixer
18
+ - id: double-quote-string-fixer
19
+ - id: check-merge-conflict
20
+ - id: fix-encoding-pragma
21
+ args: ["--remove"]
22
+ - id: mixed-line-ending
23
+ args: ["--fix=lf"]
24
+ - repo: https://github.com/executablebooks/mdformat
25
+ rev: 0.7.9
26
+ hooks:
27
+ - id: mdformat
28
+ args: ["--number"]
29
+ additional_dependencies:
30
+ - mdformat-openmmlab
31
+ - mdformat_frontmatter
32
+ - linkify-it-py
InternVL/INSTALLATION.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## 🛠️ Installation
2
+
3
+ - Clone this repository:
4
+
5
+ ```bash
6
+ git clone https://github.com/OpenGVLab/InternVL.git
7
+ ```
8
+
9
+ - Create a conda virtual environment and activate it:
10
+
11
+ ```bash
12
+ conda create -n internvl python=3.9 -y
13
+ conda activate internvl
14
+ ```
15
+
16
+ - Install dependencies using `requirements.txt`:
17
+
18
+ ```bash
19
+ pip install -r requirements.txt
20
+ ```
21
+
22
+ By default, our `requirements.txt` file includes the following dependencies:
23
+
24
+ - `-r requirements/internvl_chat.txt`
25
+ - `-r requirements/streamlit_demo.txt`
26
+ - `-r requirements/classification.txt`
27
+ - `-r requirements/segmentation.txt`
28
+
29
+ The `clip_benchmark.txt` is **not** included in the default installation. If you require the `clip_benchmark` functionality, please install it manually by running the following command:
30
+
31
+ ```bash
32
+ pip install -r requirements/clip_benchmark.txt
33
+ ```
34
+
35
+ ### Additional Instructions
36
+
37
+ - Install `flash-attn==2.3.6`:
38
+
39
+ ```bash
40
+ pip install flash-attn==2.3.6 --no-build-isolation
41
+ ```
42
+
43
+ Alternatively you can compile from source:
44
+
45
+ ```bash
46
+ git clone https://github.com/Dao-AILab/flash-attention.git
47
+ cd flash-attention
48
+ git checkout v2.3.6
49
+ python setup.py install
50
+ ```
51
+
52
+ - Install `mmcv-full==1.6.2` (optional, for `segmentation`):
53
+
54
+ ```bash
55
+ pip install -U openmim
56
+ mim install mmcv-full==1.6.2
57
+ ```
58
+
59
+ - Install `apex` (optional, for `segmentation`):
60
+
61
+ ```bash
62
+ git clone https://github.com/NVIDIA/apex.git
63
+ git checkout 2386a912164b0c5cfcd8be7a2b890fbac5607c82 # https://github.com/NVIDIA/apex/issues/1735
64
+ pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
65
+ ```
66
+
67
+ If you encounter `ModuleNotFoundError: No module named 'fused_layer_norm_cuda'`, it is because apex's CUDA extensions are not being installed successfully. You can try uninstalling apex and the code will default to the PyTorch version of RMSNorm. Alternatively, if you prefer using apex, try adding a few lines to `setup.py` and then recompiling.
68
+
69
+ <img src=https://github.com/OpenGVLab/InternVL/assets/23737120/c04a989c-8024-49fa-b62c-2da623e63729 width=50%>
InternVL/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 OpenGVLab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
InternVL/README.md ADDED
@@ -0,0 +1,1230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+
3
+ # InternVL Family: Closing the Gap to Commercial Multimodal Models with Open-Source Suites —— A Pioneering Open-Source Alternative to GPT-5
4
+
5
+ <div align="center">
6
+ <img width="500" alt="image" src="https://github.com/user-attachments/assets/930e6814-8a9f-43e1-a284-118a5732daa4">
7
+ <br>
8
+ </div>
9
+
10
+ [\[🆕 Blog\]](https://internvl.github.io/blog/)
11
+ [\[🤔 FAQs\]](https://internvl.readthedocs.io/en/latest/tutorials/faqs.html)
12
+ [\[🗨️ Chat Demo\]](https://chat.intern-ai.org.cn/)
13
+ [\[📖 Document\]](https://internvl.readthedocs.io/en/latest/)
14
+ [\[🌐 API\]](https://internlm.intern-ai.org.cn/api/document)
15
+ [\[🚀 Quick Start\]](#quick-start-with-huggingface)
16
+
17
+ [\[🔥 InternVL3.5 Report\]](https://huggingface.co/papers/2508.18265)
18
+ [\[📜 InternVL3.0 Report\]](https://huggingface.co/papers/2504.10479)
19
+ [\[📜 InternVL2.5 MPO\]](https://huggingface.co/papers/2411.10442)
20
+ [\[📜 InternVL2.5 Report\]](https://huggingface.co/papers/2412.05271)
21
+
22
+ [\[📜 Mini-InternVL Paper\]](https://arxiv.org/abs/2410.16261)
23
+ [\[📜 InternVL2 Blog\]](https://internvl.github.io/blog/2024-07-02-InternVL-2.0/)
24
+ [\[📜 InternVL 1.5 Paper\]](https://huggingface.co/papers/2404.16821)
25
+ [\[📜 InternVL 1.0 Paper\]](https://huggingface.co/papers/2312.14238)
26
+
27
+ [\[📖 2.0 中文解读\]](https://zhuanlan.zhihu.com/p/706547971)
28
+ [\[📖 1.5 中文解读\]](https://zhuanlan.zhihu.com/p/699439759)
29
+ [\[📖 1.0 中文解读\]](https://zhuanlan.zhihu.com/p/702946079)
30
+
31
+ [Switch to the Chinese version (切换至中文版)](/README_zh.md)
32
+
33
+ <a href="https://trendshift.io/repositories/9803" target="_blank"><img src="https://trendshift.io/api/badge/repositories/9803" alt="OpenGVLab%2FInternVL | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
34
+ <img height="55" alt="image" src="https://github.com/user-attachments/assets/bd62ab46-f0ea-40c6-ab10-7fde671716cc">
35
+
36
+ ![image/jpg](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B/resolve/main/images/performance.jpg)
37
+
38
+ </div>
39
+
40
+ ## News 🚀🚀🚀
41
+
42
+ - `2025/08/30`: 🔥 We open-source the training code of [InternVL3_5-GPT-OSS-20B-A4B](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat_gpt_oss) and CascadeRL, which consists of a [offline RL stage](https://github.com/OpenGVLab/InternVL/blob/main/internvl_chat_gpt_oss/shell/internvl3_5_gpt_oss/internvl3_5_gpt_oss_20b_stage3_mpo.sh) and a [online RL stage](https://github.com/Weiyun1025/verl-internvl). The training data for these two stages ([MMPR-v1.2](https://huggingface.co/datasets/OpenGVLab/MMPR-v1.2) and [MMPR-Tiny](https://huggingface.co/datasets/OpenGVLab/MMPR-Tiny)) are also open-sourced.
43
+ - `2025/08/26`: 🚀 We introduce [InternVL3.5](https://huggingface.co/papers/2508.18265), 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](https://huggingface.co/OpenGVLab/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](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview)), which is built up on GPT-OSS-20B-A4B. Notably, we provide two model formats: [the GitHub format](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview#github-format), consistent with prior releases, and [the HF format](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview#huggingface-format), aligned with the official `transformers` standard.
44
+ - `2025/04/17`: We open-source the [data construction pipeline](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/tools/reasoning_data_pipeline) and [training scripts](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl3.0/mpo) of [MPO](https://huggingface.co/papers/2411.10442) and [VisualPRM](https://huggingface.co/papers/2503.10291). Additionally, the data construction scripts for [MPO](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl3.0/mpo_data_construction) and [VisualPRM](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl3.0/visualprm_data_construction) are also released for reference.
45
+ - `2025/04/11`: We introduce [InternVL3](https://huggingface.co/collections/OpenGVLab/internvl3-67f7f690be79c2fe9d74fe9d), an advanced multimodal large language model (MLLM) series that demonstrates superior overall performance. InternVL3-78B achieves SoTA performance in both [perception](https://rank.opencompass.org.cn/leaderboard-multimodal/?m=REALTIME) and [reasoning performance](https://rank.opencompass.org.cn/leaderboard-multimodal-reasoning/?m=REALTIME) among open-source MLLMs. The key designs of InternVL3-78B include [Variable Visual Position Encoding](https://huggingface.co/papers/2412.09616), [Native Multimodal Pre-Training](https://huggingface.co/papers/2504.10479), [Mixed Preference Optimization](https://huggingface.co/papers/2411.10442), and [Multimodal Test-Time Scaling](https://huggingface.co/papers/2503.10291).
46
+ - `2025/03/13`: We introduce [VisualPRM](https://huggingface.co/OpenGVLab/VisualPRM-8B), 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](https://huggingface.co/datasets/OpenGVLab/VisualPRM400K), is also open-sourced. Please refer to our [paper](https://huggingface.co/papers/2503.10291) and [project page](https://internvl.github.io/blog/2025-03-13-VisualPRM/) for more details.
47
+ - `2024/12/20`: We release the [InternVL2.5-MPO](https://internvl.github.io/blog/2024-12-20-InternVL-2.5-MPO/), which is finetuned with [Mixed Preference Optimization](https://huggingface.co/papers/2411.10442) on [MMPR-v1.1](https://huggingface.co/datasets/OpenGVLab/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](https://huggingface.co/collections/OpenGVLab/internvl25-mpo-6753fed98cd828219b12f849).
48
+ - `2024/12/17`: [InternVL2/2.5](https://github.com/PaddlePaddle/PaddleMIX/tree/develop/paddlemix/examples/internvl2) is supported in [PaddleMIX](https://github.com/PaddlePaddle/PaddleMIX) by Paddle Team.
49
+ - `2024/12/05`: We release the [InternVL2.5](https://huggingface.co/collections/OpenGVLab/internvl-25-673e1019b66e2218f68d7c1c), an advanced multimodal large language model (MLLM) series with parameter coverage ranging from 1B to 78B. [InternVL2_5-78B](https://huggingface.co/OpenGVLab/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](https://huggingface.co/collections/OpenGVLab/internvl-25-673e1019b66e2218f68d7c1c).
50
+ - `2024/11/14`: We introduce [MMPR](https://huggingface.co/datasets/OpenGVLab/MMPR), a high-quality, large-scale multimodal reasoning preference dataset, and [MPO](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl2.0_mpo), an effective preference optimization algorithm. The resulting model, [InternVL2-8B-MPO](https://huggingface.co/OpenGVLab/InternVL2-8B-MPO), achieves an accuracy of 67.0 on MathVista. Please refer to our [paper](https://arxiv.org/abs/2411.10442), [project page](https://internvl.github.io/blog/2024-11-14-InternVL-2.0-MPO/) and [document](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html) for more details.
51
+
52
+ <details>
53
+ <summary>More News</summary>
54
+
55
+
56
+ - `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](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/mini_internvl) and [document](https://internvl.readthedocs.io/en/latest/internvl2.0/domain_adaptation.html).
57
+ - `2024/08/01`: The [Chartmimic](https://chartmimic.github.io/) 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.
58
+ - `2024/08/01`: InternVL2-Pro achieved the SOTA performance among open-source models on the [CharXiv](https://charxiv.github.io/#leaderboard) dataset, surpassing many closed-source models such as GPT-4V, Gemini 1.5 Flash, and Claude 3 Sonnet.
59
+ - `2024/07/24`: The [MLVU](https://github.com/JUNJIE99/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.
60
+ - `2024/07/04`: We release the [InternVL2 series](https://huggingface.co/collections/OpenGVLab/internvl-20-667d3961ab5eb12c7ed1463e). InternVL2-Pro achieved a 62.0% accuracy on the MMMU benchmark, matching the performance of leading closed-source commercial models like GPT-4o.
61
+ - `2024/07/18`: InternVL2-40B achieved SOTA performance among open-source models on the [Video-MME](https://github.com/BradyFU/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.
62
+ - `2024/07/18`: InternVL2-Pro achieved the SOTA performance on the [DocVQA](https://rrc.cvc.uab.es/?ch=17&com=evaluation&task=1) and [InfoVQA](https://rrc.cvc.uab.es/?ch=17&com=evaluation&task=3) benchmarks.
63
+ - `2024/06/19`: We propose Needle In A Multimodal Haystack ([MM-NIAH](https://github.com/OpenGVLab/MM-NIAH)), the first benchmark designed to systematically evaluate the capability of existing MLLMs to comprehend long multimodal documents.
64
+ - `2024/05/30`: We release [ShareGPT-4o](https://sharegpt4o.github.io/), a large-scale dataset that we plan to open-source with 200K images, 10K videos, and 10K audios with detailed descriptions.
65
+ - `2024/05/28`: Thanks to the [lmdeploy](https://github.com/InternLM/lmdeploy) team for providing AWQ quantization support. The 4-bit model is available at [OpenGVLab/InternVL-Chat-V1-5-AWQ](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5-AWQ).
66
+ - `2024/05/13`: InternVL 1.0 can now be used as the [text encoder](https://huggingface.co/OpenGVLab/InternVL-14B-224px) for diffusion models to support multilingual generation natively in over 110 languages worldwide. See [MuLan](https://github.com/mulanai/MuLan) for more details.
67
+ - `2024/04/18`: InternVL-Chat-V1-5 has been released at [HF link](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5), approaching the performance of GPT-4V and Gemini Pro on various benchmarks like MMMU, DocVQA, ChartQA, MathVista, etc.
68
+ - `2024/02/27`: InternVL is accepted by CVPR 2024 (Oral)! 🎉
69
+ - `2024/02/21`: [InternVL-Chat-V1-2-Plus](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-2-Plus) achieved SOTA performance on MathVista (59.9), MMBench (83.8), and MMVP (58.7). See our [blog](https://internvl.github.io/blog/2024-02-21-InternVL-1.2/) for more details.
70
+ - `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](https://internvl.github.io/blog/2024-02-21-InternVL-1.2/) and [SFT data](./internvl_chat#prepare-training-datasets). The model is now available on [HuggingFace](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-2), and both training / evaluation data and scripts are open-sourced.
71
+ - `2024/01/24`: InternVL-Chat-V1-1 is released, it supports Chinese and has stronger OCR capability, see [here](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-1).
72
+ - `2024/01/16`: We release our [customized mmcv/mmsegmentation/mmdetection code](https://github.com/OpenGVLab/InternVL-MMDetSeg), integrated with DeepSpeed, which can be used for training large-scale detection and segmentation models.
73
+
74
+ </details>
75
+
76
+ ## Documents
77
+
78
+ ### 🌟 **Get Started**
79
+
80
+ - **Installation**: 🌱 [Installation Guide](https://internvl.readthedocs.io/en/latest/get_started/installation.html) | 📄 [requirements.txt](./requirements.txt)
81
+ - **Chat Data Format**: 📝 [Meta File](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#meta-file) | ✏️ [Text](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#pure-text-data) | 🖼️ [Single-Image](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#single-image-data) | 🖼️🖼️ [Multi-Image](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#multi-image-data) | 🎥 [Video](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#video-data)
82
+ - **Local Chat Demo**: 🤖 [Streamlit Demo](https://internvl.readthedocs.io/en/latest/get_started/local_chat_demo.html#streamlit-demo)
83
+ - **InternVL-Chat API**: 🌐 [InternVL2.5 API](https://internlm.intern-ai.org.cn/api/document)
84
+ - **Tutorials**: 🚀 [Enhancing InternVL2 on COCO Caption Using LoRA Fine-Tuning](https://internvl.readthedocs.io/en/latest/tutorials/coco_caption_finetune.html)
85
+
86
+ ### 🏆 **InternVL Family**
87
+
88
+ - **InternVL 3.0**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl3.0/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl3.0/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl3.0/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl3.0/evaluation.html) | 📦 [Deploy](https://internvl.readthedocs.io/en/latest/internvl3.0/deployment.html) | 🎯 [MPO](https://internvl.readthedocs.io/en/latest/internvl3.0/preference_optimization.html)
89
+ - **InternVL 2.5**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl2.5/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl2.5/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl2.5/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl2.5/evaluation.html) | 📦 [Deploy](https://internvl.readthedocs.io/en/latest/internvl2.5/deployment.html) | 🎯 [MPO](https://internvl.readthedocs.io/en/latest/internvl2.5/preference_optimization.html)
90
+ - **InternVL 2.0**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl2.0/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl2.0/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl2.0/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl2.0/evaluation.html) | 📦 [Deploy](https://internvl.readthedocs.io/en/latest/internvl2.0/deployment.html) | 🎯 [MPO](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html)
91
+ - **InternVL 1.5**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl1.5/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl1.5/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl1.5/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl1.5/evaluation.html) | 📦 [Deploy](https://internvl.readthedocs.io/en/latest/internvl1.5/deployment.html)
92
+ - **InternVL 1.2**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl1.2/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl1.2/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl1.2/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl1.2/evaluation.html)
93
+ - **InternVL 1.1**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl1.1/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl1.1/quick_start.html) | 📊 [Evaluation](https://internvl.readthedocs.io/en/latest/internvl1.1/evaluation.html)
94
+ - **InternVL 1.0**: 🖼️ [Classification](https://internvl.readthedocs.io/en/latest/internvl1.0/classification.html) | 📊 [CLIP-Benchmark](https://internvl.readthedocs.io/en/latest/internvl1.0/clip_benchmark.html) | 🎨 [Segmentation](https://internvl.readthedocs.io/en/latest/internvl1.0/segmentation.html) | 💬 [Chat-LLaVA](https://internvl.readthedocs.io/en/latest/internvl1.0/internvl_chat_llava.html) | ✨ [InternVL-G](https://internvl.readthedocs.io/en/latest/internvl1.0/internvl_g.html)
95
+
96
+ ## Model Zoo
97
+
98
+ #### Multimodal Large Language Model (InternVL 3.5)
99
+
100
+ To maintain consistency with earlier generations, we provide two model formats: [the GitHub format](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B), consistent with prior releases, and [the HF format](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-HF), aligned with the official Transformers standard.
101
+
102
+ > If you want to convert the checkpoint between these two formats, please refer to the scripts about [custom2hf](https://github.com/OpenGVLab/InternVL/blob/main/internvl_chat/tools/internvl_custom2hf.py) and [hf2custom](https://github.com/OpenGVLab/InternVL/blob/main/internvl_chat/tools/internvl_hf2custom.py).
103
+
104
+ **Github Format**
105
+ | Model | #Vision Param | #Language Param | #Total Param | HF Link | ModelScope Link |
106
+ | --------------------- | ------------- | --------------- | ------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
107
+ | InternVL3.5-1B | 0.3B | 0.8B | 1.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B) |
108
+ | InternVL3.5-2B | 0.3B | 2.0B | 2.3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B) |
109
+ | InternVL3.5-4B | 0.3B | 4.4B | 4.7B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B) |
110
+ | InternVL3.5-8B | 0.3B | 8.2B | 8.5B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B) |
111
+ | InternVL3.5-14B | 0.3B | 14.8B | 15.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B) |
112
+ | InternVL3.5-38B | 5.5B | 32.8B | 38.4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B) |
113
+ | InternVL3.5-20B-A4B | 0.3B | 20.9B | 21.2B-A4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview) |
114
+ | InternVL3.5-30B-A3B | 0.3B | 30.5B | 30.8B-A3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B) |
115
+ | InternVL3.5-241B-A28B | 5.5B | 235.1B | 240.7B-A28B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B) |
116
+
117
+ **HuggingFace Format**
118
+
119
+ | Model | #Vision Param | #Language Param | #Total Param | HF Link | ModelScope Link |
120
+ | ------------------------ | ------------- | --------------- | ------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
121
+ | InternVL3.5-1B-HF | 0.3B | 0.8B | 1.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B-HF) |
122
+ | InternVL3.5-2B-HF | 0.3B | 2.0B | 2.3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B-HF) |
123
+ | InternVL3.5-4B-HF | 0.3B | 4.4B | 4.7B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B-HF) |
124
+ | InternVL3.5-8B-HF | 0.3B | 8.2B | 8.5B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B-HF) |
125
+ | InternVL3.5-14B-HF | 0.3B | 14.8B | 15.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B-HF) |
126
+ | InternVL3.5-38B-HF | 5.5B | 32.8B | 38.4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B-HF) |
127
+ | InternVL3.5-20B-A4B-HF | 0.3B | 20.9B | 21.2B-A4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview-HF) |
128
+ | InternVL3.5-30B-A3B-HF | 0.3B | 30.5B | 30.8B-A3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B-HF) |
129
+ | InternVL3.5-241B-A28B-HF | 5.5B | 235.1B | 240.7B-A28B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B-HF) |
130
+
131
+
132
+ #### Multimodal Large Language Model (InternVL 3.0)
133
+ <table>
134
+ <tr>
135
+ <th>Model Name</th>
136
+ <th>Vision Part</th>
137
+ <th>Language Part</th>
138
+ <th>HF&nbsp;Link</th>
139
+ <th>MS&nbsp;Link</th>
140
+ </tr>
141
+ <tr>
142
+ <td>InternVL3-1B</td>
143
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT&#8209;300M&#8209;448px&#8209;V2_5</a></td>
144
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-0.5B">Qwen2.5&#8209;0.5B</a></td>
145
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL3-1B">🤗 link</a></td>
146
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL3-1B">🤖 link</a></td>
147
+ </tr>
148
+ <tr>
149
+ <td>InternVL3-2B</td>
150
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
151
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-1.5B">Qwen2.5-1.5B</a></td>
152
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL3-2B">🤗 link</a></td>
153
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL3-2B">🤖 link</a></td>
154
+ </tr>
155
+ <tr>
156
+ <td>InternVL3-8B</td>
157
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
158
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-7B">Qwen2.5-7B</a></td>
159
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL3-8B">🤗 link</a></td>
160
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL3-8B">🤖 link</a></td>
161
+ </tr>
162
+ <tr>
163
+ <td>InternVL3-9B</td>
164
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
165
+ <td><a href="https://huggingface.co/internlm/internlm3-8b-instruct">internlm3-8b-instruct</a></td>
166
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL3-9B">🤗 link</a></td>
167
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL3-9B">🤖 link</a></td>
168
+ </tr>
169
+ <tr>
170
+ <td>InternVL3-14B</td>
171
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
172
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-14B">Qwen2.5-14B</a></td>
173
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL3-14B">🤗 link</a></td>
174
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL3-14B">🤖 link</a></td>
175
+ </tr>
176
+ <tr>
177
+ <td>InternVL3-38B</td>
178
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
179
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-32B">Qwen2.5-32B</a></td>
180
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL3-38B">🤗 link</a></td>
181
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL3-38B">🤖 link</a></td>
182
+ </tr>
183
+ <tr>
184
+ <td>InternVL3-78B</td>
185
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
186
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-72B">Qwen2.5-72B</a></td>
187
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL3-78B">🤗 link</a></td>
188
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL3-78B">🤖 link</a></td>
189
+ </tr>
190
+ </table>
191
+
192
+ #### Multimodal Large Language Model (InternVL 2.5)
193
+
194
+ <table>
195
+ <tr>
196
+ <th>Model Name</th>
197
+ <th>Vision Part</th>
198
+ <th>Language Part</th>
199
+ <th>HF&nbsp;Link</th>
200
+ <th>MS&nbsp;Link</th>
201
+ </tr>
202
+ <tr>
203
+ <td>InternVL2_5-1B</td>
204
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT&#8209;300M&#8209;448px&#8209;V2_5</a></td>
205
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct">Qwen2.5&#8209;0.5B&#8209;Instruct</a></td>
206
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-1B">🤗 link</a></td>
207
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-1B">🤖 link</a></td>
208
+ </tr>
209
+ <tr>
210
+ <td>InternVL2_5-2B</td>
211
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
212
+ <td><a href="https://huggingface.co/internlm/internlm2_5-1_8b-chat">internlm2_5-1_8b-chat</a></td>
213
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-2B">🤗 link</a></td>
214
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-2B">🤖 link</a></td>
215
+ </tr>
216
+ <tr>
217
+ <td>InternVL2_5-4B</td>
218
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
219
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-3B-Instruct">Qwen2.5-3B-Instruct</a></td>
220
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-4B">🤗 link</a></td>
221
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-4B">🤖 link</a></td>
222
+ </tr>
223
+ <tr>
224
+ <td>InternVL2_5-8B</td>
225
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
226
+ <td><a href="https://huggingface.co/internlm/internlm2_5-7b-chat">internlm2_5-7b-chat</a></td>
227
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-8B">🤗 link</a></td>
228
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-8B">🤖 link</a></td>
229
+ </tr>
230
+ <tr>
231
+ <td>InternVL2_5-26B</td>
232
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
233
+ <td><a href="https://huggingface.co/internlm/internlm2_5-20b-chat">internlm2_5-20b-chat</a></td>
234
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-26B">🤗 link</a></td>
235
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-26B">🤖 link</a></td>
236
+ </tr>
237
+ <tr>
238
+ <td>InternVL2_5-38B</td>
239
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
240
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-32B-Instruct">Qwen2.5-32B-Instruct</a></td>
241
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-38B">🤗 link</a></td>
242
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-38B">🤖 link</a></td>
243
+ </tr>
244
+ <tr>
245
+ <td>InternVL2_5-78B</td>
246
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
247
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-72B-Instruct">Qwen2.5-72B-Instruct</a></td>
248
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-78B">🤗 link</a></td>
249
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-78B">🤖 link</a></td>
250
+ </tr>
251
+ </table>
252
+
253
+ <table>
254
+ <tr>
255
+ <th>Model Name</th>
256
+ <th>Vision Part</th>
257
+ <th>Language Part</th>
258
+ <th>HF&nbsp;Link</th>
259
+ <th>MS&nbsp;Link</th>
260
+ </tr>
261
+ <tr>
262
+ <td>InternVL2_5-1B-MPO</td>
263
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT&#8209;300M&#8209;448px&#8209;V2_5</a></td>
264
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct">Qwen2.5&#8209;0.5B&#8209;Instruct</a></td>
265
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-1B-MPO">🤗 link</a></td>
266
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-1B-MPO">🤖 link</a></td>
267
+ </tr>
268
+ <tr>
269
+ <td>InternVL2_5-2B-MPO</td>
270
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
271
+ <td><a href="https://huggingface.co/internlm/internlm2_5-1_8b-chat">internlm2_5-1_8b-chat</a></td>
272
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-2B-MPO">🤗 link</a></td>
273
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-2B-MPO">🤖 link</a></td>
274
+ </tr>
275
+ <tr>
276
+ <td>InternVL2_5-4B-MPO</td>
277
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
278
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-3B-Instruct">Qwen2.5-3B-Instruct</a></td>
279
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-4B-MPO">🤗 link</a></td>
280
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-4B-MPO">🤖 link</a></td>
281
+ </tr>
282
+ <tr>
283
+ <td>InternVL2_5-8B-MPO</td>
284
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
285
+ <td><a href="https://huggingface.co/internlm/internlm2_5-7b-chat">internlm2_5-7b-chat</a></td>
286
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-8B-MPO">🤗 link</a></td>
287
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-8B-MPO">🤖 link</a></td>
288
+ </tr>
289
+ <tr>
290
+ <td>InternVL2_5-26B-MPO</td>
291
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
292
+ <td><a href="https://huggingface.co/internlm/internlm2_5-20b-chat">internlm2_5-20b-chat</a></td>
293
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-26B-MPO">🤗 link</a></td>
294
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-26B-MPO">🤖 link</a></td>
295
+ </tr>
296
+ <tr>
297
+ <td>InternVL2_5-38B-MPO</td>
298
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
299
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-32B-Instruct">Qwen2.5-32B-Instruct</a></td>
300
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-38B-MPO">🤗 link</a></td>
301
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-38B-MPO">🤖 link</a></td>
302
+ </tr>
303
+ <tr>
304
+ <td>InternVL2_5-78B-MPO</td>
305
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
306
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-72B-Instruct">Qwen2.5-72B-Instruct</a></td>
307
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-78B-MPO">🤗 link</a></td>
308
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-78B-MPO">🤖 link</a></td>
309
+ </tr>
310
+ </table>
311
+
312
+ #### Multimodal Large Language Model (InternVL 2.0)
313
+
314
+ <table>
315
+ <tr>
316
+ <th>Model Name</th>
317
+ <th>Vision Part</th>
318
+ <th>Language Part</th>
319
+ <th>HF&nbsp;Link</th>
320
+ <th>MS&nbsp;Link</th>
321
+ </tr>
322
+ <tr>
323
+ <td>InternVL2-1B</td>
324
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">InternViT-300M-448px</a></td>
325
+ <td><a href="https://huggingface.co/Qwen/Qwen2-0.5B-Instruct">Qwen2-0.5B-Instruct</a></td>
326
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-1B">🤗 link</a></td>
327
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-1B">🤖 link</a></td>
328
+ </tr>
329
+ <tr>
330
+ <td>InternVL2-2B</td>
331
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">InternViT-300M-448px</a></td>
332
+ <td><a href="https://huggingface.co/internlm/internlm2-chat-1_8b">internlm2-chat-1-8b</a></td>
333
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-2B">🤗 link</a></td>
334
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-2B">🤖 link</a></td>
335
+ </tr>
336
+ <tr>
337
+ <td>InternVL2-4B</td>
338
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">InternViT-300M-448px</a></td>
339
+ <td><a href="https://huggingface.co/microsoft/Phi-3-mini-128k-instruct">Phi&#8209;3&#8209;mini&#8209;128k&#8209;instruct</a></td>
340
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-4B">🤗 link</a></td>
341
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-4B">🤖 link</a></td>
342
+ </tr>
343
+ <tr>
344
+ <td>InternVL2-8B</td>
345
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">InternViT-300M-448px</a></td>
346
+ <td><a href="https://huggingface.co/internlm/internlm2_5-7b-chat">internlm2_5-7b-chat</a></td>
347
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-8B">🤗 link</a></td>
348
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-8B">🤖 link</a></td>
349
+ </tr>
350
+ <tr>
351
+ <td>InternVL2-26B</td>
352
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-5">InternViT-6B-448px-V1-5</a></td>
353
+ <td><a href="https://huggingface.co/internlm/internlm2-chat-20b">internlm2-chat-20b</a></td>
354
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-26B">🤗 link</a></td>
355
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-26B">🤖 link</a></td>
356
+ </tr>
357
+ <tr>
358
+ <td>InternVL2-40B</td>
359
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-5">InternViT&#8209;6B&#8209;448px&#8209;V1&#8209;5</a></td>
360
+ <td><a href="https://huggingface.co/NousResearch/Nous-Hermes-2-Yi-34B">Nous&#8209;Hermes&#8209;2&#8209;Yi&#8209;34B</a></td>
361
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-40B">🤗 link</a></td>
362
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-40B">🤖 link</a></td>
363
+ </tr>
364
+ <tr>
365
+ <td>InternVL2&#8209;Llama3-76B</td>
366
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-5">InternViT-6B-448px-V1-5</a></td>
367
+ <td><a href="https://huggingface.co/NousResearch/Hermes-2-Theta-Llama-3-70B">Hermes‑2‑Theta‑<br>Llama‑3‑70B</a></td>
368
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-Llama3-76B">🤗 link</a></td>
369
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-Llama3-76B">🤖 link</a></td>
370
+ </tr>
371
+ </table>
372
+
373
+ #### Multimodal Large Language Model (InternVL 1.0-1.5)
374
+
375
+ <table>
376
+ <tr>
377
+ <th>Model</th>
378
+ <th>Date</th>
379
+ <th>HF&nbsp;Link</th>
380
+ <th>MS&nbsp;Link</th>
381
+ <th>Note</th>
382
+ </tr>
383
+ <tr>
384
+ <td>Mini&#8209;InternVL&#8209;Chat&#8209;4B&#8209;V1&#8209;5</td>
385
+ <td>2024.05.28</td>
386
+ <td><a href="https://huggingface.co/OpenGVLab/Mini-InternVL-Chat-4B-V1-5">🤗 link</a></td>
387
+ <td><a href="https://modelscope.cn/models/OpenGVLab/Mini-InternVL-Chat-4B-V1-5">🤖 link</a></td>
388
+ <td>🚀🚀 16% of the model size, 90% of the performance</td>
389
+ </tr>
390
+ <tr>
391
+ <td>Mini-InternVL-Chat-2B-V1-5</td>
392
+ <td>2024.05.19</td>
393
+ <td><a href="https://huggingface.co/OpenGVLab/Mini-InternVL-Chat-2B-V1-5">🤗 link</a></td>
394
+ <td><a href="https://modelscope.cn/models/OpenGVLab/Mini-InternVL-Chat-2B-V1-5">🤖 link</a></td>
395
+ <td>🚀 8% of the model size, 80% of the performance</td>
396
+ </tr>
397
+ <tr>
398
+ <td>InternVL-Chat-V1-5</td>
399
+ <td>2024.04.18</td>
400
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5">🤗 link</a></td>
401
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-V1-5">🤖 link</a></td>
402
+ <td>support 4K image; super strong OCR; Approaching the performance of GPT-4V and Gemini Pro on various benchmarks like MMMU, DocVQA, ChartQA, MathVista, etc.</td>
403
+ </tr>
404
+ <tr>
405
+ <td>InternVL-Chat-V1-2-Plus</td>
406
+ <td>2024.02.21</td>
407
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-V1-2-Plus">🤗 link</a></td>
408
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-V1-2-Plus">🤖 link</a></td>
409
+ <td>more SFT data and stronger</td>
410
+ </tr>
411
+ <tr>
412
+ <td>InternVL-Chat-V1-2</td>
413
+ <td>2024.02.11</td>
414
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-V1-2">🤗 link</a></td>
415
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-V1-2">🤖 link</a></td>
416
+ <td>scaling up LLM to 34B</td>
417
+ </tr>
418
+ <tr>
419
+ <td>InternVL-Chat-V1-1</td>
420
+ <td>2024.01.24</td>
421
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-V1-1">🤗 link</a></td>
422
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-V1-1">🤖 link</a></td>
423
+ <td>support Chinese and stronger OCR</td>
424
+ </tr>
425
+ <tr>
426
+ <td>InternVL-Chat-19B</td>
427
+ <td>2023.12.25</td>
428
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-ViT-6B-Vicuna-13B">🤗 link</a></td>
429
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-ViT-6B-Vicuna-13B">🤖 link</a></td>
430
+ <td>English multimodal dialogue</td>
431
+ </tr>
432
+ <tr>
433
+ <td>InternVL-Chat-13B</td>
434
+ <td>2023.12.25</td>
435
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-ViT-6B-Vicuna-7B">🤗 link</a></td>
436
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-ViT-6B-Vicuna-7B">🤖 link</a></td>
437
+ <td>English multimodal dialogue</td>
438
+ </tr>
439
+ </table>
440
+
441
+ #### CLIP-like Model (InternVL 1.0-2.5)
442
+
443
+ <table>
444
+ <tr>
445
+ <th>Model</th>
446
+ <th>Date</th>
447
+ <th>HF&nbsp;Link</th>
448
+ <th>MS&nbsp;Link</th>
449
+ <th>Note</th>
450
+ </tr>
451
+ <tr>
452
+ <td>InternViT-300M-448px-V2_5</td>
453
+ <td>2024.12.05</td>
454
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">🤗 link</a></td>
455
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-300M-448px-V2_5">🤖 link</a></td>
456
+ <td>🚀🚀 A more powerful lightweight visual encoder. (🔥new)</td>
457
+ </tr>
458
+ <tr>
459
+ <td>InternViT-6B-448px-V2_5</td>
460
+ <td>2024.12.05</td>
461
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">🤗 link</a></td>
462
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-448px-V2_5">🤖 link</a></td>
463
+ <td>🚀🚀 A stronger visual encoder to extract visual features. (🔥new)</td>
464
+ </tr>
465
+ <tr>
466
+ <td>InternViT-300M-448px</td>
467
+ <td>2024.05.25</td>
468
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">🤗 link</a></td>
469
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-300M-448px">🤖 link</a></td>
470
+ <td>distilled small vision foundation model with 300M parameters </td>
471
+ </tr>
472
+ <tr>
473
+ <td>InternViT&#8209;6B&#8209;448px&#8209;V1&#8209;5</td>
474
+ <td>2024.04.20</td>
475
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-5">🤗 link</a></td>
476
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-448px-V1-5">🤖 link</a></td>
477
+ <td>support dynamic resolution and super strong OCR feature extraction capability by incremental pre-training</td>
478
+ </tr>
479
+ <tr>
480
+ <td>InternViT-6B-448px-V1-2</td>
481
+ <td>2024.02.11</td>
482
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-2">🤗 link</a></td>
483
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-448px-V1-2">🤖 link</a></td>
484
+ <td>support 448 resolution by incremental pre-training</td>
485
+ </tr>
486
+ <tr>
487
+ <td>InternViT-6B-448px-V1-0</td>
488
+ <td>2024.01.30</td>
489
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-0">🤗 link</a></td>
490
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-448px-V1-0">🤖 link</a></td>
491
+ <td>support 448 resolution by incremental pre-training</td>
492
+ </tr>
493
+ <tr>
494
+ <td>InternViT-6B-224px</td>
495
+ <td>2023.12.22</td>
496
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-224px">🤗 link</a></td>
497
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-224px">🤖 link</a></td>
498
+ <td>the first version of InternViT-6B, extracted from InternVL‑14B‑224px</td>
499
+ </tr>
500
+ </table>
501
+
502
+ #### Vision-Language Foundation Model (InternVL 1.0)
503
+
504
+ <table>
505
+ <tr>
506
+ <th>Model</th>
507
+ <th>Date</th>
508
+ <th>HF&nbsp;Link</th>
509
+ <th>MS&nbsp;Link</th>
510
+ <th>Note</th>
511
+ </tr>
512
+ <tr>
513
+ <td>InternVL&#8209;14B&#8209;224px</td>
514
+ <td>2023.12.22</td>
515
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-14B-224px">🤗 link</a></td>
516
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-14B-224px">🤖 link</a></td>
517
+ <td>vision-language foundation model, InternViT-6B + QLLaMA, can be used for image-text retrieval like CLIP</td>
518
+ </tr>
519
+ </table>
520
+
521
+ ## TODO List
522
+
523
+ - [x] Release training / evaluation code for InternVL2.5 series
524
+ - [x] Support liger kernels to save GPU memory
525
+ - [x] Release the code, model, and data of MPO
526
+ - [x] Support multimodal packed dataset
527
+ - [ ] Support vLLM and Ollama
528
+ - [ ] Support video and PDF input in online demo
529
+ - [ ] Release InternVL2 with VisionLLMv2 integration
530
+ - [x] Rebuild documents using readthedocs
531
+ - [x] Support fine-tuning different LLMs with LoRA
532
+ - [x] Release `requirements.txt` for InternVL2
533
+ - [x] Release training / evaluation code for InternVL2 series
534
+ - [x] Release Streamlit web UI for InternVL1.5 and InternVL2
535
+
536
+ ## What can InternVL do?
537
+
538
+ <details>
539
+ <summary>Visual Perception (click to expand)</summary>
540
+
541
+ - Linear-Probe Image Classification [\[see details\]](./classification#-evaluation)
542
+
543
+ ViT-22B uses the private JFT-3B dataset.
544
+
545
+ | method | #param | IN-1K | IN-ReaL | IN-V2 | IN-A | IN-R | IN-Sketch |
546
+ | ------------------- | :----: | :---: | :-----: | :---: | :---: | :---: | :-------: |
547
+ | OpenCLIP-G | 1.8B | 86.2 | 89.4 | 77.2 | 63.8 | 87.8 | 66.4 |
548
+ | DINOv2-g | 1.1B | 86.5 | 89.6 | 78.4 | 75.9 | 78.8 | 62.5 |
549
+ | EVA-01-CLIP-g | 1.1B | 86.5 | 89.3 | 77.4 | 70.5 | 87.7 | 63.1 |
550
+ | MAWS-ViT-6.5B | 6.5B | 87.8 | - | - | - | - | - |
551
+ | ViT-22B\* | 21.7B | 89.5 | 90.9 | 83.2 | 83.8 | 87.4 | - |
552
+ | InternViT-6B (ours) | 5.9B | 88.2 | 90.4 | 79.9 | 77.5 | 89.8 | 69.1 |
553
+
554
+ - Semantic Segmentation [\[see details\]](./segmentation#-evaluation)
555
+
556
+ | method | decoder | #param (train/total) | crop size | mIoU |
557
+ | --------------------- | :-----: | :------------------: | :-------: | ------------ |
558
+ | OpenCLIP-G (frozen) | Linear | 0.3M / 1.8B | 512 | 39.3 |
559
+ | ViT-22B (frozen) | Linear | 0.9M / 21.7B | 504 | 34.6 |
560
+ | InternViT-6B (frozen) | Linear | 0.5M / 5.9B | 504 | 47.2 (+12.6) |
561
+ | ViT-22B (frozen) | UperNet | 0.8B / 22.5B | 504 | 52.7 |
562
+ | InternViT-6B (frozen) | UperNet | 0.4B / 6.3B | 504 | 54.9 (+2.2) |
563
+ | ViT-22B | UperNet | 22.5B / 22.5B | 504 | 55.3 |
564
+ | InternViT-6B | UperNet | 6.3B / 6.3B | 504 | 58.9 (+3.6) |
565
+
566
+ - Zero-Shot Image Classification [\[see details\]](./clip_benchmark#imagenet-variants-and-objectnet)
567
+
568
+ | method | IN-1K | IN-A | IN-R | IN-V2 | IN-Sketch | ObjectNet |
569
+ | ----------------- | :---: | :---: | :---: | :---: | :-------: | :-------: |
570
+ | OpenCLIP-G | 80.1 | 69.3 | 92.1 | 73.6 | 68.9 | 73.0 |
571
+ | EVA-02-CLIP-E+ | 82.0 | 82.1 | 94.5 | 75.7 | 71.6 | 79.6 |
572
+ | ViT-22B\* | 85.9 | 90.1 | 96.0 | 80.9 | - | 87.6 |
573
+ | InternVL-C (ours) | 83.2 | 83.8 | 95.5 | 77.3 | 73.9 | 80.6 |
574
+
575
+ - Multilingual Zero-Shot Image Classification [\[see details\]](./clip_benchmark#multilingual-imagenet-1k)
576
+
577
+ EN: English, ZH: Chinese, JP: Japanese, Ar: Arabic, IT: Italian
578
+
579
+ | method | IN-1K (EN) | IN-1K (ZH) | IN-1K (JP) | IN-1K (AR) | IN-1K (IT) |
580
+ | ----------------- | :--------: | :--------: | :--------: | :--------: | :--------: |
581
+ | Taiyi-CLIP-ViT-H | - | 54.4 | - | - | - |
582
+ | WuKong-ViT-L-G | - | 57.5 | - | - | - |
583
+ | CN-CLIP-ViT-H | - | 59.6 | - | - | - |
584
+ | AltCLIP-ViT-L | 74.5 | 59.6 | - | - | - |
585
+ | EVA-02-CLIP-E+ | 82.0 | - | - | - | 41.2 |
586
+ | OpenCLIP-XLM-R-H | 77.0 | 55.7 | 53.1 | 37.0 | 56.8 |
587
+ | InternVL-C (ours) | 83.2 | 64.5 | 61.5 | 44.9 | 65.7 |
588
+
589
+ - Zero-Shot Video Classification
590
+
591
+ | method | #frame | K400 | K600 | K700 |
592
+ | ----------------- | :----: | :---: | :---: | :---: |
593
+ | OpenCLIP-G | 1 | 65.9 | 66.1 | 59.2 |
594
+ | EVA-02-CLIP-E+ | 1 | 69.8 | 69.3 | 63.4 |
595
+ | InternVL-C (ours) | 1 | 71.0 | 71.3 | 65.7 |
596
+ | ViCLIP | 8 | 75.7 | 73.5 | 66.4 |
597
+ | InternVL-C (ours) | 8 | 79.4 | 78.8 | 71.5 |
598
+
599
+ </details>
600
+
601
+ <details>
602
+ <summary>Cross-Modal Retrieval (click to expand)</summary>
603
+
604
+ - English Zero-Shot Image-Text Retrieval [\[see details\]](./clip_benchmark#flickr30k--coco)
605
+
606
+ <table>
607
+ <tr align=center>
608
+ <td rowspan="3" align=left><b>model</b></td>
609
+ <td colspan="6" align=center><b>Flickr30K</b></td>
610
+ <td colspan="6" align=center><b>COCO</b></td>
611
+ <td rowspan="3" align=center><b>avg</b></td>
612
+ </tr>
613
+ <tr align=center>
614
+ <td colspan="3" align=center><b>image-to-text</b></td>
615
+ <td colspan="3" align=center><b>text-to-image</b></td>
616
+ <td colspan="3" align=center><b>image-to-text</b></td>
617
+ <td colspan="3" align=center><b>text-to-image</b></td>
618
+ </tr>
619
+ <tr>
620
+ <td>R@1</td>
621
+ <td>R@5</td>
622
+ <td>R@10</td>
623
+ <td>R@1</td>
624
+ <td>R@5</td>
625
+ <td>R@10</td>
626
+ <td>R@1</td>
627
+ <td>R@5</td>
628
+ <td>R@10</td>
629
+ <td>R@1</td>
630
+ <td>R@5</td>
631
+ <td>R@10</td>
632
+ </tr>
633
+ <tr align=center>
634
+ <td align=left>OpenCLIP-G</td>
635
+ <td>92.9</td>
636
+ <td>99.3</td>
637
+ <td>99.8</td>
638
+ <td>79.5</td>
639
+ <td>95.0</td>
640
+ <td>97.1</td>
641
+ <td>67.3</td>
642
+ <td>86.9</td>
643
+ <td>92.6</td>
644
+ <td>51.4</td>
645
+ <td>74.9</td>
646
+ <td>83.0</td>
647
+ <td>85.0</td>
648
+ </tr>
649
+ <tr align=center>
650
+ <td align=left>EVA-02-CLIP-E+</td>
651
+ <td>93.9</td>
652
+ <td>99.4</td>
653
+ <td>99.8</td>
654
+ <td>78.8</td>
655
+ <td>94.2</td>
656
+ <td>96.8</td>
657
+ <td>68.8</td>
658
+ <td>87.8</td>
659
+ <td>92.8</td>
660
+ <td>51.1</td>
661
+ <td>75.0</td>
662
+ <td>82.7</td>
663
+ <td>85.1</td>
664
+ </tr>
665
+ <tr align=center>
666
+ <td align=left>EVA-CLIP-8B</td>
667
+ <td>95.6</td>
668
+ <td>99.6</td>
669
+ <td>99.9</td>
670
+ <td>80.8</td>
671
+ <td>95.5</td>
672
+ <td>97.6</td>
673
+ <td>70.3</td>
674
+ <td>89.3</td>
675
+ <td>93.9</td>
676
+ <td>53.0</td>
677
+ <td>76.0</td>
678
+ <td>83.4</td>
679
+ <td>86.2</td>
680
+ </tr>
681
+ <tr align=center>
682
+ <td align=left>InternVL-C (ours)</td>
683
+ <td>94.7</td>
684
+ <td>99.6</td>
685
+ <td>99.9</td>
686
+ <td>81.7</td>
687
+ <td>96.0</td>
688
+ <td>98.2</td>
689
+ <td>70.6</td>
690
+ <td>89.0</td>
691
+ <td>93.5</td>
692
+ <td>54.1</td>
693
+ <td>77.3</td>
694
+ <td>84.6</td>
695
+ <td>86.6</td>
696
+ </tr>
697
+ <tr align=center>
698
+ <td align=left>InternVL-G (ours)</td>
699
+ <td>95.7</td>
700
+ <td>99.7</td>
701
+ <td>99.9</td>
702
+ <td>85.0</td>
703
+ <td>97.0</td>
704
+ <td>98.6</td>
705
+ <td>74.9</td>
706
+ <td>91.3</td>
707
+ <td>95.2</td>
708
+ <td>58.6</td>
709
+ <td>81.3</td>
710
+ <td>88.0</td>
711
+ <td>88.8</td>
712
+ </tr>
713
+
714
+ </table>
715
+
716
+ - Chinese Zero-Shot Image-Text Retrieval [\[see details\]](./clip_benchmark#flickr30k-cn--coco-cn)
717
+
718
+ <table>
719
+ <tr align=center>
720
+ <td rowspan="3" align=left><b>model</b></td>
721
+ <td colspan="6" align=center><b>Flickr30K-CN</b></td>
722
+ <td colspan="6" align=center><b>COCO-CN</b></td>
723
+ <td rowspan="3" align=center><b>avg</b></td>
724
+
725
+ </tr>
726
+ <tr align=center>
727
+ <td colspan="3" align=center><b>image-to-text</b></td>
728
+ <td colspan="3" align=center><b>text-to-image</b></td>
729
+ <td colspan="3" align=center><b>image-to-text</b></td>
730
+ <td colspan="3" align=center><b>text-to-image</b></td>
731
+ </tr>
732
+ <tr>
733
+ <td>R@1</td>
734
+ <td>R@5</td>
735
+ <td>R@10</td>
736
+ <td>R@1</td>
737
+ <td>R@5</td>
738
+ <td>R@10</td>
739
+ <td>R@1</td>
740
+ <td>R@5</td>
741
+ <td>R@10</td>
742
+ <td>R@1</td>
743
+ <td>R@5</td>
744
+ <td>R@10</td>
745
+ </tr>
746
+
747
+ <tr align=center>
748
+ <td align=left>CN-CLIP-ViT-H</td>
749
+ <td>81.6</td>
750
+ <td>97.5</td>
751
+ <td>98.8</td>
752
+ <td>71.2</td>
753
+ <td>91.4</td>
754
+ <td>95.5</td>
755
+ <td>63.0</td>
756
+ <td>86.6</td>
757
+ <td>92.9</td>
758
+ <td>69.2</td>
759
+ <td>89.9</td>
760
+ <td>96.1</td>
761
+ <td>86.1</td>
762
+ </tr>
763
+
764
+ <tr align=center>
765
+ <td align=left>OpenCLIP-XLM-R-H</td>
766
+ <td>86.1</td>
767
+ <td>97.5</td>
768
+ <td>99.2</td>
769
+ <td>71.0</td>
770
+ <td>90.5</td>
771
+ <td>94.9</td>
772
+ <td>70.0</td>
773
+ <td>91.5</td>
774
+ <td>97.0</td>
775
+ <td>66.1</td>
776
+ <td>90.8</td>
777
+ <td>96.0</td>
778
+ <td>87.6</td>
779
+ </tr>
780
+
781
+ <tr align=center>
782
+ <td align=left>InternVL-C (ours)</td>
783
+ <td>90.3</td>
784
+ <td>98.8</td>
785
+ <td>99.7</td>
786
+ <td>75.1</td>
787
+ <td>92.9</td>
788
+ <td>96.4</td>
789
+ <td>68.8</td>
790
+ <td>92.0</td>
791
+ <td>96.7</td>
792
+ <td>68.9</td>
793
+ <td>91.9</td>
794
+ <td>96.5</td>
795
+ <td>89.0</td>
796
+ </tr>
797
+ <tr align=center>
798
+ <td align=left>InternVL-G (ours)</td>
799
+ <td>92.9</td>
800
+ <td>99.4</td>
801
+ <td>99.8</td>
802
+ <td>77.7</td>
803
+ <td>94.8</td>
804
+ <td>97.3</td>
805
+ <td>71.4</td>
806
+ <td>93.9</td>
807
+ <td>97.7</td>
808
+ <td>73.8</td>
809
+ <td>94.4</td>
810
+ <td>98.1</td>
811
+ <td>90.9</td>
812
+ </tr>
813
+
814
+ </table>
815
+
816
+ - Multilingual Zero-Shot Image-Text Retrieval on XTD [\[see details\]](./clip_benchmark#xtd)
817
+
818
+ | method | EN | ES | FR | ZH | IT | KO | RU | JP | average |
819
+ | ----------------- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :-----: |
820
+ | AltCLIP | 95.4 | 94.1 | 92.9 | 95.1 | 94.2 | 94.4 | 91.8 | 91.7 | 93.7 |
821
+ | OpenCLIP-XLM-R-H | 97.3 | 96.1 | 94.5 | 94.7 | 96.0 | 90.2 | 93.9 | 94.0 | 94.6 |
822
+ | InternVL-C (ours) | 97.3 | 95.7 | 95.1 | 95.6 | 96.0 | 92.2 | 93.3 | 95.5 | 95.1 |
823
+ | InternVL-G (ours) | 98.6 | 97.7 | 96.5 | 96.7 | 96.9 | 95.1 | 94.8 | 96.1 | 96.6 |
824
+
825
+ </details>
826
+
827
+ <details>
828
+ <summary>Multimodal Dialogue</summary>
829
+
830
+ </details>
831
+
832
+ ## Quick Start with HuggingFace
833
+
834
+ <details>
835
+ <summary>using InternViT-6B for visual feature extraction (click to expand)</summary>
836
+
837
+ ```python
838
+ import torch
839
+ from PIL import Image
840
+ from transformers import AutoModel, CLIPImageProcessor
841
+
842
+ model = AutoModel.from_pretrained(
843
+ 'OpenGVLab/InternViT-6B-448px-V2_5',
844
+ torch_dtype=torch.bfloat16,
845
+ low_cpu_mem_usage=True,
846
+ trust_remote_code=True).cuda().eval()
847
+
848
+ image = Image.open('./examples/image1.jpg').convert('RGB')
849
+
850
+ image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternViT-6B-448px-V1-5')
851
+
852
+ pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
853
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
854
+
855
+ outputs = model(pixel_values)
856
+ ```
857
+
858
+ </details>
859
+
860
+ <details>
861
+ <summary>using InternVL-C(ontrastive) and InternVL-G(enerative) for cross-modal retrieval (click to expand)</summary>
862
+
863
+ ```python
864
+ import torch
865
+ from PIL import Image
866
+ from transformers import AutoModel, CLIPImageProcessor
867
+ from transformers import AutoTokenizer
868
+
869
+
870
+ model = AutoModel.from_pretrained(
871
+ 'OpenGVLab/InternVL-14B-224px',
872
+ torch_dtype=torch.bfloat16,
873
+ low_cpu_mem_usage=True,
874
+ trust_remote_code=True).cuda().eval()
875
+
876
+ image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternVL-14B-224px')
877
+
878
+ tokenizer = AutoTokenizer.from_pretrained(
879
+ 'OpenGVLab/InternVL-14B-224px', use_fast=False, add_eos_token=True)
880
+ tokenizer.pad_token_id = 0 # set pad_token_id to 0
881
+
882
+ images = [
883
+ Image.open('./examples/image1.jpg').convert('RGB'),
884
+ Image.open('./examples/image2.jpg').convert('RGB'),
885
+ Image.open('./examples/image3.jpg').convert('RGB')
886
+ ]
887
+ prefix = 'summarize:'
888
+ texts = [
889
+ prefix + 'a photo of a red panda', # English
890
+ prefix + '一张熊猫的照片', # Chinese
891
+ prefix + '二匹の猫の写真' # Japanese
892
+ ]
893
+
894
+ pixel_values = image_processor(images=images, return_tensors='pt').pixel_values
895
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
896
+ input_ids = tokenizer(texts, return_tensors='pt', max_length=80,
897
+ truncation=True, padding='max_length').input_ids.cuda()
898
+
899
+ # InternVL-C
900
+ logits_per_image, logits_per_text = model(
901
+ image=pixel_values, text=input_ids, mode='InternVL-C')
902
+ probs = logits_per_image.softmax(dim=-1)
903
+ # tensor([[9.9609e-01, 5.2185e-03, 6.0070e-08],
904
+ # [2.2949e-02, 9.7656e-01, 5.9903e-06],
905
+ # [3.2932e-06, 7.4863e-05, 1.0000e+00]], device='cuda:0',
906
+ # dtype=torch.bfloat16, grad_fn=<SoftmaxBackward0>)
907
+
908
+ # InternVL-G
909
+ logits_per_image, logits_per_text = model(
910
+ image=pixel_values, text=input_ids, mode='InternVL-G')
911
+ probs = logits_per_image.softmax(dim=-1)
912
+ # tensor([[9.9609e-01, 3.1738e-03, 3.6322e-08],
913
+ # [8.6060e-03, 9.9219e-01, 2.8759e-06],
914
+ # [1.7583e-06, 3.1233e-05, 1.0000e+00]], device='cuda:0',
915
+ # dtype=torch.bfloat16, grad_fn=<SoftmaxBackward0>)
916
+
917
+ # please set add_eos_token to False for generation
918
+ tokenizer.add_eos_token = False
919
+ image = Image.open('./examples/image1.jpg').convert('RGB')
920
+ pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
921
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
922
+
923
+ tokenized = tokenizer("English caption:", return_tensors='pt')
924
+ pred = model.generate(
925
+ pixel_values=pixel_values,
926
+ input_ids=tokenized.input_ids.cuda(),
927
+ attention_mask=tokenized.attention_mask.cuda(),
928
+ num_beams=5,
929
+ min_new_tokens=8,
930
+ )
931
+ caption = tokenizer.decode(pred[0].cpu(), skip_special_tokens=True).strip()
932
+ # English caption: a red panda sitting on top of a wooden platform
933
+ ```
934
+
935
+ </details>
936
+
937
+ <details>
938
+ <summary>using InternVL 2.5 for multimodal chat (click to expand)</summary>
939
+
940
+ Here, we take the smaller `OpenGVLab/InternVL2_5-8B` as an example:
941
+
942
+ ```python
943
+ import numpy as np
944
+ import torch
945
+ import torchvision.transforms as T
946
+ from decord import VideoReader, cpu
947
+ from PIL import Image
948
+ from torchvision.transforms.functional import InterpolationMode
949
+ from transformers import AutoModel, AutoTokenizer
950
+
951
+ IMAGENET_MEAN = (0.485, 0.456, 0.406)
952
+ IMAGENET_STD = (0.229, 0.224, 0.225)
953
+
954
+ def build_transform(input_size):
955
+ MEAN, STD = IMAGENET_MEAN, IMAGENET_STD
956
+ transform = T.Compose([
957
+ T.Lambda(lambda img: img.convert('RGB') if img.mode != 'RGB' else img),
958
+ T.Resize((input_size, input_size), interpolation=InterpolationMode.BICUBIC),
959
+ T.ToTensor(),
960
+ T.Normalize(mean=MEAN, std=STD)
961
+ ])
962
+ return transform
963
+
964
+ def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height, image_size):
965
+ best_ratio_diff = float('inf')
966
+ best_ratio = (1, 1)
967
+ area = width * height
968
+ for ratio in target_ratios:
969
+ target_aspect_ratio = ratio[0] / ratio[1]
970
+ ratio_diff = abs(aspect_ratio - target_aspect_ratio)
971
+ if ratio_diff < best_ratio_diff:
972
+ best_ratio_diff = ratio_diff
973
+ best_ratio = ratio
974
+ elif ratio_diff == best_ratio_diff:
975
+ if area > 0.5 * image_size * image_size * ratio[0] * ratio[1]:
976
+ best_ratio = ratio
977
+ return best_ratio
978
+
979
+ def dynamic_preprocess(image, min_num=1, max_num=12, image_size=448, use_thumbnail=False):
980
+ orig_width, orig_height = image.size
981
+ aspect_ratio = orig_width / orig_height
982
+
983
+ # calculate the existing image aspect ratio
984
+ target_ratios = set(
985
+ (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
986
+ i * j <= max_num and i * j >= min_num)
987
+ target_ratios = sorted(target_ratios, key=lambda x: x[0] * x[1])
988
+
989
+ # find the closest aspect ratio to the target
990
+ target_aspect_ratio = find_closest_aspect_ratio(
991
+ aspect_ratio, target_ratios, orig_width, orig_height, image_size)
992
+
993
+ # calculate the target width and height
994
+ target_width = image_size * target_aspect_ratio[0]
995
+ target_height = image_size * target_aspect_ratio[1]
996
+ blocks = target_aspect_ratio[0] * target_aspect_ratio[1]
997
+
998
+ # resize the image
999
+ resized_img = image.resize((target_width, target_height))
1000
+ processed_images = []
1001
+ for i in range(blocks):
1002
+ box = (
1003
+ (i % (target_width // image_size)) * image_size,
1004
+ (i // (target_width // image_size)) * image_size,
1005
+ ((i % (target_width // image_size)) + 1) * image_size,
1006
+ ((i // (target_width // image_size)) + 1) * image_size
1007
+ )
1008
+ # split the image
1009
+ split_img = resized_img.crop(box)
1010
+ processed_images.append(split_img)
1011
+ assert len(processed_images) == blocks
1012
+ if use_thumbnail and len(processed_images) != 1:
1013
+ thumbnail_img = image.resize((image_size, image_size))
1014
+ processed_images.append(thumbnail_img)
1015
+ return processed_images
1016
+
1017
+ def load_image(image_file, input_size=448, max_num=12):
1018
+ image = Image.open(image_file).convert('RGB')
1019
+ transform = build_transform(input_size=input_size)
1020
+ images = dynamic_preprocess(image, image_size=input_size, use_thumbnail=True, max_num=max_num)
1021
+ pixel_values = [transform(image) for image in images]
1022
+ pixel_values = torch.stack(pixel_values)
1023
+ return pixel_values
1024
+
1025
+ # If you have an 80G A100 GPU, you can put the entire model on a single GPU.
1026
+ # Otherwise, you need to load a model using multiple GPUs, please refer to the `Multiple GPUs` section.
1027
+ path = 'OpenGVLab/InternVL2_5-8B'
1028
+ model = AutoModel.from_pretrained(
1029
+ path,
1030
+ torch_dtype=torch.bfloat16,
1031
+ low_cpu_mem_usage=True,
1032
+ trust_remote_code=True).eval().cuda()
1033
+ tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True, use_fast=False)
1034
+
1035
+ # set the max number of tiles in `max_num`
1036
+ pixel_values = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
1037
+ generation_config = dict(max_new_tokens=1024, do_sample=False)
1038
+
1039
+ # pure-text conversation (纯文本对话)
1040
+ question = 'Hello, who are you?'
1041
+ response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
1042
+ print(f'User: {question}\nAssistant: {response}')
1043
+
1044
+ question = 'Can you tell me a story?'
1045
+ response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)
1046
+ print(f'User: {question}\nAssistant: {response}')
1047
+
1048
+ # single-image single-round conversation (单图单轮对话)
1049
+ question = '<image>\nPlease describe the image shortly.'
1050
+ response = model.chat(tokenizer, pixel_values, question, generation_config)
1051
+ print(f'User: {question}\nAssistant: {response}')
1052
+
1053
+ # single-image multi-round conversation (单图多轮对话)
1054
+ question = '<image>\nPlease describe the image in detail.'
1055
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
1056
+ print(f'User: {question}\nAssistant: {response}')
1057
+
1058
+ question = 'Please write a poem according to the image.'
1059
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)
1060
+ print(f'User: {question}\nAssistant: {response}')
1061
+
1062
+ # multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)
1063
+ pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
1064
+ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
1065
+ pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
1066
+
1067
+ question = '<image>\nDescribe the two images in detail.'
1068
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1069
+ history=None, return_history=True)
1070
+ print(f'User: {question}\nAssistant: {response}')
1071
+
1072
+ question = 'What are the similarities and differences between these two images.'
1073
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1074
+ history=history, return_history=True)
1075
+ print(f'User: {question}\nAssistant: {response}')
1076
+
1077
+ # multi-image multi-round conversation, separate images (多图多轮对话,独立图像)
1078
+ pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
1079
+ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
1080
+ pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
1081
+ num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
1082
+
1083
+ question = 'Image-1: <image>\nImage-2: <image>\nDescribe the two images in detail.'
1084
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1085
+ num_patches_list=num_patches_list,
1086
+ history=None, return_history=True)
1087
+ print(f'User: {question}\nAssistant: {response}')
1088
+
1089
+ question = 'What are the similarities and differences between these two images.'
1090
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1091
+ num_patches_list=num_patches_list,
1092
+ history=history, return_history=True)
1093
+ print(f'User: {question}\nAssistant: {response}')
1094
+
1095
+ # batch inference, single image per sample (单图批处理)
1096
+ pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
1097
+ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
1098
+ num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
1099
+ pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
1100
+
1101
+ questions = ['<image>\nDescribe the image in detail.'] * len(num_patches_list)
1102
+ responses = model.batch_chat(tokenizer, pixel_values,
1103
+ num_patches_list=num_patches_list,
1104
+ questions=questions,
1105
+ generation_config=generation_config)
1106
+ for question, response in zip(questions, responses):
1107
+ print(f'User: {question}\nAssistant: {response}')
1108
+
1109
+ # video multi-round conversation (视频多轮对话)
1110
+ def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):
1111
+ if bound:
1112
+ start, end = bound[0], bound[1]
1113
+ else:
1114
+ start, end = -100000, 100000
1115
+ start_idx = max(first_idx, round(start * fps))
1116
+ end_idx = min(round(end * fps), max_frame)
1117
+ seg_size = float(end_idx - start_idx) / num_segments
1118
+ frame_indices = np.array([
1119
+ int(start_idx + (seg_size / 2) + np.round(seg_size * idx))
1120
+ for idx in range(num_segments)
1121
+ ])
1122
+ return frame_indices
1123
+
1124
+ def load_video(video_path, bound=None, input_size=448, max_num=1, num_segments=32):
1125
+ vr = VideoReader(video_path, ctx=cpu(0), num_threads=1)
1126
+ max_frame = len(vr) - 1
1127
+ fps = float(vr.get_avg_fps())
1128
+
1129
+ pixel_values_list, num_patches_list = [], []
1130
+ transform = build_transform(input_size=input_size)
1131
+ frame_indices = get_index(bound, fps, max_frame, first_idx=0, num_segments=num_segments)
1132
+ for frame_index in frame_indices:
1133
+ img = Image.fromarray(vr[frame_index].asnumpy()).convert('RGB')
1134
+ img = dynamic_preprocess(img, image_size=input_size, use_thumbnail=True, max_num=max_num)
1135
+ pixel_values = [transform(tile) for tile in img]
1136
+ pixel_values = torch.stack(pixel_values)
1137
+ num_patches_list.append(pixel_values.shape[0])
1138
+ pixel_values_list.append(pixel_values)
1139
+ pixel_values = torch.cat(pixel_values_list)
1140
+ return pixel_values, num_patches_list
1141
+
1142
+ video_path = './examples/red-panda.mp4'
1143
+ pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)
1144
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
1145
+ video_prefix = ''.join([f'Frame-{i+1}: <image>\n' for i in range(len(num_patches_list))])
1146
+ question = video_prefix + 'What is the red panda doing?'
1147
+ # Frame1: <image>\nFrame2: <image>\n...\nFrame8: <image>\n{question}
1148
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1149
+ num_patches_list=num_patches_list, history=None, return_history=True)
1150
+ print(f'User: {question}\nAssistant: {response}')
1151
+
1152
+ question = 'Describe this video in detail.'
1153
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1154
+ num_patches_list=num_patches_list, history=history, return_history=True)
1155
+ print(f'User: {question}\nAssistant: {response}')
1156
+ ```
1157
+
1158
+ </details>
1159
+
1160
+ ## License
1161
+
1162
+ This project is released under the [MIT license](LICENSE). Parts of this project contain code and models from other sources, which are subject to their respective licenses.
1163
+
1164
+ ## Citation
1165
+
1166
+ If you find this project useful in your research, please consider cite:
1167
+
1168
+ ```BibTeX
1169
+ @article{wang2025internvl3_5,
1170
+ title={InternVL3.5: Advancing Open-Source Multimodal Models in Versatility, Reasoning, and Efficiency},
1171
+ 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},
1172
+ journal={arXiv preprint arXiv:2508.18265},
1173
+ year={2025}
1174
+ }
1175
+ @article{zhu2025internvl3,
1176
+ title={Internvl3: Exploring advanced training and test-time recipes for open-source multimodal models},
1177
+ 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},
1178
+ journal={arXiv preprint arXiv:2504.10479},
1179
+ year={2025}
1180
+ }
1181
+ @article{chen2024expanding,
1182
+ title={Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling},
1183
+ 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},
1184
+ journal={arXiv preprint arXiv:2412.05271},
1185
+ year={2024}
1186
+ }
1187
+ @article{wang2024mpo,
1188
+ title={Enhancing the Reasoning Ability of Multimodal Large Language Models via Mixed Preference Optimization},
1189
+ 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},
1190
+ journal={arXiv preprint arXiv:2411.10442},
1191
+ year={2024}
1192
+ }
1193
+ @article{gao2024mini,
1194
+ title={Mini-InternVL: a flexible-transfer pocket multi-modal model with 5\% parameters and 90\% performance},
1195
+ 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},
1196
+ journal={Visual Intelligence},
1197
+ volume={2},
1198
+ number={1},
1199
+ pages={1--17},
1200
+ year={2024},
1201
+ publisher={Springer}
1202
+ }
1203
+ @article{chen2024far,
1204
+ title={How far are we to gpt-4v? closing the gap to commercial multimodal models with open-source suites},
1205
+ 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},
1206
+ journal={Science China Information Sciences},
1207
+ volume={67},
1208
+ number={12},
1209
+ pages={220101},
1210
+ year={2024},
1211
+ publisher={Springer}
1212
+ }
1213
+ @inproceedings{chen2024internvl,
1214
+ title={Internvl: Scaling up vision foundation models and aligning for generic visual-linguistic tasks},
1215
+ 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},
1216
+ booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
1217
+ pages={24185--24198},
1218
+ year={2024}
1219
+ }
1220
+ ```
1221
+
1222
+ ## Acknowledgement
1223
+
1224
+ InternVL is built with reference to the code of the following projects: [OpenAI CLIP](https://github.com/openai/CLIP), [Open CLIP](https://github.com/mlfoundations/open_clip), [CLIP Benchmark](https://github.com/LAION-AI/CLIP_benchmark), [EVA](https://github.com/baaivision/EVA/tree/master), [InternImage](https://github.com/OpenGVLab/InternImage), [ViT-Adapter](https://github.com/czczup/ViT-Adapter), [MMSegmentation](https://github.com/open-mmlab/mmsegmentation), [Transformers](https://github.com/huggingface/transformers), [DINOv2](https://github.com/facebookresearch/dinov2), [BLIP-2](https://github.com/salesforce/LAVIS/tree/main/projects/blip2), [Qwen-VL](https://github.com/QwenLM/Qwen-VL/tree/master/eval_mm), and [LLaVA-1.5](https://github.com/haotian-liu/LLaVA). Thanks for their awesome work!
1225
+
1226
+ ______________________________________________________________________
1227
+
1228
+ Scan the following QR Code, join our WeChat group.
1229
+
1230
+ <p align="center"><img width="300" alt="image" src="https://github.com/user-attachments/assets/f776df09-ebba-4fd5-80c2-fec4ff1518be"></p>
InternVL/README_zh.md ADDED
@@ -0,0 +1,1158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+
3
+ # InternVL家族:通过开源组件缩小与商业多模态模型的差距 —— GPT-5的开源替代方案
4
+
5
+ <div align="center">
6
+ <img width="500" alt="image" src="https://github.com/user-attachments/assets/930e6814-8a9f-43e1-a284-118a5732daa4">
7
+ <br>
8
+ </div>
9
+
10
+ [\[🆕 博客\]](https://internvl.github.io/blog/)
11
+ [\[🤔 常见问题\]](https://internvl.readthedocs.io/en/latest/tutorials/faqs.html)
12
+ [\[🗨️ 对话Demo\]](https://chat.intern-ai.org.cn/)
13
+ [\[📖 文档\]](https://internvl.readthedocs.io/en/latest/)
14
+ [\[🌐 API\]](https://internlm.intern-ai.org.cn/api/document)
15
+ [\[🚀 快速开始\]](#使用-huggingface-快速开始)
16
+
17
+ [\[🔥 InternVL3.5 Report\]](https://huggingface.co/papers/2508.18265)
18
+ [\[📜 InternVL3.0 Report\]](https://huggingface.co/papers/2504.10479)
19
+ [\[📜 InternVL2.5 MPO\]](https://huggingface.co/papers/2411.10442)
20
+ [\[📜 InternVL 2.5 报告\]](https://huggingface.co/papers/2412.05271)
21
+
22
+ [\[📜 Mini-InternVL 论文\]](https://arxiv.org/abs/2410.16261)
23
+ [\[📜 InternVL2 博客\]](https://internvl.github.io/blog/2024-07-02-InternVL-2.0/)
24
+ [\[📜 InternVL 1.5 论文\]](https://huggingface.co/papers/2404.16821)
25
+ [\[📜 InternVL 1.0 论文\]](https://huggingface.co/papers/2312.14238)
26
+
27
+ [\[📖 2.0 中文解读\]](https://zhuanlan.zhihu.com/p/706547971) [\[📖 1.5 中文解读\]](https://zhuanlan.zhihu.com/p/699439759) [\[📖 1.0 中文解读\]](https://zhuanlan.zhihu.com/p/702946079)
28
+
29
+ [Switch to the English version (切换至英文版)](/README.md)
30
+
31
+ <a href="https://trendshift.io/repositories/9803" target="_blank"><img src="https://trendshift.io/api/badge/repositories/9803" alt="OpenGVLab%2FInternVL | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
32
+ <img height="55" alt="image" src="https://github.com/user-attachments/assets/bd62ab46-f0ea-40c6-ab10-7fde671716cc">
33
+
34
+ ![image/jpg](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B/resolve/main/images/performance.jpg)
35
+
36
+ </div>
37
+
38
+ ## 最新消息 🚀🚀🚀
39
+
40
+
41
+ - `2025/08/30`: 🔥 我们开源了[InternVL3_5-GPT-OSS-20B-A4B](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat_gpt_oss)以及CascadeRL(包含[离线强化学习](https://github.com/OpenGVLab/InternVL/blob/main/internvl_chat_gpt_oss/shell/internvl3_5_gpt_oss/internvl3_5_gpt_oss_20b_stage3_mpo.sh)和[在线强化学习](https://github.com/Weiyun1025/verl-internvl)两个阶段)的训练代码。这两个阶段的训练数据([MMPR-v1.2](https://huggingface.co/datasets/OpenGVLab/MMPR-v1.2)和[MMPR-Tiny](https://huggingface.co/datasets/OpenGVLab/MMPR-Tiny))也已经开源。
42
+ - `2025/08/26`: 🚀 我们发布了[InternVL3.5](https://huggingface.co/papers/2508.18265),一个在全面性、推理能力以及推理效率上都取得了全面提升的开源多模态模型系列。其中,最大的模型([InternVL3.5-241B-A28B](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B))在开源多模态大语言模型中取得了最优的多模态感知、推理、语言以及agency性能。同时,我们基于OpenAI开源的GPT-OSS-20B-A4B也发布了一个20B-A4B的版本([InternVL3_5-GPT-OSS-20B-A4B](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview))。值得注意的是,我们提供了两种模型权重的格式,包括和前几代权重格式一致的 [GitHub 格式](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview#github-format)以及和`transformers`库格式一致的 [HuggingFace 格式](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview#huggingface-format)。
43
+ - `2025/04/17`: 我们开源了 [MPO](https://huggingface.co/papers/2411.10442) 和 [VisualPRM](https://huggingface.co/papers/2503.10291) 的[数据构造管线](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/tools/reasoning_data_pipeline)及[训练脚本](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl3.0/mpo)。 此外 [MPO](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl3.0/mpo_data_construction) 和 [VisualPRM](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl3.0/visualprm_data_construction) 的数据构建脚本也已经开源。
44
+ - `2025/04/11`: 我们发布了 [InternVL3](https://huggingface.co/collections/OpenGVLab/internvl3-67f7f690be79c2fe9d74fe9d), 一个性能强大的开源多模态大模型。 其中 InternVL3-78B 同时在[感知能力](https://rank.opencompass.org.cn/leaderboard-multimodal/?m=REALTIME)和[推理能力](https://rank.opencompass.org.cn/leaderboard-multimodal-reasoning/?m=REALTIME)上同时达到了开源第一的性能。 InternVL3-78B 的核心技术包括:[Variable Visual Position Encoding](https://huggingface.co/papers/2412.09616),[Native Multimodal Pre-Training](https://huggingface.co/papers/2504.10479),[Mixed Preference Optimization](https://huggingface.co/papers/2411.10442),以及 [Multimodal Test-Time Scaling](https://huggingface.co/papers/2503.10291)。
45
+ - `2025/03/13`: 我们发布了 [VisualPRM](https://huggingface.co/OpenGVLab/VisualPRM-8B),一个8B参数两的多模态过程奖励模型(PRM)。该模型在 Best-of-8 的评测设置下使得 InternVL2.5-8B 和 InternVL2.5-78B 在七个多模态推理评测基准上的综合性能分别提升了 8.4 和 5.9 分。该模型的训练数据 [VisualPRM400K](https://huggingface.co/datasets/OpenGVLab/VisualPRM400K)也已经开源。请参考我们的[论文](https://huggingface.co/papers/2503.10291)和[项目主页](https://internvl.github.io/blog/2025-03-13-VisualPRM/)来了解更多细节。
46
+ - `2024/12/20`: 我们发布了 [InternVL2.5-MPO系列](https://internvl.github.io/blog/2024-12-20-InternVL-2.5-MPO/)。该系列通过 [Mixed Preference Optimization](https://huggingface.co/papers/2411.10442) 算法和 [MMPR-v1.1](https://huggingface.co/datasets/OpenGVLab/MMPR-v1.1) 数据集微调得到。**该系列模型在OpenCompass评测榜单中的整体性能超过MPO训练前两个百分点。** 这些模型可在 [HF 链接](https://huggingface.co/collections/OpenGVLab/internvl25-mpo-6753fed98cd828219b12f849)中下载。
47
+ - `2024/12/17`: Paddle团队已在[PaddleMIX](https://github.com/PaddlePaddle/PaddleMIX)框架中适配[InternVL2/2.5](https://github.com/PaddlePaddle/PaddleMIX/tree/develop/paddlemix/examples/internvl2)。
48
+ - `2024/12/05`: 我们发布了 InternVL2.5 系列,覆盖了从1B参数到78B参数的多模态大语言模型。[InternVL2_5-78B](https://huggingface.co/OpenGVLab/InternVL2_5-78B) 是首个在MMMU benchmark上得分超过70的开源模型。 这些模型可在 [HF 链接](https://huggingface.co/collections/OpenGVLab/internvl-25-673e1019b66e2218f68d7c1c) 中下载。
49
+ - `2024/11/14`: 我们发布了 [MMPR](https://huggingface.co/datasets/OpenGVLab/MMPR),一个高质量、大规模的多模态推理偏好数据集,以及 [MPO](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl2.0_mpo),一种高效的偏好优化算法。由此训练的模型 [InternVL2-8B-MPO](https://huggingface.co/OpenGVLab/InternVL2-8B-MPO) 在 MathVista 上取得了 67.0 的准确率。更多详情请参阅我们的[论文](https://arxiv.org/abs/2411.10442)、[项目主页](https://internvl.github.io/blog/2024-11-14-InternVL-2.0-MPO/) 和 [文档](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html)。
50
+
51
+
52
+ <details>
53
+ <summary>更多</summary>
54
+
55
+
56
+ - `2024/10/21`: 我们发布了 Mini-InternVL 系列。这些模型在保持极小模型体积的同时实现了出色的性能:4B 模型仅用 5% 的模型大小便达到了 90% 的性能。有关更多详细信息,请查看我们的 [项目页面](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/mini_internvl) 和 [文档](https://internvl.readthedocs.io/en/latest/internvl2.0/domain_adaptation.html)。
57
+ - `2024/08/01`: [Chartmimic](https://chartmimic.github.io/) 团队在他们的基准测试中评估了 InternVL2 系列模型。InternVL2-26B 和 76B 模型在开源模型中取得了前两名的成绩,其中 InternVL2-Llama3-76B 模型超过了 GeminiProVision,并表现出与 Claude-3-opus 相当的结果。
58
+ - `2024/08/01`: InternVL2-Pro 在 [CharXiv](https://charxiv.github.io/#leaderboard) 数据集中实现了开源模型中的 SOTA 性能,也比部分知名闭源模型如 GPT-4V、Gemini 1.5 Flash、Claude 3 Sonnet 取得了更好成绩
59
+ - `2024/07/24`: [MLVU](https://github.com/JUNJIE99/MLVU)团队在它们的基准测试中评估了InternVL-1.5。在多项选择任务上的平均表现为50.4%,而在生成任务上的表现为4.02。多项选择任务的表现在所有开源多模态大语言模型中排名第一。
60
+ - `2024/07/04`: 我们发布了 InternVL2 系列模型。InternVL2-Pro 在 MMMU 基准测试中达到了 62.0% 的准确率,实现了与 GPT-4o 等领先闭源商业模型比肩的性能。模型权重可在 [HF 链接](https://huggingface.co/collections/OpenGVLab/internvl-20-667d3961ab5eb12c7ed1463e) 中下载。
61
+ - `2024/07/18`: InternVL2-40B 在 [Video-MME](https://github.com/BradyFU/Video-MME) 数据集中实现了开源模型中的 SOTA 性能,当输入 16 帧时得分为 61.2,输入 32 帧时得分为 64.4,大幅领先其它开源模型,是最接近 GPT-4o mini 的开源模型。
62
+ - `2024/07/18`: InternVL2-Pro 在 [DocVQA](https://rrc.cvc.uab.es/?ch=17&com=evaluation&task=1) 和 [InfoVQA](https://rrc.cvc.uab.es/?ch=17&com=evaluation&task=3) 的基准测试中实现了 SOTA 性能。
63
+ - `2024/06/19`: 我们提出了 Needle In A Multimodal Haystack ([MM-NIAH](https://github.com/OpenGVLab/MM-NIAH)),这是第一个针对模型关于长多模态文档理解能力的评测基准。
64
+ - `2024/05/30`: 我们发布了 [ShareGPT-4o](https://sharegpt4o.github.io/),这是一个大规模、高质量的多模态数据集。我们计划开源一批使用 GPT-4o 精心标注的数据,包括 200K 条图像详细描述、10K 条视频详细描述,以及 10K 条音频详细描述。
65
+ - `2024/05/29`: 我们开源了 Mini-InternVL 系列,包括以下两个对话模型:[Mini-InternVL-Chat-2B-V1-5](https://huggingface.co/OpenGVLab/Mini-InternVL-Chat-2B-V1-5) 和 [Mini-InternVL-Chat-4B-V1-5](https://huggingface.co/OpenGVLab/Mini-InternVL-Chat-4B-V1-5)。这些模型在极小的尺寸下实现了令人印象深刻的性能:2B 模型以 8% 的模型尺寸实现了 80% 的性能,4B 模型以 16% 的模型尺寸实现了 90% 的性能。更多细节请查看我们的[博客](https://internvl.github.io/blog/2024-05-25-Mini-InternVL-1.5/)。
66
+ - `2024/05/13`: InternVL 1.0 现在可以作为扩散模型的 [文本编码器](https://huggingface.co/OpenGVLab/InternVL-14B-224px),支持全球超过 110 种语言的多语言生成。详情请看 [MuLan](https://github.com/mulanai/MuLan)。
67
+ - `2024/04/18`: InternVL-Chat-V1-5 已经在 [HuggingFace](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5) 发布,在 MMMU、DocVQA、ChartQA、MathVista 等各种基准测试中,性能接近 GPT-4V 和 Gemini Pro。
68
+ - `2024/02/27`: InternVL 已被 CVPR 2024 (Oral) 接收!🎉
69
+ - `2024/02/21`: [InternVL-Chat-V1-2-Plus](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-2-Plus) 在 MathVista(59.9)、MMBench(83.8)和 MMVP(58.7)上实现了 SOTA 性能。详情请看我们的[博客](https://internvl.github.io/blog/2024-02-21-InternVL-1.2/)。
70
+ - `2024/02/12`: InternVL-Chat-V1-2 已经发布,它在 MMMU 验证集上达到了 51.6,在 MMBench 测试集上达到了 82.3。 更多信息请参考我们的[博客](https://internvl.github.io/blog/2024-02-21-InternVL-1.2/)以及 [SFT 数据](./internvl_chat#prepare-training-datasets)。该模型已经在 [HuggingFace](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-2) 发布,训练、测评的数据和脚本均已开源。
71
+ - `2024/01/24`: InternVL-Chat-V1-1 已经发布,它支持中文对话,并具备强大的 OCR 能力,详情请看[这里](https://huggingface.co/OpenGVLab/InternVL-Chat-V1-1)。
72
+ - `2024/01/16`: 我们发布了 [定制的 mmcv/mmsegmentation/mmdetection 代码库](https://github.com/OpenGVLab/InternVL-MMDetSeg),集成了 DeepSpeed,可以用于训练检测和分割大模型。
73
+
74
+ </details>
75
+
76
+ ## 使用文档
77
+
78
+ ### 🌟 **Get Started**
79
+
80
+ - **Installation**: 🌱 [Installation Guide](https://internvl.readthedocs.io/en/latest/get_started/installation.html) | 📄 [requirements.txt](./requirements.txt)
81
+ - **Chat Data Format**: 📝 [Meta File](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#meta-file) | ✏️ [Text](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#pure-text-data) | 🖼️ [Single-Image](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#single-image-data) | 🖼️🖼️ [Multi-Image](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#multi-image-data) | 🎥 [Video](https://internvl.readthedocs.io/en/latest/get_started/chat_data_format.html#video-data)
82
+ - **Local Chat Demo**: 🤖 [Streamlit Demo](https://internvl.readthedocs.io/en/latest/get_started/local_chat_demo.html#streamlit-demo)
83
+ - **InternVL-Chat API**: 🌐 [InternVL2.5 API](https://internlm.intern-ai.org.cn/api/document)
84
+ - **Tutorials**: 🚀 [Enhancing InternVL2 on COCO Caption Using LoRA Fine-Tuning](https://internvl.readthedocs.io/en/latest/tutorials/coco_caption_finetune.html)
85
+
86
+ ### 🏆 **InternVL Family**
87
+
88
+ - **InternVL 2.5**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl2.5/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl2.5/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl2.5/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl2.5/evaluation.html) | 📦 [Deploy](https://internvl.readthedocs.io/en/latest/internvl2.5/deployment.html) | 🎯 [MPO](https://internvl.readthedocs.io/en/latest/internvl2.5/preference_optimization.html)
89
+ - **InternVL 2.0**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl2.0/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl2.0/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl2.0/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl2.0/evaluation.html) | 📦 [Deploy](https://internvl.readthedocs.io/en/latest/internvl2.0/deployment.html) | 🎯 [MPO](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html)
90
+ - **InternVL 1.5**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl1.5/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl1.5/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl1.5/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl1.5/evaluation.html) | 📦 [Deploy](https://internvl.readthedocs.io/en/latest/internvl1.5/deployment.html)
91
+ - **InternVL 1.2**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl1.2/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl1.2/quick_start.html) | ✨ [Finetune](https://internvl.readthedocs.io/en/latest/internvl1.2/finetune.html) | 📊 [Evaluate](https://internvl.readthedocs.io/en/latest/internvl1.2/evaluation.html)
92
+ - **InternVL 1.1**: 📖 [Intro](https://internvl.readthedocs.io/en/latest/internvl1.1/introduction.html) | ⚡ [Quick Start](https://internvl.readthedocs.io/en/latest/internvl1.1/quick_start.html) | 📊 [Evaluation](https://internvl.readthedocs.io/en/latest/internvl1.1/evaluation.html)
93
+ - **InternVL 1.0**: 🖼️ [Classification](https://internvl.readthedocs.io/en/latest/internvl1.0/classification.html) | 📊 [CLIP-Benchmark](https://internvl.readthedocs.io/en/latest/internvl1.0/clip_benchmark.html) | 🎨 [Segmentation](https://internvl.readthedocs.io/en/latest/internvl1.0/segmentation.html) | 💬 [Chat-LLaVA](https://internvl.readthedocs.io/en/latest/internvl1.0/internvl_chat_llava.html) | ✨ [InternVL-G](https://internvl.readthedocs.io/en/latest/internvl1.0/internvl_g.html)
94
+
95
+ ## 模型库
96
+
97
+ #### 多模态大语言模型 (InternVL 3.5)
98
+
99
+ 为了保持和前几代模型的一致性,我们提供了两种模型权重的格式,包括和前几代权重格式一致的 [GitHub 格式](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B)以及和`transformers`库格式一致的 [HuggingFace 格式](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-HF)。
100
+
101
+ > 如果你希望转换这两种格式的权重,请参考我们的脚本:[custom2hf](https://github.com/OpenGVLab/InternVL/blob/main/internvl_chat/tools/internvl_custom2hf.py) 以及 [hf2custom](https://github.com/OpenGVLab/InternVL/blob/main/internvl_chat/tools/internvl_hf2custom.py).
102
+
103
+ **Github 格式**
104
+ | Model | #Vision Param | #Language Param | #Total Param | HF Link | ModelScope Link |
105
+ | --------------------- | ------------- | --------------- | ------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
106
+ | InternVL3.5-1B | 0.3B | 0.8B | 1.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B) |
107
+ | InternVL3.5-2B | 0.3B | 2.0B | 2.3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B) |
108
+ | InternVL3.5-4B | 0.3B | 4.4B | 4.7B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B) |
109
+ | InternVL3.5-8B | 0.3B | 8.2B | 8.5B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B) |
110
+ | InternVL3.5-14B | 0.3B | 14.8B | 15.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B) |
111
+ | InternVL3.5-38B | 5.5B | 32.8B | 38.4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B) |
112
+ | InternVL3.5-20B-A4B | 0.3B | 20.9B | 21.2B-A4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview) |
113
+ | InternVL3.5-30B-A3B | 0.3B | 30.5B | 30.8B-A3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B) |
114
+ | InternVL3.5-241B-A28B | 5.5B | 235.1B | 240.7B-A28B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B) |
115
+
116
+ **HuggingFace 格式**
117
+
118
+ | Model | #Vision Param | #Language Param | #Total Param | HF Link | ModelScope Link |
119
+ | ------------------------ | ------------- | --------------- | ------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
120
+ | InternVL3.5-1B-HF | 0.3B | 0.8B | 1.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B-HF) |
121
+ | InternVL3.5-2B-HF | 0.3B | 2.0B | 2.3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B-HF) |
122
+ | InternVL3.5-4B-HF | 0.3B | 4.4B | 4.7B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B-HF) |
123
+ | InternVL3.5-8B-HF | 0.3B | 8.2B | 8.5B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B-HF) |
124
+ | InternVL3.5-14B-HF | 0.3B | 14.8B | 15.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B-HF) |
125
+ | InternVL3.5-38B-HF | 5.5B | 32.8B | 38.4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B-HF) |
126
+ | InternVL3.5-20B-A4B-HF | 0.3B | 20.9B | 21.2B-A4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview-HF) |
127
+ | InternVL3.5-30B-A3B-HF | 0.3B | 30.5B | 30.8B-A3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B-HF) |
128
+ | InternVL3.5-241B-A28B-HF | 5.5B | 235.1B | 240.7B-A28B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B-HF) |
129
+
130
+
131
+
132
+ #### 多模态大语言模型 (InternVL 2.5)
133
+
134
+ <table>
135
+ <tr>
136
+ <th>Model Name</th>
137
+ <th>Vision Part</th>
138
+ <th>Language Part</th>
139
+ <th>HF&nbsp;Link</th>
140
+ <th>MS&nbsp;Link</th>
141
+ </tr>
142
+ <tr>
143
+ <td>InternVL2_5-1B</td>
144
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT&#8209;300M&#8209;448px&#8209;V2_5</a></td>
145
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct">Qwen2.5&#8209;0.5B&#8209;Instruct</a></td>
146
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-1B">🤗 link</a></td>
147
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-1B">🤖 link</a></td>
148
+ </tr>
149
+ <tr>
150
+ <td>InternVL2_5-2B</td>
151
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
152
+ <td><a href="https://huggingface.co/internlm/internlm2_5-1_8b-chat">internlm2_5-1_8b-chat</a></td>
153
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-2B">🤗 link</a></td>
154
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-2B">🤖 link</a></td>
155
+ </tr>
156
+ <tr>
157
+ <td>InternVL2_5-4B</td>
158
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
159
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-3B-Instruct">Qwen2.5-3B-Instruct</a></td>
160
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-4B">🤗 link</a></td>
161
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-4B">🤖 link</a></td>
162
+ </tr>
163
+ <tr>
164
+ <td>InternVL2_5-8B</td>
165
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
166
+ <td><a href="https://huggingface.co/internlm/internlm2_5-7b-chat">internlm2_5-7b-chat</a></td>
167
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-8B">🤗 link</a></td>
168
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-8B">🤖 link</a></td>
169
+ </tr>
170
+ <tr>
171
+ <td>InternVL2_5-26B</td>
172
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
173
+ <td><a href="https://huggingface.co/internlm/internlm2_5-20b-chat">internlm2_5-20b-chat</a></td>
174
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-26B">🤗 link</a></td>
175
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-26B">🤖 link</a></td>
176
+ </tr>
177
+ <tr>
178
+ <td>InternVL2_5-38B</td>
179
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
180
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-32B-Instruct">Qwen2.5-32B-Instruct</a></td>
181
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-38B">🤗 link</a></td>
182
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-38B">🤖 link</a></td>
183
+ </tr>
184
+ <tr>
185
+ <td>InternVL2_5-78B</td>
186
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
187
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-72B-Instruct">Qwen2.5-72B-Instruct</a></td>
188
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-78B">🤗 link</a></td>
189
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-78B">🤖 link</a></td>
190
+ </tr>
191
+ </table>
192
+
193
+ <table>
194
+ <tr>
195
+ <th>Model Name</th>
196
+ <th>Vision Part</th>
197
+ <th>Language Part</th>
198
+ <th>HF&nbsp;Link</th>
199
+ <th>MS&nbsp;Link</th>
200
+ </tr>
201
+ <tr>
202
+ <td>InternVL2_5-1B-MPO</td>
203
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT&#8209;300M&#8209;448px&#8209;V2_5</a></td>
204
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct">Qwen2.5&#8209;0.5B&#8209;Instruct</a></td>
205
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-1B-MPO">🤗 link</a></td>
206
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-1B-MPO">🤖 link</a></td>
207
+ </tr>
208
+ <tr>
209
+ <td>InternVL2_5-2B-MPO</td>
210
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
211
+ <td><a href="https://huggingface.co/internlm/internlm2_5-1_8b-chat">internlm2_5-1_8b-chat</a></td>
212
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-2B-MPO">🤗 link</a></td>
213
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-2B-MPO">🤖 link</a></td>
214
+ </tr>
215
+ <tr>
216
+ <td>InternVL2_5-4B-MPO</td>
217
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
218
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-3B-Instruct">Qwen2.5-3B-Instruct</a></td>
219
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-4B-MPO">🤗 link</a></td>
220
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-4B-MPO">🤖 link</a></td>
221
+ </tr>
222
+ <tr>
223
+ <td>InternVL2_5-8B-MPO</td>
224
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">InternViT-300M-448px-V2_5</a></td>
225
+ <td><a href="https://huggingface.co/internlm/internlm2_5-7b-chat">internlm2_5-7b-chat</a></td>
226
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-8B-MPO">🤗 link</a></td>
227
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-8B-MPO">🤖 link</a></td>
228
+ </tr>
229
+ <tr>
230
+ <td>InternVL2_5-26B-MPO</td>
231
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
232
+ <td><a href="https://huggingface.co/internlm/internlm2_5-20b-chat">internlm2_5-20b-chat</a></td>
233
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-26B-MPO">🤗 link</a></td>
234
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-26B-MPO">🤖 link</a></td>
235
+ </tr>
236
+ <tr>
237
+ <td>InternVL2_5-38B-MPO</td>
238
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
239
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-32B-Instruct">Qwen2.5-32B-Instruct</a></td>
240
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-38B-MPO">🤗 link</a></td>
241
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-38B-MPO">🤖 link</a></td>
242
+ </tr>
243
+ <tr>
244
+ <td>InternVL2_5-78B-MPO</td>
245
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">InternViT-6B-448px-V2_5</a></td>
246
+ <td><a href="https://huggingface.co/Qwen/Qwen2.5-72B-Instruct">Qwen2.5-72B-Instruct</a></td>
247
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2_5-78B-MPO">🤗 link</a></td>
248
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2_5-78B-MPO">🤖 link</a></td>
249
+ </tr>
250
+ </table>
251
+
252
+ #### 多模态大语言模型 (InternVL 2.0)
253
+
254
+ <table>
255
+ <tr>
256
+ <th>Model Name</th>
257
+ <th>Vision Part</th>
258
+ <th>Language Part</th>
259
+ <th>HF&nbsp;Link</th>
260
+ <th>MS&nbsp;Link</th>
261
+ </tr>
262
+ <tr>
263
+ <td>InternVL2-1B</td>
264
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">InternViT-300M-448px</a></td>
265
+ <td><a href="https://huggingface.co/Qwen/Qwen2-0.5B-Instruct">Qwen2-0.5B-Instruct</a></td>
266
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-1B">🤗 link</a></td>
267
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-1B">🤖 link</a></td>
268
+ </tr>
269
+ <tr>
270
+ <td>InternVL2-2B</td>
271
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">InternViT-300M-448px</a></td>
272
+ <td><a href="https://huggingface.co/internlm/internlm2-chat-1_8b">internlm2-chat-1-8b</a></td>
273
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-2B">🤗 link</a></td>
274
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-2B">🤖 link</a></td>
275
+ </tr>
276
+ <tr>
277
+ <td>InternVL2-4B</td>
278
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">InternViT-300M-448px</a></td>
279
+ <td><a href="https://huggingface.co/microsoft/Phi-3-mini-128k-instruct">Phi&#8209;3&#8209;mini&#8209;128k&#8209;instruct</a></td>
280
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-4B">🤗 link</a></td>
281
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-4B">🤖 link</a></td>
282
+ </tr>
283
+ <tr>
284
+ <td>InternVL2-8B</td>
285
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">InternViT-300M-448px</a></td>
286
+ <td><a href="https://huggingface.co/internlm/internlm2_5-7b-chat">internlm2_5-7b-chat</a></td>
287
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-8B">🤗 link</a></td>
288
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-8B">🤖 link</a></td>
289
+ </tr>
290
+ <tr>
291
+ <td>InternVL2-26B</td>
292
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-5">InternViT-6B-448px-V1-5</a></td>
293
+ <td><a href="https://huggingface.co/internlm/internlm2-chat-20b">internlm2-chat-20b</a></td>
294
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-26B">🤗 link</a></td>
295
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-26B">🤖 link</a></td>
296
+ </tr>
297
+ <tr>
298
+ <td>InternVL2-40B</td>
299
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-5">InternViT&#8209;6B&#8209;448px&#8209;V1&#8209;5</a></td>
300
+ <td><a href="https://huggingface.co/NousResearch/Nous-Hermes-2-Yi-34B">Nous&#8209;Hermes&#8209;2&#8209;Yi&#8209;34B</a></td>
301
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-40B">🤗 link</a></td>
302
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-40B">🤖 link</a></td>
303
+ </tr>
304
+ <tr>
305
+ <td>InternVL2&#8209;Llama3-76B</td>
306
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-5">InternViT-6B-448px-V1-5</a></td>
307
+ <td><a href="https://huggingface.co/NousResearch/Hermes-2-Theta-Llama-3-70B">Hermes‑2‑Theta‑<br>Llama‑3‑70B</a></td>
308
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL2-Llama3-76B">🤗 link</a></td>
309
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL2-Llama3-76B">🤖 link</a></td>
310
+ </tr>
311
+ </table>
312
+
313
+ #### 多模态大语言模型 (InternVL 1.0-1.5)
314
+
315
+ <table>
316
+ <tr>
317
+ <th>Model</th>
318
+ <th>Date</th>
319
+ <th>HF&nbsp;Link</th>
320
+ <th>MS&nbsp;Link</th>
321
+ <th>Note</th>
322
+ </tr>
323
+ <tr>
324
+ <td>Mini&#8209;InternVL&#8209;Chat&#8209;4B&#8209;V1&#8209;5</td>
325
+ <td>2024.05.28</td>
326
+ <td><a href="https://huggingface.co/OpenGVLab/Mini-InternVL-Chat-4B-V1-5">🤗 link</a></td>
327
+ <td><a href="https://modelscope.cn/models/OpenGVLab/Mini-InternVL-Chat-4B-V1-5">🤖 link</a></td>
328
+ <td>🚀🚀 16% 的模型大小, 90% 的性能</td>
329
+ </tr>
330
+ <tr>
331
+ <td>Mini-InternVL-Chat-2B-V1-5</td>
332
+ <td>2024.05.19</td>
333
+ <td><a href="https://huggingface.co/OpenGVLab/Mini-InternVL-Chat-2B-V1-5">🤗 link</a></td>
334
+ <td><a href="https://modelscope.cn/models/OpenGVLab/Mini-InternVL-Chat-2B-V1-5">🤖 link</a></td>
335
+ <td>🚀 8% 的模型大小, 80% 的性能</td>
336
+ </tr>
337
+ <tr>
338
+ <td>InternVL-Chat-V1-5</td>
339
+ <td>2024.04.18</td>
340
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-V1-5">🤗 link</a></td>
341
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-V1-5">🤖 link</a></td>
342
+ <td>支持 4K 图像;超强的 OCR 能力;在 MMMU、DocVQA、ChartQA、MathVista 等各种基准测试中,性能接近 GPT-4V 和 Gemini Pro
343
+ </tr>
344
+ <tr>
345
+ <td>InternVL-Chat-V1-2-Plus</td>
346
+ <td>2024.02.21</td>
347
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-V1-2-Plus">🤗 link</a></td>
348
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-V1-2-Plus">🤖 link</a></td>
349
+ <td>更多的 SFT 数据和更强的性能</td>
350
+ </tr>
351
+ <tr>
352
+ <td>InternVL-Chat-V1-2</td>
353
+ <td>2024.02.11</td>
354
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-V1-2">🤗 link</a></td>
355
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-V1-2">🤖 link</a></td>
356
+ <td>将 LLM 扩展到 34B</td>
357
+ </tr>
358
+ <tr>
359
+ <td>InternVL-Chat-V1-1</td>
360
+ <td>2024.01.24</td>
361
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-V1-1">🤗 link</a></td>
362
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-V1-1">🤖 link</a></td>
363
+ <td>支持中文和更强的 OCR 能力</td>
364
+ </tr>
365
+ <tr>
366
+ <td>InternVL-Chat-19B</td>
367
+ <td>2023.12.25</td>
368
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-ViT-6B-Vicuna-13B">🤗 link</a></td>
369
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-ViT-6B-Vicuna-13B">🤖 link</a></td>
370
+ <td>英语多模态对话</td>
371
+ </tr>
372
+ <tr>
373
+ <td>InternVL-Chat-13B</td>
374
+ <td>2023.12.25</td>
375
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-Chat-ViT-6B-Vicuna-7B">🤗 link</a></td>
376
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-Chat-ViT-6B-Vicuna-7B">🤖 link</a></td>
377
+ <td>英语多模态对话</td>
378
+ </tr>
379
+ </table>
380
+
381
+ #### 类 CLIP 模型 (InternVL 1.0-2.5)
382
+
383
+ <table>
384
+ <tr>
385
+ <th>Model</th>
386
+ <th>Date</th>
387
+ <th>HF&nbsp;Link</th>
388
+ <th>MS&nbsp;Link</th>
389
+ <th>Note</th>
390
+ </tr>
391
+ <tr>
392
+ <td>InternViT-300M-448px-V2_5</td>
393
+ <td>2024.12.05</td>
394
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px-V2_5">🤗 link</a></td>
395
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-300M-448px-V2_5">🤖 link</a></td>
396
+ <td>🚀🚀 一个更强的轻量视觉编码器 (🔥新)</td>
397
+ </tr>
398
+ <tr>
399
+ <td>InternViT-6B-448px-V2_5</td>
400
+ <td>2024.12.05</td>
401
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V2_5">🤗 link</a></td>
402
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-448px-V2_5">🤖 link</a></td>
403
+ <td>🚀🚀 拥有更强的视觉特征提取能力 (🔥新)</td>
404
+ </tr>
405
+ <tr>
406
+ <td>InternViT-300M-448px</td>
407
+ <td>2024.05.25</td>
408
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-300M-448px">🤗 link</a></td>
409
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-300M-448px">🤖 link</a></td>
410
+ <td>蒸馏的小型视觉基础模型,具有 300M 参数</td>
411
+ </tr>
412
+ <tr>
413
+ <td>InternViT&#8209;6B&#8209;448px&#8209;V1&#8209;5</td>
414
+ <td>2024.04.20</td>
415
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-5">🤗 link</a></td>
416
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-448px-V1-5">🤖 link</a></td>
417
+ <td>通过增量预训练支持动态分辨率和超强的 OCR 特征提取能力</td>
418
+ </tr>
419
+ <tr>
420
+ <td>InternViT-6B-448px-V1-2</td>
421
+ <td>2024.02.11</td>
422
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-2">🤗 link</a></td>
423
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-448px-V1-2">🤖 link</a></td>
424
+ <td>通过增量预训练支持 448 分辨率</td>
425
+ </tr>
426
+ <tr>
427
+ <td>InternViT-6B-448px-V1-0</td>
428
+ <td>2024.01.30</td>
429
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-448px-V1-0">🤗 link</a></td>
430
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-448px-V1-0">🤖 link</a></td>
431
+ <td>通过增量预训练支持 448 分辨率</td>
432
+ </tr>
433
+ <tr>
434
+ <td>InternViT-6B-224px</td>
435
+ <td>2023.12.22</td>
436
+ <td><a href="https://huggingface.co/OpenGVLab/InternViT-6B-224px">🤗 link</a></td>
437
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternViT-6B-224px">🤖 link</a></td>
438
+ <td>InternViT-6B 的第一个版本,提取自 InternVL‑14B‑224px</td>
439
+ </tr>
440
+ </table>
441
+
442
+ #### 视觉语言基础模型 (InternVL 1.0)
443
+
444
+ <table>
445
+ <tr>
446
+ <th>Model</th>
447
+ <th>Date</th>
448
+ <th>HF&nbsp;Link</th>
449
+ <th>MS&nbsp;Link</th>
450
+ <th>Note</th>
451
+ </tr>
452
+ <tr>
453
+ <td>InternVL&#8209;14B&#8209;224px</td>
454
+ <td>2023.12.22</td>
455
+ <td><a href="https://huggingface.co/OpenGVLab/InternVL-14B-224px">🤗 link</a></td>
456
+ <td><a href="https://modelscope.cn/models/OpenGVLab/InternVL-14B-224px">🤖 link</a></td>
457
+ <td>视觉-语言基础模型,InternViT-6B + QLLaMA,可以用于类似 CLIP 的图文检索</td>
458
+ </tr>
459
+ </table>
460
+
461
+ ## TODO 列表
462
+
463
+ - [x] 发布 InternVL2.5 系列的训练 / 评估代码
464
+ - [x] 支持 liger kernels 以节省显存
465
+ - [x] 发布 MPO 的代码、模型和数据
466
+ - [x] 支持多模态 packed dataset
467
+ - [ ] 支持 vLLM 和 Ollama
468
+ - [ ] 在 Demo 中支持视频和 PDF 输入
469
+ - [ ] 发布集成 VisionLLMv2 的 InternVL2
470
+ - [x] 使用 readthedocs 重新构建文档
471
+ - [x] 支持使用 LoRA 微调不同的 LLMs
472
+ - [x] 发布 InternVL2 的 `requirements.txt`
473
+ - [x] 发布 InternVL2 系列的训练 / 评估代码
474
+ - [x] 发布 InternVL1.5 和 InternVL2 的 Streamlit 网页 UI
475
+
476
+ ## InternVL 可以做什么?
477
+
478
+ <details>
479
+ <summary>视觉感知 (点击展开)</summary>
480
+
481
+ - 线性探针图像分类 [\[查看详情\]](./classification#-evaluation)
482
+
483
+ ViT-22B uses the private JFT-3B dataset.
484
+
485
+ | method | #param | IN-1K | IN-ReaL | IN-V2 | IN-A | IN-R | IN-Sketch |
486
+ | ------------------- | :----: | :---: | :-----: | :---: | :---: | :---: | :-------: |
487
+ | OpenCLIP-G | 1.8B | 86.2 | 89.4 | 77.2 | 63.8 | 87.8 | 66.4 |
488
+ | DINOv2-g | 1.1B | 86.5 | 89.6 | 78.4 | 75.9 | 78.8 | 62.5 |
489
+ | EVA-01-CLIP-g | 1.1B | 86.5 | 89.3 | 77.4 | 70.5 | 87.7 | 63.1 |
490
+ | MAWS-ViT-6.5B | 6.5B | 87.8 | - | - | - | - | - |
491
+ | ViT-22B\* | 21.7B | 89.5 | 90.9 | 83.2 | 83.8 | 87.4 | - |
492
+ | InternViT-6B (ours) | 5.9B | 88.2 | 90.4 | 79.9 | 77.5 | 89.8 | 69.1 |
493
+
494
+ - 语义分割 [\[查看详情\]](./segmentation#-evaluation)
495
+
496
+ | method | decoder | #param (train/total) | crop size | mIoU |
497
+ | --------------------- | :-----: | :------------------: | :-------: | ------------ |
498
+ | OpenCLIP-G (frozen) | Linear | 0.3M / 1.8B | 512 | 39.3 |
499
+ | ViT-22B (frozen) | Linear | 0.9M / 21.7B | 504 | 34.6 |
500
+ | InternViT-6B (frozen) | Linear | 0.5M / 5.9B | 504 | 47.2 (+12.6) |
501
+ | ViT-22B (frozen) | UperNet | 0.8B / 22.5B | 504 | 52.7 |
502
+ | InternViT-6B (frozen) | UperNet | 0.4B / 6.3B | 504 | 54.9 (+2.2) |
503
+ | ViT-22B | UperNet | 22.5B / 22.5B | 504 | 55.3 |
504
+ | InternViT-6B | UperNet | 6.3B / 6.3B | 504 | 58.9 (+3.6) |
505
+
506
+ - 零样本图像分类 [\[查看详情\]](./clip_benchmark#imagenet-variants-and-objectnet)
507
+
508
+ | method | IN-1K | IN-A | IN-R | IN-V2 | IN-Sketch | ObjectNet |
509
+ | ----------------- | :---: | :---: | :---: | :---: | :-------: | :-------: |
510
+ | OpenCLIP-G | 80.1 | 69.3 | 92.1 | 73.6 | 68.9 | 73.0 |
511
+ | EVA-02-CLIP-E+ | 82.0 | 82.1 | 94.5 | 75.7 | 71.6 | 79.6 |
512
+ | ViT-22B\* | 85.9 | 90.1 | 96.0 | 80.9 | - | 87.6 |
513
+ | InternVL-C (ours) | 83.2 | 83.8 | 95.5 | 77.3 | 73.9 | 80.6 |
514
+
515
+ - 多语言零样本图像分类 [\[查看详情\]](./clip_benchmark#multilingual-imagenet-1k)
516
+
517
+ EN: English, ZH: Chinese, JP: Japanese, Ar: Arabic, IT: Italian
518
+
519
+ | method | IN-1K (EN) | IN-1K (ZH) | IN-1K (JP) | IN-1K (AR) | IN-1K (IT) |
520
+ | ----------------- | :--------: | :--------: | :--------: | :--------: | :--------: |
521
+ | Taiyi-CLIP-ViT-H | - | 54.4 | - | - | - |
522
+ | WuKong-ViT-L-G | - | 57.5 | - | - | - |
523
+ | CN-CLIP-ViT-H | - | 59.6 | - | - | - |
524
+ | AltCLIP-ViT-L | 74.5 | 59.6 | - | - | - |
525
+ | EVA-02-CLIP-E+ | 82.0 | - | - | - | 41.2 |
526
+ | OpenCLIP-XLM-R-H | 77.0 | 55.7 | 53.1 | 37.0 | 56.8 |
527
+ | InternVL-C (ours) | 83.2 | 64.5 | 61.5 | 44.9 | 65.7 |
528
+
529
+ - 零样本视频分类
530
+
531
+ | method | #frame | K400 | K600 | K700 |
532
+ | ----------------- | :----: | :---: | :---: | :---: |
533
+ | OpenCLIP-G | 1 | 65.9 | 66.1 | 59.2 |
534
+ | EVA-02-CLIP-E+ | 1 | 69.8 | 69.3 | 63.4 |
535
+ | InternVL-C (ours) | 1 | 71.0 | 71.3 | 65.7 |
536
+ | ViCLIP | 8 | 75.7 | 73.5 | 66.4 |
537
+ | InternVL-C (ours) | 8 | 79.4 | 78.8 | 71.5 |
538
+
539
+ </details>
540
+
541
+ <details>
542
+ <summary>跨模态检索 (点击展开)</summary>
543
+
544
+ - 英语零样本图文检索 [\[查看详情\]](./clip_benchmark#flickr30k--coco)
545
+
546
+ <table>
547
+ <tr align=center>
548
+ <td rowspan="3" align=left><b>model</b></td>
549
+ <td colspan="6" align=center><b>Flickr30K</b></td>
550
+ <td colspan="6" align=center><b>COCO</b></td>
551
+ <td rowspan="3" align=center><b>avg</b></td>
552
+ </tr>
553
+ <tr align=center>
554
+ <td colspan="3" align=center><b>image-to-text</b></td>
555
+ <td colspan="3" align=center><b>text-to-image</b></td>
556
+ <td colspan="3" align=center><b>image-to-text</b></td>
557
+ <td colspan="3" align=center><b>text-to-image</b></td>
558
+ </tr>
559
+ <tr>
560
+ <td>R@1</td>
561
+ <td>R@5</td>
562
+ <td>R@10</td>
563
+ <td>R@1</td>
564
+ <td>R@5</td>
565
+ <td>R@10</td>
566
+ <td>R@1</td>
567
+ <td>R@5</td>
568
+ <td>R@10</td>
569
+ <td>R@1</td>
570
+ <td>R@5</td>
571
+ <td>R@10</td>
572
+ </tr>
573
+ <tr align=center>
574
+ <td align=left>OpenCLIP-G</td>
575
+ <td>92.9</td>
576
+ <td>99.3</td>
577
+ <td>99.8</td>
578
+ <td>79.5</td>
579
+ <td>95.0</td>
580
+ <td>97.1</td>
581
+ <td>67.3</td>
582
+ <td>86.9</td>
583
+ <td>92.6</td>
584
+ <td>51.4</td>
585
+ <td>74.9</td>
586
+ <td>83.0</td>
587
+ <td>85.0</td>
588
+ </tr>
589
+ <tr align=center>
590
+ <td align=left>EVA-02-CLIP-E+</td>
591
+ <td>93.9</td>
592
+ <td>99.4</td>
593
+ <td>99.8</td>
594
+ <td>78.8</td>
595
+ <td>94.2</td>
596
+ <td>96.8</td>
597
+ <td>68.8</td>
598
+ <td>87.8</td>
599
+ <td>92.8</td>
600
+ <td>51.1</td>
601
+ <td>75.0</td>
602
+ <td>82.7</td>
603
+ <td>85.1</td>
604
+ </tr>
605
+ <tr align=center>
606
+ <td align=left>EVA-CLIP-8B</td>
607
+ <td>95.6</td>
608
+ <td>99.6</td>
609
+ <td>99.9</td>
610
+ <td>80.8</td>
611
+ <td>95.5</td>
612
+ <td>97.6</td>
613
+ <td>70.3</td>
614
+ <td>89.3</td>
615
+ <td>93.9</td>
616
+ <td>53.0</td>
617
+ <td>76.0</td>
618
+ <td>83.4</td>
619
+ <td>86.2</td>
620
+ </tr>
621
+ <tr align=center>
622
+ <td align=left>InternVL-C (ours)</td>
623
+ <td>94.7</td>
624
+ <td>99.6</td>
625
+ <td>99.9</td>
626
+ <td>81.7</td>
627
+ <td>96.0</td>
628
+ <td>98.2</td>
629
+ <td>70.6</td>
630
+ <td>89.0</td>
631
+ <td>93.5</td>
632
+ <td>54.1</td>
633
+ <td>77.3</td>
634
+ <td>84.6</td>
635
+ <td>86.6</td>
636
+ </tr>
637
+ <tr align=center>
638
+ <td align=left>InternVL-G (ours)</td>
639
+ <td>95.7</td>
640
+ <td>99.7</td>
641
+ <td>99.9</td>
642
+ <td>85.0</td>
643
+ <td>97.0</td>
644
+ <td>98.6</td>
645
+ <td>74.9</td>
646
+ <td>91.3</td>
647
+ <td>95.2</td>
648
+ <td>58.6</td>
649
+ <td>81.3</td>
650
+ <td>88.0</td>
651
+ <td>88.8</td>
652
+ </tr>
653
+
654
+ </table>
655
+
656
+ - 中文零样本图文检索 [\[查看详情\]](./clip_benchmark#flickr30k-cn--coco-cn)
657
+
658
+ <table>
659
+ <tr align=center>
660
+ <td rowspan="3" align=left><b>model</b></td>
661
+ <td colspan="6" align=center><b>Flickr30K-CN</b></td>
662
+ <td colspan="6" align=center><b>COCO-CN</b></td>
663
+ <td rowspan="3" align=center><b>avg</b></td>
664
+
665
+ </tr>
666
+ <tr align=center>
667
+ <td colspan="3" align=center><b>image-to-text</b></td>
668
+ <td colspan="3" align=center><b>text-to-image</b></td>
669
+ <td colspan="3" align=center><b>image-to-text</b></td>
670
+ <td colspan="3" align=center><b>text-to-image</b></td>
671
+ </tr>
672
+ <tr>
673
+ <td>R@1</td>
674
+ <td>R@5</td>
675
+ <td>R@10</td>
676
+ <td>R@1</td>
677
+ <td>R@5</td>
678
+ <td>R@10</td>
679
+ <td>R@1</td>
680
+ <td>R@5</td>
681
+ <td>R@10</td>
682
+ <td>R@1</td>
683
+ <td>R@5</td>
684
+ <td>R@10</td>
685
+ </tr>
686
+
687
+ <tr align=center>
688
+ <td align=left>CN-CLIP-ViT-H</td>
689
+ <td>81.6</td>
690
+ <td>97.5</td>
691
+ <td>98.8</td>
692
+ <td>71.2</td>
693
+ <td>91.4</td>
694
+ <td>95.5</td>
695
+ <td>63.0</td>
696
+ <td>86.6</td>
697
+ <td>92.9</td>
698
+ <td>69.2</td>
699
+ <td>89.9</td>
700
+ <td>96.1</td>
701
+ <td>86.1</td>
702
+ </tr>
703
+
704
+ <tr align=center>
705
+ <td align=left>OpenCLIP-XLM-R-H</td>
706
+ <td>86.1</td>
707
+ <td>97.5</td>
708
+ <td>99.2</td>
709
+ <td>71.0</td>
710
+ <td>90.5</td>
711
+ <td>94.9</td>
712
+ <td>70.0</td>
713
+ <td>91.5</td>
714
+ <td>97.0</td>
715
+ <td>66.1</td>
716
+ <td>90.8</td>
717
+ <td>96.0</td>
718
+ <td>87.6</td>
719
+ </tr>
720
+
721
+ <tr align=center>
722
+ <td align=left>InternVL-C (ours)</td>
723
+ <td>90.3</td>
724
+ <td>98.8</td>
725
+ <td>99.7</td>
726
+ <td>75.1</td>
727
+ <td>92.9</td>
728
+ <td>96.4</td>
729
+ <td>68.8</td>
730
+ <td>92.0</td>
731
+ <td>96.7</td>
732
+ <td>68.9</td>
733
+ <td>91.9</td>
734
+ <td>96.5</td>
735
+ <td>89.0</td>
736
+ </tr>
737
+ <tr align=center>
738
+ <td align=left>InternVL-G (ours)</td>
739
+ <td>92.9</td>
740
+ <td>99.4</td>
741
+ <td>99.8</td>
742
+ <td>77.7</td>
743
+ <td>94.8</td>
744
+ <td>97.3</td>
745
+ <td>71.4</td>
746
+ <td>93.9</td>
747
+ <td>97.7</td>
748
+ <td>73.8</td>
749
+ <td>94.4</td>
750
+ <td>98.1</td>
751
+ <td>90.9</td>
752
+ </tr>
753
+
754
+ </table>
755
+
756
+ - 多语言零样本图文对检索 [\[查看详情\]](./clip_benchmark#xtd)
757
+
758
+ | method | EN | ES | FR | ZH | IT | KO | RU | JP | average |
759
+ | ----------------- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :-----: |
760
+ | AltCLIP | 95.4 | 94.1 | 92.9 | 95.1 | 94.2 | 94.4 | 91.8 | 91.7 | 93.7 |
761
+ | OpenCLIP-XLM-R-H | 97.3 | 96.1 | 94.5 | 94.7 | 96.0 | 90.2 | 93.9 | 94.0 | 94.6 |
762
+ | InternVL-C (ours) | 97.3 | 95.7 | 95.1 | 95.6 | 96.0 | 92.2 | 93.3 | 95.5 | 95.1 |
763
+ | InternVL-G (ours) | 98.6 | 97.7 | 96.5 | 96.7 | 96.9 | 95.1 | 94.8 | 96.1 | 96.6 |
764
+
765
+ </details>
766
+
767
+ <details>
768
+ <summary>多模态对话</summary>
769
+
770
+ </details>
771
+
772
+ ## 使用 HuggingFace 快速开始
773
+
774
+ <details>
775
+ <summary>使用 InternViT-6B 提取视觉特征 (点击展开)</summary>
776
+
777
+ ```python
778
+ import torch
779
+ from PIL import Image
780
+ from transformers import AutoModel, CLIPImageProcessor
781
+
782
+ model = AutoModel.from_pretrained(
783
+ 'OpenGVLab/InternViT-6B-448px-V2_5',
784
+ torch_dtype=torch.bfloat16,
785
+ low_cpu_mem_usage=True,
786
+ trust_remote_code=True).cuda().eval()
787
+
788
+ image = Image.open('./examples/image1.jpg').convert('RGB')
789
+
790
+ image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternViT-6B-448px-V1-5')
791
+
792
+ pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
793
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
794
+
795
+ outputs = model(pixel_values)
796
+ ```
797
+
798
+ </details>
799
+
800
+ <details>
801
+ <summary>使用 InternVL-C(ontrastive) 和 InternVL-G(enerative) 进行跨模态检索 (点击展开)</summary>
802
+
803
+ ```python
804
+ import torch
805
+ from PIL import Image
806
+ from transformers import AutoModel, CLIPImageProcessor
807
+ from transformers import AutoTokenizer
808
+
809
+
810
+ model = AutoModel.from_pretrained(
811
+ 'OpenGVLab/InternVL-14B-224px',
812
+ torch_dtype=torch.bfloat16,
813
+ low_cpu_mem_usage=True,
814
+ trust_remote_code=True).cuda().eval()
815
+
816
+ image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternVL-14B-224px')
817
+
818
+ tokenizer = AutoTokenizer.from_pretrained(
819
+ 'OpenGVLab/InternVL-14B-224px', use_fast=False, add_eos_token=True)
820
+ tokenizer.pad_token_id = 0 # set pad_token_id to 0
821
+
822
+ images = [
823
+ Image.open('./examples/image1.jpg').convert('RGB'),
824
+ Image.open('./examples/image2.jpg').convert('RGB'),
825
+ Image.open('./examples/image3.jpg').convert('RGB')
826
+ ]
827
+ prefix = 'summarize:'
828
+ texts = [
829
+ prefix + 'a photo of a red panda', # English
830
+ prefix + '一张熊猫的照片', # Chinese
831
+ prefix + '二匹の猫の写真' # Japanese
832
+ ]
833
+
834
+ pixel_values = image_processor(images=images, return_tensors='pt').pixel_values
835
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
836
+ input_ids = tokenizer(texts, return_tensors='pt', max_length=80,
837
+ truncation=True, padding='max_length').input_ids.cuda()
838
+
839
+ # InternVL-C
840
+ logits_per_image, logits_per_text = model(
841
+ image=pixel_values, text=input_ids, mode='InternVL-C')
842
+ probs = logits_per_image.softmax(dim=-1)
843
+ # tensor([[9.9609e-01, 5.2185e-03, 6.0070e-08],
844
+ # [2.2949e-02, 9.7656e-01, 5.9903e-06],
845
+ # [3.2932e-06, 7.4863e-05, 1.0000e+00]], device='cuda:0',
846
+ # dtype=torch.bfloat16, grad_fn=<SoftmaxBackward0>)
847
+
848
+ # InternVL-G
849
+ logits_per_image, logits_per_text = model(
850
+ image=pixel_values, text=input_ids, mode='InternVL-G')
851
+ probs = logits_per_image.softmax(dim=-1)
852
+ # tensor([[9.9609e-01, 3.1738e-03, 3.6322e-08],
853
+ # [8.6060e-03, 9.9219e-01, 2.8759e-06],
854
+ # [1.7583e-06, 3.1233e-05, 1.0000e+00]], device='cuda:0',
855
+ # dtype=torch.bfloat16, grad_fn=<SoftmaxBackward0>)
856
+
857
+ # please set add_eos_token to False for generation
858
+ tokenizer.add_eos_token = False
859
+ image = Image.open('./examples/image1.jpg').convert('RGB')
860
+ pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
861
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
862
+
863
+ tokenized = tokenizer("English caption:", return_tensors='pt')
864
+ pred = model.generate(
865
+ pixel_values=pixel_values,
866
+ input_ids=tokenized.input_ids.cuda(),
867
+ attention_mask=tokenized.attention_mask.cuda(),
868
+ num_beams=5,
869
+ min_new_tokens=8,
870
+ )
871
+ caption = tokenizer.decode(pred[0].cpu(), skip_special_tokens=True).strip()
872
+ # English caption: a red panda sitting on top of a wooden platform
873
+ ```
874
+
875
+ </details>
876
+
877
+ <details>
878
+ <summary>使用 InternVL 2.5 进行多模态对话 (点击展开)</summary>
879
+
880
+ 这里我们以较小的 `OpenGVLab/InternVL2_5-8B` 为例:
881
+
882
+ ```python
883
+ import numpy as np
884
+ import torch
885
+ import torchvision.transforms as T
886
+ from decord import VideoReader, cpu
887
+ from PIL import Image
888
+ from torchvision.transforms.functional import InterpolationMode
889
+ from transformers import AutoModel, AutoTokenizer
890
+
891
+ IMAGENET_MEAN = (0.485, 0.456, 0.406)
892
+ IMAGENET_STD = (0.229, 0.224, 0.225)
893
+
894
+ def build_transform(input_size):
895
+ MEAN, STD = IMAGENET_MEAN, IMAGENET_STD
896
+ transform = T.Compose([
897
+ T.Lambda(lambda img: img.convert('RGB') if img.mode != 'RGB' else img),
898
+ T.Resize((input_size, input_size), interpolation=InterpolationMode.BICUBIC),
899
+ T.ToTensor(),
900
+ T.Normalize(mean=MEAN, std=STD)
901
+ ])
902
+ return transform
903
+
904
+ def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height, image_size):
905
+ best_ratio_diff = float('inf')
906
+ best_ratio = (1, 1)
907
+ area = width * height
908
+ for ratio in target_ratios:
909
+ target_aspect_ratio = ratio[0] / ratio[1]
910
+ ratio_diff = abs(aspect_ratio - target_aspect_ratio)
911
+ if ratio_diff < best_ratio_diff:
912
+ best_ratio_diff = ratio_diff
913
+ best_ratio = ratio
914
+ elif ratio_diff == best_ratio_diff:
915
+ if area > 0.5 * image_size * image_size * ratio[0] * ratio[1]:
916
+ best_ratio = ratio
917
+ return best_ratio
918
+
919
+ def dynamic_preprocess(image, min_num=1, max_num=12, image_size=448, use_thumbnail=False):
920
+ orig_width, orig_height = image.size
921
+ aspect_ratio = orig_width / orig_height
922
+
923
+ # calculate the existing image aspect ratio
924
+ target_ratios = set(
925
+ (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
926
+ i * j <= max_num and i * j >= min_num)
927
+ target_ratios = sorted(target_ratios, key=lambda x: x[0] * x[1])
928
+
929
+ # find the closest aspect ratio to the target
930
+ target_aspect_ratio = find_closest_aspect_ratio(
931
+ aspect_ratio, target_ratios, orig_width, orig_height, image_size)
932
+
933
+ # calculate the target width and height
934
+ target_width = image_size * target_aspect_ratio[0]
935
+ target_height = image_size * target_aspect_ratio[1]
936
+ blocks = target_aspect_ratio[0] * target_aspect_ratio[1]
937
+
938
+ # resize the image
939
+ resized_img = image.resize((target_width, target_height))
940
+ processed_images = []
941
+ for i in range(blocks):
942
+ box = (
943
+ (i % (target_width // image_size)) * image_size,
944
+ (i // (target_width // image_size)) * image_size,
945
+ ((i % (target_width // image_size)) + 1) * image_size,
946
+ ((i // (target_width // image_size)) + 1) * image_size
947
+ )
948
+ # split the image
949
+ split_img = resized_img.crop(box)
950
+ processed_images.append(split_img)
951
+ assert len(processed_images) == blocks
952
+ if use_thumbnail and len(processed_images) != 1:
953
+ thumbnail_img = image.resize((image_size, image_size))
954
+ processed_images.append(thumbnail_img)
955
+ return processed_images
956
+
957
+ def load_image(image_file, input_size=448, max_num=12):
958
+ image = Image.open(image_file).convert('RGB')
959
+ transform = build_transform(input_size=input_size)
960
+ images = dynamic_preprocess(image, image_size=input_size, use_thumbnail=True, max_num=max_num)
961
+ pixel_values = [transform(image) for image in images]
962
+ pixel_values = torch.stack(pixel_values)
963
+ return pixel_values
964
+
965
+ # If you have an 80G A100 GPU, you can put the entire model on a single GPU.
966
+ # Otherwise, you need to load a model using multiple GPUs, please refer to the `Multiple GPUs` section.
967
+ path = 'OpenGVLab/InternVL2_5-8B'
968
+ model = AutoModel.from_pretrained(
969
+ path,
970
+ torch_dtype=torch.bfloat16,
971
+ low_cpu_mem_usage=True,
972
+ trust_remote_code=True).eval().cuda()
973
+ tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True, use_fast=False)
974
+
975
+ # set the max number of tiles in `max_num`
976
+ pixel_values = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
977
+ generation_config = dict(max_new_tokens=1024, do_sample=False)
978
+
979
+ # pure-text conversation (纯文本对话)
980
+ question = 'Hello, who are you?'
981
+ response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
982
+ print(f'User: {question}\nAssistant: {response}')
983
+
984
+ question = 'Can you tell me a story?'
985
+ response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)
986
+ print(f'User: {question}\nAssistant: {response}')
987
+
988
+ # single-image single-round conversation (单图单轮对话)
989
+ question = '<image>\nPlease describe the image shortly.'
990
+ response = model.chat(tokenizer, pixel_values, question, generation_config)
991
+ print(f'User: {question}\nAssistant: {response}')
992
+
993
+ # single-image multi-round conversation (单图多轮对话)
994
+ question = '<image>\nPlease describe the image in detail.'
995
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
996
+ print(f'User: {question}\nAssistant: {response}')
997
+
998
+ question = 'Please write a poem according to the image.'
999
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)
1000
+ print(f'User: {question}\nAssistant: {response}')
1001
+
1002
+ # multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)
1003
+ pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
1004
+ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
1005
+ pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
1006
+
1007
+ question = '<image>\nDescribe the two images in detail.'
1008
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1009
+ history=None, return_history=True)
1010
+ print(f'User: {question}\nAssistant: {response}')
1011
+
1012
+ question = 'What are the similarities and differences between these two images.'
1013
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1014
+ history=history, return_history=True)
1015
+ print(f'User: {question}\nAssistant: {response}')
1016
+
1017
+ # multi-image multi-round conversation, separate images (多图多轮对话,独立图像)
1018
+ pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
1019
+ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
1020
+ pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
1021
+ num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
1022
+
1023
+ question = 'Image-1: <image>\nImage-2: <image>\nDescribe the two images in detail.'
1024
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1025
+ num_patches_list=num_patches_list,
1026
+ history=None, return_history=True)
1027
+ print(f'User: {question}\nAssistant: {response}')
1028
+
1029
+ question = 'What are the similarities and differences between these two images.'
1030
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1031
+ num_patches_list=num_patches_list,
1032
+ history=history, return_history=True)
1033
+ print(f'User: {question}\nAssistant: {response}')
1034
+
1035
+ # batch inference, single image per sample (单图批处理)
1036
+ pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
1037
+ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
1038
+ num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
1039
+ pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
1040
+
1041
+ questions = ['<image>\nDescribe the image in detail.'] * len(num_patches_list)
1042
+ responses = model.batch_chat(tokenizer, pixel_values,
1043
+ num_patches_list=num_patches_list,
1044
+ questions=questions,
1045
+ generation_config=generation_config)
1046
+ for question, response in zip(questions, responses):
1047
+ print(f'User: {question}\nAssistant: {response}')
1048
+
1049
+ # video multi-round conversation (视频多轮对话)
1050
+ def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):
1051
+ if bound:
1052
+ start, end = bound[0], bound[1]
1053
+ else:
1054
+ start, end = -100000, 100000
1055
+ start_idx = max(first_idx, round(start * fps))
1056
+ end_idx = min(round(end * fps), max_frame)
1057
+ seg_size = float(end_idx - start_idx) / num_segments
1058
+ frame_indices = np.array([
1059
+ int(start_idx + (seg_size / 2) + np.round(seg_size * idx))
1060
+ for idx in range(num_segments)
1061
+ ])
1062
+ return frame_indices
1063
+
1064
+ def load_video(video_path, bound=None, input_size=448, max_num=1, num_segments=32):
1065
+ vr = VideoReader(video_path, ctx=cpu(0), num_threads=1)
1066
+ max_frame = len(vr) - 1
1067
+ fps = float(vr.get_avg_fps())
1068
+
1069
+ pixel_values_list, num_patches_list = [], []
1070
+ transform = build_transform(input_size=input_size)
1071
+ frame_indices = get_index(bound, fps, max_frame, first_idx=0, num_segments=num_segments)
1072
+ for frame_index in frame_indices:
1073
+ img = Image.fromarray(vr[frame_index].asnumpy()).convert('RGB')
1074
+ img = dynamic_preprocess(img, image_size=input_size, use_thumbnail=True, max_num=max_num)
1075
+ pixel_values = [transform(tile) for tile in img]
1076
+ pixel_values = torch.stack(pixel_values)
1077
+ num_patches_list.append(pixel_values.shape[0])
1078
+ pixel_values_list.append(pixel_values)
1079
+ pixel_values = torch.cat(pixel_values_list)
1080
+ return pixel_values, num_patches_list
1081
+
1082
+ video_path = './examples/red-panda.mp4'
1083
+ pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)
1084
+ pixel_values = pixel_values.to(torch.bfloat16).cuda()
1085
+ video_prefix = ''.join([f'Frame-{i+1}: <image>\n' for i in range(len(num_patches_list))])
1086
+ question = video_prefix + 'What is the red panda doing?'
1087
+ # Frame1: <image>\nFrame2: <image>\n...\nFrame8: <image>\n{question}
1088
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1089
+ num_patches_list=num_patches_list, history=None, return_history=True)
1090
+ print(f'User: {question}\nAssistant: {response}')
1091
+
1092
+ question = 'Describe this video in detail.'
1093
+ response, history = model.chat(tokenizer, pixel_values, question, generation_config,
1094
+ num_patches_list=num_patches_list, history=history, return_history=True)
1095
+ print(f'User: {question}\nAssistant: {response}')
1096
+ ```
1097
+
1098
+ </details>
1099
+
1100
+ ## 许可证
1101
+
1102
+ 本项目以 [MIT 许可证](LICENSE) 发布。项目中的部分代码和模型来自其它来源,受其原始许可证的约束。
1103
+
1104
+ ## 引用
1105
+
1106
+ 如果您在研究中发现本项目有用,请考虑引用:
1107
+
1108
+ ```BibTeX
1109
+ @article{chen2024expanding,
1110
+ title={Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling},
1111
+ 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},
1112
+ journal={arXiv preprint arXiv:2412.05271},
1113
+ year={2024}
1114
+ }
1115
+ @article{wang2024mpo,
1116
+ title={Enhancing the Reasoning Ability of Multimodal Large Language Models via Mixed Preference Optimization},
1117
+ 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},
1118
+ journal={arXiv preprint arXiv:2411.10442},
1119
+ year={2024}
1120
+ }
1121
+ @article{gao2024mini,
1122
+ title={Mini-InternVL: a flexible-transfer pocket multi-modal model with 5\% parameters and 90\% performance},
1123
+ 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},
1124
+ journal={Visual Intelligence},
1125
+ volume={2},
1126
+ number={1},
1127
+ pages={1--17},
1128
+ year={2024},
1129
+ publisher={Springer}
1130
+ }
1131
+ @article{chen2024far,
1132
+ title={How far are we to gpt-4v? closing the gap to commercial multimodal models with open-source suites},
1133
+ 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},
1134
+ journal={Science China Information Sciences},
1135
+ volume={67},
1136
+ number={12},
1137
+ pages={220101},
1138
+ year={2024},
1139
+ publisher={Springer}
1140
+ }
1141
+ @inproceedings{chen2024internvl,
1142
+ title={Internvl: Scaling up vision foundation models and aligning for generic visual-linguistic tasks},
1143
+ 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},
1144
+ booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
1145
+ pages={24185--24198},
1146
+ year={2024}
1147
+ }
1148
+ ```
1149
+
1150
+ ## 致谢
1151
+
1152
+ InternVL 的代码构建参考了以下的项目: [OpenAI CLIP](https://github.com/openai/CLIP)、[Open CLIP](https://github.com/mlfoundations/open_clip)、[CLIP Benchmark](https://github.com/LAION-AI/CLIP_benchmark)、[EVA](https://github.com/baaivision/EVA/tree/master)、[InternImage](https://github.com/OpenGVLab/InternImage)、[ViT-Adapter](https://github.com/czczup/ViT-Adapter)、[MMSegmentation](https://github.com/open-mmlab/mmsegmentation)、[Transformers](https://github.com/huggingface/transformers)、[DINOv2](https://github.com/facebookresearch/dinov2)、[BLIP-2](https://github.com/salesforce/LAVIS/tree/main/projects/blip2)、[Qwen-VL](https://github.com/QwenLM/Qwen-VL/tree/master/eval_mm)和 [LLaVA-1.5](https://github.com/haotian-liu/LLaVA),感谢这些杰出的工作。
1153
+
1154
+ ______________________________________________________________________
1155
+
1156
+ 扫描下方二维码,加入我们的项目微信群。
1157
+
1158
+ <p align="center"><img width="300" alt="image" src="https://github.com/user-attachments/assets/f776df09-ebba-4fd5-80c2-fec4ff1518be"></p>
InternVL/classification/README.md ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # InternViT-6B for Image Classification
2
+
3
+ This folder contains the implementation of the InternViT-6B for image classification, which corresponds to Section 4.2.1 of our [InternVL 1.0 paper](https://arxiv.org/pdf/2312.14238).
4
+ The codebase for this part is derived from [InternImage](https://github.com/OpenGVLab/InternImage), with some code references to [EVA](https://github.com/baaivision/EVA/tree/master) and [DINOv2](https://github.com/facebookresearch/dinov2). Thanks for their great work.
5
+
6
+ In this part, we validate the visual perception capabilities of InternViT-6B, the most core component of InternVL 1.0.
7
+ We evaluate the quality of visual representation produced by InternViT-6B using the ImageNet-1K dataset. Following common practices, we adopt the linear probing evaluation, i.e. training a linear classifier while keeping the backbone frozen. In addition to the ImageNet-1K validation set,
8
+ we also report performance metrics on several ImageNet variants, to benchmark the domain generalization capability.
9
+
10
+ InternViT-6B follows the structure of vanilla ViT, and its hyperparameters are listed in the table below.
11
+
12
+ <img width="558" alt="image" src="https://github.com/OpenGVLab/InternVL/assets/23737120/e6bb0151-ab2f-4436-982f-6c68c5a69bc4">
13
+
14
+ ## 🛠️ Installation
15
+
16
+ Follow the [installation guide](../INSTALLATION.md) to perform installations.
17
+
18
+ ## 📦 Data Preparation
19
+
20
+ > Please prepare the dataset according to your needs.
21
+
22
+ - `ImageNet-1K`: We use the standard ImageNet dataset, you can download it from [http://image-net.org/](http://image-net.org/).
23
+
24
+ - `ImageNet-A`: Download it from [https://people.eecs.berkeley.edu/~hendrycks/imagenet-a.tar](https://people.eecs.berkeley.edu/~hendrycks/imagenet-a.tar).
25
+
26
+ - `ImageNet-R`: Download it from [https://people.eecs.berkeley.edu/~hendrycks/imagenet-r.tar](https://people.eecs.berkeley.edu/~hendrycks/imagenet-r.tar).
27
+
28
+ - `ImageNetV2`: Download it from [https://imagenetv2public.s3-us-west-2.amazonaws.com/imagenetv2-matched-frequency.tar.gz](https://imagenetv2public.s3-us-west-2.amazonaws.com/imagenetv2-matched-frequency.tar.gz).
29
+
30
+ - `ImageNet-Sketch`: Download it using `gdown`.
31
+
32
+ ```shell
33
+ # GDown is needed to download the dataset.
34
+ # Please install it via `pip install gdown`
35
+ gdown --id 1Mj0i5HBthqH1p_yeXzsg22gZduvgoNeA
36
+ ```
37
+
38
+ First, please prepare the `ImageNet-1K`, `ImageNet-A`, `ImageNet-R`, `ImageNetV2`, and `ImageNet-Sketch` datasets following the directory structure outlined below.
39
+
40
+ ```bash
41
+ $ tree data
42
+ data
43
+ ├── imagenet-1k
44
+ │ ├── train
45
+ │ ├── n01498041
46
+ │ └── ...
47
+ │ └── val
48
+ │ ├── ILSVRC2012_val_00000001.JPEG
49
+ │ └── ...
50
+ ├── imagenet-a
51
+ │ ├── n01498041
52
+ │ └── ...
53
+ ├── imagenet-r
54
+ │ ├── n01443537
55
+ │ └── ...
56
+ ├── imagenet-sketch
57
+ │ ├── n01440764
58
+ │ └── ...
59
+ └── imagenetv2
60
+ └── ImageNetV2-matched-frequency
61
+ ```
62
+
63
+ Then, unzip the `train.txt.zip` and `val.txt.zip` in `meta_data/`.
64
+
65
+ ```shell
66
+ cd meta_data/
67
+ unzip train.txt.zip
68
+ unzip val.txt.zip
69
+ ```
70
+
71
+ ## 📦 Model Preparation
72
+
73
+ | model name | type | download | size |
74
+ | ---------------------------- | ------- | ---------------------------------------------------------------------------------------------- | :-----: |
75
+ | intern_vit_6b_224px.pth | pytorch | 🤗 [HF link](https://huggingface.co/OpenGVLab/InternVL/blob/main/intern_vit_6b_224px.pth) | 12 GB |
76
+ | intern_vit_6b_224px_head.pth | pytorch | 🤗 [HF link](https://huggingface.co/OpenGVLab/InternVL/blob/main/intern_vit_6b_224px_head.pth) | 25.7 MB |
77
+
78
+ Please download the above model weights and place them in the `pretrained/` folder.
79
+
80
+ ```sh
81
+ cd pretrained
82
+ wget https://huggingface.co/OpenGVLab/InternVL/resolve/main/intern_vit_6b_224px.pth
83
+ wget https://huggingface.co/OpenGVLab/InternVL/resolve/main/intern_vit_6b_224px_head.pth
84
+ ```
85
+
86
+ The directory structure is:
87
+
88
+ ```sh
89
+ pretrained
90
+ ├── intern_vit_6b_224px_head.pth
91
+ └── intern_vit_6b_224px.pth
92
+ ```
93
+
94
+ ## 🔍 Linear Probing on ImageNet-1K
95
+
96
+ > **Warning**: Please install `apex` before training (see [installation guide](../INSTALLATION.md#additional-instructions) for details).
97
+
98
+ To train a linear classifier for `InternViT-6B` on ImageNet with 8 GPUs, run:
99
+
100
+ ```bash
101
+ python -m torch.distributed.launch --nproc_per_node 8 --master_port 12345 main.py --cfg configs/intern_vit_6b_1k_224.yaml
102
+ # or manage jobs with slurm
103
+ GPUS=8 sh train_in1k.sh <partition> <job-name> configs/intern_vit_6b_1k_224.yaml --launcher slurm
104
+ ```
105
+
106
+ Note, it is normal for the following information to appear during training and it can be safely ignored:
107
+
108
+ > \_IncompatibleKeys(missing_keys=\[\], unexpected_keys=\['clip_projector.norm1_q.weight', 'clip_projector.norm1_q.bias', 'clip_projector.norm1_k.weight', 'clip_projector.norm1_k.bias', 'clip_projector.norm1_v.weight', 'clip_projector.norm1_v.bias', 'clip_projector.cross_attn.q_bias', 'clip_projector.cross_attn.k_bias', 'clip_projector.cross_attn.v_bias', 'clip_projector.cross_attn.q.weight', 'clip_projector.cross_attn.k.weight', 'clip_projector.cross_attn.v.weight', 'clip_projector.cross_attn.proj.weight', 'clip_projector.cross_attn.proj.bias'\])
109
+
110
+ ## 📊 Evaluation
111
+
112
+ > **Warning**: Please install `apex` before evaluation (see [installation guide](../INSTALLATION.md#additional-instructions) for details).
113
+
114
+ | model name | IN-1K | IN-ReaL | IN-V2 | IN-A | IN-R | IN-Sketch | download |
115
+ | -------------------------------------------------------------- | :---: | :-----: | :---: | :--: | :--: | :-------: | :--------------------------------------------------------------------------------------------------------------------------------------------------: |
116
+ | [intern_vit_6b_1k_224.yaml](configs/intern_vit_6b_1k_224.yaml) | 88.2 | 90.4 | 79.9 | 77.5 | 89.8 | 69.1 | [ckpt](https://huggingface.co/OpenGVLab/InternVL/resolve/main/intern_vit_6b_224px_head.pth) \| [log](./work_dirs/intern_vit_6b_1k_224/log_rank0.txt) |
117
+
118
+ <details>
119
+ <summary>Evaluate InternViT-6B on <b>ImageNet-1K val</b> with 8 GPUs (click to expand).</summary>
120
+
121
+ ```bash
122
+ python -m torch.distributed.launch --nproc_per_node 8 --master_port 12345 main.py --eval \
123
+ --cfg configs/intern_vit_6b_1k_224.yaml --resume pretrained/intern_vit_6b_224px_head.pth
124
+ # or manage jobs with slurm
125
+ GPUS=8 sh train_in1k.sh <partition> <job-name> configs/intern_vit_6b_1k_224.yaml --eval \
126
+ --resume pretrained/intern_vit_6b_224px_head.pth --launcher slurm
127
+ ```
128
+
129
+ Expected results:
130
+
131
+ ```
132
+ * Acc@1 88.230 Acc@5 98.474
133
+ Accuracy of the network on the 50000 test images: 88.2%
134
+ ```
135
+
136
+ </details>
137
+
138
+ <details>
139
+ <summary>Evaluate InternViT-6B on <b>ImageNet-ReaL</b> with 1 GPU (click to expand).</summary>
140
+
141
+ **Note: ImageNet-ReaL now only supports single-GPU testing.**
142
+
143
+ ```bash
144
+ python -m torch.distributed.launch --nproc_per_node 1 --master_port 12345 main.py --eval \
145
+ --cfg configs/intern_vit_6b_1k_224_test_imagenet_real.yaml --resume pretrained/intern_vit_6b_224px_head.pth
146
+ # or manage jobs with slurm
147
+ GPUS=1 GPUS_PER_NODE=1 sh train_in1k.sh <partition> <job-name> configs/intern_vit_6b_1k_224_test_imagenet_real.yaml --eval \
148
+ --resume pretrained/intern_vit_6b_224px_head.pth --launcher slurm
149
+ ```
150
+
151
+ Expected results:
152
+
153
+ ```
154
+ * ReaL Acc@1 90.437 Acc@5 98.567 loss 0.605
155
+ ReaL Accuracy of the network on the 50000 test images: 90.4%
156
+ ```
157
+
158
+ </details>
159
+
160
+ <details>
161
+ <summary>Evaluate InternViT-6B on <b>ImageNetV2</b> with 8 GPUs (click to expand).</summary>
162
+
163
+ ```bash
164
+ python -m torch.distributed.launch --nproc_per_node 8 --master_port 12345 main.py --eval \
165
+ --cfg configs/intern_vit_6b_1k_224_test_imagenetv2.yaml --resume pretrained/intern_vit_6b_224px_head.pth
166
+ # or manage jobs with slurm
167
+ GPUS=8 sh train_in1k.sh <partition> <job-name> configs/intern_vit_6b_1k_224_test_imagenetv2.yaml --eval \
168
+ --resume pretrained/intern_vit_6b_224px_head.pth --launcher slurm
169
+ ```
170
+
171
+ Expected results:
172
+
173
+ ```
174
+ * Acc@1 79.940 Acc@5 95.340
175
+ Accuracy of the network on the 10000 test images: 79.9%
176
+ ```
177
+
178
+ </details>
179
+
180
+ <details>
181
+ <summary>Evaluate InternViT-6B on <b>ImageNet-A</b> with 8 GPUs (click to expand).</summary>
182
+
183
+ ```bash
184
+ python -m torch.distributed.launch --nproc_per_node 8 --master_port 12345 main.py --eval \
185
+ --cfg configs/intern_vit_6b_1k_224_test_imagenet_a.yaml --resume pretrained/intern_vit_6b_224px_head.pth
186
+ # or manage jobs with slurm
187
+ GPUS=8 sh train_in1k.sh <partition> <job-name> configs/intern_vit_6b_1k_224_test_imagenet_a.yaml --eval \
188
+ --resume pretrained/intern_vit_6b_224px_head.pth --launcher slurm
189
+ ```
190
+
191
+ Expected results:
192
+
193
+ ```
194
+ * Acc@1 77.479 Acc@5 92.737
195
+ Accuracy of the network on the 7500 test images: 77.5%
196
+ ```
197
+
198
+ </details>
199
+
200
+ <details>
201
+ <summary>Evaluate InternViT-6B on <b>ImageNet-R</b> with 8 GPUs (click to expand).</summary>
202
+
203
+ ```bash
204
+ python -m torch.distributed.launch --nproc_per_node 8 --master_port 12345 main.py --eval \
205
+ --cfg configs/intern_vit_6b_1k_224_test_imagenet_r.yaml --resume pretrained/intern_vit_6b_224px_head.pth
206
+ # or manage jobs with slurm
207
+ GPUS=8 sh train_in1k.sh <partition> <job-name> configs/intern_vit_6b_1k_224_test_imagenet_r.yaml --eval \
208
+ --resume pretrained/intern_vit_6b_224px_head.pth --launcher slurm
209
+ ```
210
+
211
+ Expected results:
212
+
213
+ ```
214
+ * Acc@1 89.777 Acc@5 97.023
215
+ Accuracy of the network on the 30000 test images: 89.8%
216
+ ```
217
+
218
+ </details>
219
+
220
+ <details>
221
+ <summary>Evaluate InternViT-6B on <b>ImageNet-Sketch</b> with 8 GPUs (click to expand).</summary>
222
+
223
+ ```bash
224
+ python -m torch.distributed.launch --nproc_per_node 8 --master_port 12345 main.py --eval \
225
+ --cfg configs/intern_vit_6b_1k_224_test_imagenet_sketch.yaml --resume pretrained/intern_vit_6b_224px_head.pth
226
+ # or manage jobs with slurm
227
+ GPUS=8 sh train_in1k.sh <partition> <job-name> configs/intern_vit_6b_1k_224_test_imagenet_sketch.yaml --eval \
228
+ --resume pretrained/intern_vit_6b_224px_head.pth --launcher slurm
229
+ ```
230
+
231
+ Expected results:
232
+
233
+ ```
234
+ * Acc@1 69.117 Acc@5 88.341
235
+ Accuracy of the network on the 50889 test images: 69.1%
236
+ ```
237
+
238
+ </details>
InternVL/classification/config.py ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --------------------------------------------------------
2
+ # InternVL
3
+ # Copyright (c) 2022 OpenGVLab
4
+ # Licensed under The MIT License [see LICENSE for details]
5
+ # --------------------------------------------------------
6
+
7
+ import os
8
+
9
+ import yaml
10
+ from yacs.config import CfgNode as CN
11
+
12
+ _C = CN()
13
+
14
+ # Base config files
15
+ _C.BASE = ['']
16
+
17
+ # -----------------------------------------------------------------------------
18
+ # Data settings
19
+ # -----------------------------------------------------------------------------
20
+ _C.DATA = CN()
21
+ # Batch size for a single GPU, could be overwritten by command line argument
22
+ _C.DATA.BATCH_SIZE = 128
23
+ # Path to dataset, could be overwritten by command line argument
24
+ _C.DATA.DATA_PATH = ''
25
+ # Dataset name
26
+ _C.DATA.DATASET = 'imagenet'
27
+ # Input image size
28
+ _C.DATA.IMG_SIZE = 224
29
+ # Interpolation to resize image (random, bilinear, bicubic)
30
+ _C.DATA.INTERPOLATION = 'bicubic'
31
+ # Use zipped dataset instead of folder dataset
32
+ # could be overwritten by command line argument
33
+ _C.DATA.ZIP_MODE = False
34
+ # Cache Data in Memory, could be overwritten by command line argument
35
+ _C.DATA.CACHE_MODE = 'part'
36
+ # Pin CPU memory in DataLoader for more efficient (sometimes) transfer to GPU.
37
+ _C.DATA.PIN_MEMORY = True
38
+ # Number of data loading threads
39
+ _C.DATA.NUM_WORKERS = 8
40
+ # Load data to memory
41
+ _C.DATA.IMG_ON_MEMORY = False
42
+ # Name of the build_transform function
43
+ _C.DATA.TRANSFORM = 'build_transform'
44
+
45
+ # -----------------------------------------------------------------------------
46
+ # Model settings
47
+ # -----------------------------------------------------------------------------
48
+ _C.MODEL = CN()
49
+ # Model type
50
+ _C.MODEL.TYPE = 'intern_vit_6b'
51
+ # Model name
52
+ _C.MODEL.NAME = 'intern_vit_6b'
53
+ # Pretrained weight from checkpoint, could be imagenet22k pretrained weight
54
+ # could be overwritten by command line argument
55
+ _C.MODEL.PRETRAINED = ''
56
+ # Checkpoint to resume, could be overwritten by command line argument
57
+ _C.MODEL.RESUME = ''
58
+ # Number of classes, overwritten in data preparation
59
+ _C.MODEL.NUM_CLASSES = 1000
60
+ # Dropout rate
61
+ _C.MODEL.DROP_RATE = 0.0
62
+ # Drop path rate
63
+ _C.MODEL.DROP_PATH_RATE = 0.1
64
+ # Drop path type
65
+ _C.MODEL.DROP_PATH_TYPE = 'linear' # linear, uniform
66
+ # Label Smoothing
67
+ _C.MODEL.LABEL_SMOOTHING = 0.1
68
+
69
+ # INTERN_VIT_6B parameters
70
+ _C.MODEL.INTERN_VIT_6B = CN()
71
+ _C.MODEL.INTERN_VIT_6B.PATCH_SIZE = 14
72
+ _C.MODEL.INTERN_VIT_6B.PRETRAIN_SIZE = 224
73
+ _C.MODEL.INTERN_VIT_6B.QKV_BIAS = False
74
+ _C.MODEL.INTERN_VIT_6B.EMBED_DIM = 3200
75
+ _C.MODEL.INTERN_VIT_6B.NUM_HEADS = 25
76
+ _C.MODEL.INTERN_VIT_6B.MLP_RATIO = 4
77
+ _C.MODEL.INTERN_VIT_6B.INIT_VALUES = 0.1
78
+ _C.MODEL.INTERN_VIT_6B.QK_NORMALIZATION = True
79
+ _C.MODEL.INTERN_VIT_6B.DEPTH = 48
80
+ _C.MODEL.INTERN_VIT_6B.USE_FLASH_ATTN = True
81
+ _C.MODEL.INTERN_VIT_6B.FREEZE_VIT = True
82
+ _C.MODEL.INTERN_VIT_6B.PRETRAINED = None
83
+ _C.MODEL.INTERN_VIT_6B.CLS_TARGET = 'cls_patch_concat'
84
+ _C.MODEL.INTERN_VIT_6B.NORM_TYPE = 'rms'
85
+
86
+ # CLIP_VIT parameters
87
+ _C.MODEL.CLIP_VIT = CN()
88
+ _C.MODEL.CLIP_VIT.PATCH_SIZE = 14
89
+ _C.MODEL.CLIP_VIT.PRETRAIN_SIZE = 336
90
+ _C.MODEL.CLIP_VIT.EMBED_DIM = 1024
91
+ _C.MODEL.CLIP_VIT.NUM_HEADS = 16
92
+ _C.MODEL.CLIP_VIT.MLP_RATIO = 4
93
+ _C.MODEL.CLIP_VIT.DEPTH = 24
94
+ _C.MODEL.CLIP_VIT.FREEZE_VIT = True
95
+ _C.MODEL.CLIP_VIT.PRETRAINED = 'openai/clip-vit-large-patch14-336'
96
+ _C.MODEL.CLIP_VIT.CLS_TARGET = 'cls_patch_concat'
97
+
98
+ # -----------------------------------------------------------------------------
99
+ # Training settings
100
+ # -----------------------------------------------------------------------------
101
+ _C.TRAIN = CN()
102
+ _C.TRAIN.START_EPOCH = 0
103
+ _C.TRAIN.EPOCHS = 300
104
+ _C.TRAIN.WARMUP_EPOCHS = 20
105
+ _C.TRAIN.WEIGHT_DECAY = 0.05
106
+ _C.TRAIN.BASE_LR = 5e-4
107
+ _C.TRAIN.WARMUP_LR = 5e-7
108
+ _C.TRAIN.MIN_LR = 5e-6
109
+ # Clip gradient norm
110
+ _C.TRAIN.CLIP_GRAD = 5.0
111
+ # Auto resume from latest checkpoint
112
+ _C.TRAIN.AUTO_RESUME = True
113
+ # Gradient accumulation steps
114
+ # could be overwritten by command line argument
115
+ _C.TRAIN.ACCUMULATION_STEPS = 0
116
+ # Whether to use gradient checkpointing to save memory
117
+ # could be overwritten by command line argument
118
+ _C.TRAIN.USE_CHECKPOINT = False
119
+
120
+ # LR scheduler
121
+ _C.TRAIN.LR_SCHEDULER = CN()
122
+ _C.TRAIN.LR_SCHEDULER.NAME = 'cosine'
123
+ # Epoch interval to decay LR, used in StepLRScheduler
124
+ _C.TRAIN.LR_SCHEDULER.DECAY_EPOCHS = 30
125
+ # LR decay rate, used in StepLRScheduler
126
+ _C.TRAIN.LR_SCHEDULER.DECAY_RATE = 0.1
127
+
128
+ # Optimizer
129
+ _C.TRAIN.OPTIMIZER = CN()
130
+ _C.TRAIN.OPTIMIZER.NAME = 'adamw'
131
+ # Optimizer Epsilon
132
+ _C.TRAIN.OPTIMIZER.EPS = 1e-8
133
+ # Optimizer Betas
134
+ _C.TRAIN.OPTIMIZER.BETAS = (0.9, 0.999)
135
+ # SGD momentum
136
+ _C.TRAIN.OPTIMIZER.MOMENTUM = 0.9
137
+ # ZeRO
138
+ _C.TRAIN.OPTIMIZER.USE_ZERO = False
139
+ # freeze backbone
140
+ _C.TRAIN.OPTIMIZER.FREEZE_BACKBONE = None
141
+ # dcn lr
142
+ _C.TRAIN.OPTIMIZER.DCN_LR_MUL = None
143
+
144
+ # EMA
145
+ _C.TRAIN.EMA = CN()
146
+ _C.TRAIN.EMA.ENABLE = False
147
+ _C.TRAIN.EMA.DECAY = 0.9998
148
+
149
+ # LR_LAYER_DECAY
150
+ _C.TRAIN.LR_LAYER_DECAY = False
151
+ _C.TRAIN.LR_LAYER_DECAY_RATIO = 0.875
152
+
153
+ # FT head init weights
154
+ _C.TRAIN.RAND_INIT_FT_HEAD = False
155
+
156
+ # -----------------------------------------------------------------------------
157
+ # Augmentation settings
158
+ # -----------------------------------------------------------------------------
159
+ _C.AUG = CN()
160
+ # Color jitter factor
161
+ _C.AUG.COLOR_JITTER = 0.4
162
+ # Use AutoAugment policy. "v0" or "original"
163
+ _C.AUG.AUTO_AUGMENT = 'rand-m9-mstd0.5-inc1'
164
+ # Random erase prob
165
+ _C.AUG.REPROB = 0.25
166
+ # Random erase mode
167
+ _C.AUG.REMODE = 'pixel'
168
+ # Random erase count
169
+ _C.AUG.RECOUNT = 1
170
+ # Mixup alpha, mixup enabled if > 0
171
+ _C.AUG.MIXUP = 0.8
172
+ # Cutmix alpha, cutmix enabled if > 0
173
+ _C.AUG.CUTMIX = 1.0
174
+ # Cutmix min/max ratio, overrides alpha and enables cutmix if set
175
+ _C.AUG.CUTMIX_MINMAX = None
176
+ # Probability of performing mixup or cutmix when either/both is enabled
177
+ _C.AUG.MIXUP_PROB = 1.0
178
+ # Probability of switching to cutmix when both mixup and cutmix enabled
179
+ _C.AUG.MIXUP_SWITCH_PROB = 0.5
180
+ # How to apply mixup/cutmix params. Per "batch", "pair", or "elem"
181
+ _C.AUG.MIXUP_MODE = 'batch'
182
+ # RandomResizedCrop
183
+ _C.AUG.RANDOM_RESIZED_CROP = False
184
+ _C.AUG.MEAN = (0.485, 0.456, 0.406)
185
+ _C.AUG.STD = (0.229, 0.224, 0.225)
186
+
187
+ # -----------------------------------------------------------------------------
188
+ # Testing settings
189
+ # -----------------------------------------------------------------------------
190
+ _C.TEST = CN()
191
+ # Whether to use center crop when testing
192
+ _C.TEST.CROP = True
193
+
194
+ # Whether to use SequentialSampler as validation sampler
195
+ _C.TEST.SEQUENTIAL = False
196
+
197
+ # -----------------------------------------------------------------------------
198
+ # Misc
199
+ # -----------------------------------------------------------------------------
200
+ # Mixed precision opt level, if O0, no amp is used ('O0', 'O1', 'O2')
201
+ # overwritten by command line argument
202
+ _C.AMP_OPT_LEVEL = ''
203
+ # Path to output folder, overwritten by command line argument
204
+ _C.OUTPUT = ''
205
+ # Tag of experiment, overwritten by command line argument
206
+ _C.TAG = 'default'
207
+ # Frequency to save checkpoint
208
+ _C.SAVE_FREQ = 1
209
+ # Frequency to logging info
210
+ _C.PRINT_FREQ = 10
211
+ # eval freq
212
+ _C.EVAL_FREQ = 1
213
+ # Fixed random seed
214
+ _C.SEED = 0
215
+ # Perform evaluation only, overwritten by command line argument
216
+ _C.EVAL_MODE = False
217
+ # Test throughput only, overwritten by command line argument
218
+ _C.THROUGHPUT_MODE = False
219
+ # local rank for DistributedDataParallel, given by command line argument
220
+ _C.LOCAL_RANK = 0
221
+ _C.EVAL_22K_TO_1K = False
222
+
223
+ _C.AMP_TYPE = 'float16'
224
+
225
+
226
+ def _update_config_from_file(config, cfg_file):
227
+ config.defrost()
228
+ with open(cfg_file, 'r') as f:
229
+ yaml_cfg = yaml.load(f, Loader=yaml.FullLoader)
230
+
231
+ for cfg in yaml_cfg.setdefault('BASE', ['']):
232
+ if cfg:
233
+ _update_config_from_file(
234
+ config, os.path.join(os.path.dirname(cfg_file), cfg))
235
+ print('=> merge config from {}'.format(cfg_file))
236
+ config.merge_from_file(cfg_file)
237
+ config.freeze()
238
+
239
+
240
+ def update_config(config, args):
241
+ _update_config_from_file(config, args.cfg)
242
+
243
+ config.defrost()
244
+ if hasattr(args, 'opts') and args.opts:
245
+ config.merge_from_list(args.opts)
246
+
247
+ # merge from specific arguments
248
+ if hasattr(args, 'batch_size') and args.batch_size:
249
+ config.DATA.BATCH_SIZE = args.batch_size
250
+ if hasattr(args, 'dataset') and args.dataset:
251
+ config.DATA.DATASET = args.dataset
252
+ if hasattr(args, 'data_path') and args.data_path:
253
+ config.DATA.DATA_PATH = args.data_path
254
+ if hasattr(args, 'zip') and args.zip:
255
+ config.DATA.ZIP_MODE = True
256
+ if hasattr(args, 'cache_mode') and args.cache_mode:
257
+ config.DATA.CACHE_MODE = args.cache_mode
258
+ if hasattr(args, 'pretrained') and args.pretrained:
259
+ config.MODEL.PRETRAINED = args.pretrained
260
+ if hasattr(args, 'resume') and args.resume:
261
+ config.MODEL.RESUME = args.resume
262
+ if hasattr(args, 'accumulation_steps') and args.accumulation_steps:
263
+ config.TRAIN.ACCUMULATION_STEPS = args.accumulation_steps
264
+ if hasattr(args, 'use_checkpoint') and args.use_checkpoint:
265
+ config.TRAIN.USE_CHECKPOINT = True
266
+ if hasattr(args, 'amp_opt_level') and args.amp_opt_level:
267
+ config.AMP_OPT_LEVEL = args.amp_opt_level
268
+ if hasattr(args, 'output') and args.output:
269
+ config.OUTPUT = args.output
270
+ if hasattr(args, 'tag') and args.tag:
271
+ config.TAG = args.tag
272
+ if hasattr(args, 'eval') and args.eval:
273
+ config.EVAL_MODE = True
274
+ if hasattr(args, 'throughput') and args.throughput:
275
+ config.THROUGHPUT_MODE = True
276
+ if hasattr(args, 'save_ckpt_num') and args.save_ckpt_num:
277
+ config.SAVE_CKPT_NUM = args.save_ckpt_num
278
+ if hasattr(args, 'use_zero') and args.use_zero:
279
+ config.TRAIN.OPTIMIZER.USE_ZERO = True
280
+ # set local rank for distributed training
281
+ if hasattr(args, 'local_rank') and args.local_rank:
282
+ config.LOCAL_RANK = args.local_rank
283
+
284
+ # output folder
285
+ config.MODEL.NAME = args.cfg.split('/')[-1].replace('.yaml', '')
286
+ config.OUTPUT = os.path.join(config.OUTPUT, config.MODEL.NAME)
287
+ # config.OUTPUT = os.path.join(config.OUTPUT, config.MODEL.NAME, config.TAG)
288
+
289
+ config.freeze()
290
+
291
+
292
+ def get_config(args):
293
+ """Get a yacs CfgNode object with default values."""
294
+ # Return a clone so that the defaults will not be altered
295
+ # This is for the "local variable" use pattern
296
+ config = _C.clone()
297
+ update_config(config, args)
298
+
299
+ return config
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu.yaml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ TRANSFORM: 'build_transform_for_linear_probe'
5
+ DATA_PATH: './data/imagenet-1k'
6
+ MODEL:
7
+ TYPE: intern_vit_6b
8
+ DROP_PATH_RATE: 0.0
9
+ INTERN_VIT_6B:
10
+ FREEZE_VIT: True
11
+ PATCH_SIZE: 14
12
+ PRETRAIN_SIZE: 224
13
+ QKV_BIAS: False
14
+ EMBED_DIM: 3200
15
+ NUM_HEADS: 25
16
+ MLP_RATIO: 4
17
+ INIT_VALUES: 0.1
18
+ QK_NORMALIZATION: True
19
+ DEPTH: 48
20
+ USE_FLASH_ATTN: True
21
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
22
+ CLS_TARGET: 'attention_pooling'
23
+ TRAIN:
24
+ EMA:
25
+ ENABLE: True
26
+ DECAY: 0.998
27
+ EPOCHS: 10
28
+ WARMUP_EPOCHS: 1
29
+ WEIGHT_DECAY: 0.0
30
+ BASE_LR: 0.1 # 512
31
+ WARMUP_LR: .0
32
+ MIN_LR: .0
33
+ LR_LAYER_DECAY: false
34
+ OPTIMIZER:
35
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenet_a.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_a'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-a'
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 224
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 48
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenet_r.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_r'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-r'
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 224
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 48
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenet_real.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet-real'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-1k'
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 224
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 48
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenet_sketch.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_sketch'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-sketch'
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 224
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 48
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224_64gpu_imagenetv2.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenetv2'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenetv2'
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 224
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 48
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ TRANSFORM: 'build_transform_for_linear_probe'
5
+ DATA_PATH: './data/imagenet-1k'
6
+ IMG_SIZE: 448
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 224
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 48
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenet_a.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_a'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-a'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 224
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 48
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenet_r.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_r'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-r'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 224
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 48
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenet_real.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet-real'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-1k'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 224
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 48
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenet_sketch.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_sketch'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-sketch'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 224
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 48
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_224px_in1k_224to448_64gpu_imagenetv2.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenetv2'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenetv2'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 224
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 48
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_224px.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ TRANSFORM: 'build_transform_for_linear_probe'
5
+ DATA_PATH: './data/imagenet-1k'
6
+ IMG_SIZE: 448
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 448
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 45
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_0.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenet_a.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_a'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-a'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_0.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenet_r.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_r'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-r'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_0.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenet_real.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet-real'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-1k'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_0.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenet_sketch.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_sketch'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-sketch'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_0.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_0_in1k_448_64gpu_imagenetv2.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenetv2'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenetv2'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_0.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ TRANSFORM: 'build_transform_for_linear_probe'
5
+ DATA_PATH: './data/imagenet-1k'
6
+ IMG_SIZE: 448
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 448
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 45
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_2.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenet_a.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_a'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-a'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_2.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenet_r.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_r'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-r'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_2.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenet_real.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet-real'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-1k'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_2.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenet_sketch.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_sketch'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-sketch'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_2.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_2_in1k_448_64gpu_imagenetv2.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenetv2'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenetv2'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_2.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ TRANSFORM: 'build_transform_for_linear_probe'
5
+ DATA_PATH: './data/imagenet-1k'
6
+ IMG_SIZE: 448
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 448
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 45
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_5.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenet_a.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_a'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-a'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenet_r.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_r'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-r'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenet_real.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet-real'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-1k'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenet_sketch.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_sketch'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-sketch'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v1_5_in1k_448_64gpu_imagenetv2.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenetv2'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenetv2'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v1_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ TRANSFORM: 'build_transform_for_linear_probe'
5
+ DATA_PATH: './data/imagenet-1k'
6
+ IMG_SIZE: 448
7
+ MODEL:
8
+ TYPE: intern_vit_6b
9
+ DROP_PATH_RATE: 0.0
10
+ INTERN_VIT_6B:
11
+ FREEZE_VIT: True
12
+ PATCH_SIZE: 14
13
+ PRETRAIN_SIZE: 448
14
+ QKV_BIAS: False
15
+ EMBED_DIM: 3200
16
+ NUM_HEADS: 25
17
+ MLP_RATIO: 4
18
+ INIT_VALUES: 0.1
19
+ QK_NORMALIZATION: True
20
+ DEPTH: 45
21
+ USE_FLASH_ATTN: True
22
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v2_5.pth"
23
+ CLS_TARGET: 'attention_pooling'
24
+ TRAIN:
25
+ EMA:
26
+ ENABLE: True
27
+ DECAY: 0.998
28
+ EPOCHS: 10
29
+ WARMUP_EPOCHS: 1
30
+ WEIGHT_DECAY: 0.0
31
+ BASE_LR: 0.1 # 512
32
+ WARMUP_LR: .0
33
+ MIN_LR: .0
34
+ LR_LAYER_DECAY: false
35
+ OPTIMIZER:
36
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu_imagenet_a.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_a'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-a'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v2_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu_imagenet_r.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_r'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-r'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v2_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu_imagenet_real.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet-real'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-1k'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v2_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'
InternVL/classification/configs/attn_pooling_probing/attn_pooling_probing_intern_vit_6b_448px_v2_5_in1k_448_64gpu_imagenet_sketch.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DATA:
2
+ IMG_ON_MEMORY: False
3
+ BATCH_SIZE: 16 # single GPU batch size
4
+ DATASET: 'imagenet_sketch'
5
+ TRANSFORM: 'build_transform_for_linear_probe'
6
+ DATA_PATH: './data/imagenet-sketch'
7
+ IMG_SIZE: 448
8
+ MODEL:
9
+ TYPE: intern_vit_6b
10
+ DROP_PATH_RATE: 0.0
11
+ INTERN_VIT_6B:
12
+ FREEZE_VIT: True
13
+ PATCH_SIZE: 14
14
+ PRETRAIN_SIZE: 448
15
+ QKV_BIAS: False
16
+ EMBED_DIM: 3200
17
+ NUM_HEADS: 25
18
+ MLP_RATIO: 4
19
+ INIT_VALUES: 0.1
20
+ QK_NORMALIZATION: True
21
+ DEPTH: 45
22
+ USE_FLASH_ATTN: True
23
+ PRETRAINED: "./pretrained/intern_vit_6b_448px_v2_5.pth"
24
+ CLS_TARGET: 'attention_pooling'
25
+ TRAIN:
26
+ EMA:
27
+ ENABLE: True
28
+ DECAY: 0.998
29
+ EPOCHS: 10
30
+ WARMUP_EPOCHS: 1
31
+ WEIGHT_DECAY: 0.0
32
+ BASE_LR: 0.1 # 512
33
+ WARMUP_LR: .0
34
+ MIN_LR: .0
35
+ LR_LAYER_DECAY: false
36
+ OPTIMIZER:
37
+ NAME: 'sgd'