Upload 10 files
Browse files- .gitattributes +3 -0
- LICENSE +202 -0
- Notice.txt +1 -0
- README.md +148 -3
- Results%20of%20VLM%20OC.png +3 -0
- Results%20of%20VLM%20OS.png +3 -0
- config.json +24 -0
- configuration_sailvit.py +62 -0
- method.png +3 -0
- model.safetensors +3 -0
- modeling_sailvit.py +198 -0
.gitattributes
CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
method.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
Results%20of%20VLM%20OC.png filter=lfs diff=lfs merge=lfs -text
|
38 |
+
Results%20of%20VLM%20OS.png filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Apache License
|
3 |
+
Version 2.0, January 2004
|
4 |
+
http://www.apache.org/licenses/
|
5 |
+
|
6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7 |
+
|
8 |
+
1. Definitions.
|
9 |
+
|
10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
12 |
+
|
13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14 |
+
the copyright owner that is granting the License.
|
15 |
+
|
16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
17 |
+
other entities that control, are controlled by, or are under common
|
18 |
+
control with that entity. For the purposes of this definition,
|
19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
20 |
+
direction or management of such entity, whether by contract or
|
21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23 |
+
|
24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25 |
+
exercising permissions granted by this License.
|
26 |
+
|
27 |
+
"Source" form shall mean the preferred form for making modifications,
|
28 |
+
including but not limited to software source code, documentation
|
29 |
+
source, and configuration files.
|
30 |
+
|
31 |
+
"Object" form shall mean any form resulting from mechanical
|
32 |
+
transformation or translation of a Source form, including but
|
33 |
+
not limited to compiled object code, generated documentation,
|
34 |
+
and conversions to other media types.
|
35 |
+
|
36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
37 |
+
Object form, made available under the License, as indicated by a
|
38 |
+
copyright notice that is included in or attached to the work
|
39 |
+
(an example is provided in the Appendix below).
|
40 |
+
|
41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42 |
+
form, that is based on (or derived from) the Work and for which the
|
43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
45 |
+
of this License, Derivative Works shall not include works that remain
|
46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47 |
+
the Work and Derivative Works thereof.
|
48 |
+
|
49 |
+
"Contribution" shall mean any work of authorship, including
|
50 |
+
the original version of the Work and any modifications or additions
|
51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
55 |
+
means any form of electronic, verbal, or written communication sent
|
56 |
+
to the Licensor or its representatives, including but not limited to
|
57 |
+
communication on electronic mailing lists, source code control systems,
|
58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
60 |
+
excluding communication that is conspicuously marked or otherwise
|
61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
62 |
+
|
63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
65 |
+
subsequently incorporated within the Work.
|
66 |
+
|
67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
72 |
+
Work and such Derivative Works in Source or Object form.
|
73 |
+
|
74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77 |
+
(except as stated in this section) patent license to make, have made,
|
78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79 |
+
where such license applies only to those patent claims licensable
|
80 |
+
by such Contributor that are necessarily infringed by their
|
81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
83 |
+
institute patent litigation against any entity (including a
|
84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85 |
+
or a Contribution incorporated within the Work constitutes direct
|
86 |
+
or contributory patent infringement, then any patent licenses
|
87 |
+
granted to You under this License for that Work shall terminate
|
88 |
+
as of the date such litigation is filed.
|
89 |
+
|
90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
91 |
+
Work or Derivative Works thereof in any medium, with or without
|
92 |
+
modifications, and in Source or Object form, provided that You
|
93 |
+
meet the following conditions:
|
94 |
+
|
95 |
+
(a) You must give any other recipients of the Work or
|
96 |
+
Derivative Works a copy of this License; and
|
97 |
+
|
98 |
+
(b) You must cause any modified files to carry prominent notices
|
99 |
+
stating that You changed the files; and
|
100 |
+
|
101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
102 |
+
that You distribute, all copyright, patent, trademark, and
|
103 |
+
attribution notices from the Source form of the Work,
|
104 |
+
excluding those notices that do not pertain to any part of
|
105 |
+
the Derivative Works; and
|
106 |
+
|
107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108 |
+
distribution, then any Derivative Works that You distribute must
|
109 |
+
include a readable copy of the attribution notices contained
|
110 |
+
within such NOTICE file, excluding those notices that do not
|
111 |
+
pertain to any part of the Derivative Works, in at least one
|
112 |
+
of the following places: within a NOTICE text file distributed
|
113 |
+
as part of the Derivative Works; within the Source form or
|
114 |
+
documentation, if provided along with the Derivative Works; or,
|
115 |
+
within a display generated by the Derivative Works, if and
|
116 |
+
wherever such third-party notices normally appear. The contents
|
117 |
+
of the NOTICE file are for informational purposes only and
|
118 |
+
do not modify the License. You may add Your own attribution
|
119 |
+
notices within Derivative Works that You distribute, alongside
|
120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
121 |
+
that such additional attribution notices cannot be construed
|
122 |
+
as modifying the License.
|
123 |
+
|
124 |
+
You may add Your own copyright statement to Your modifications and
|
125 |
+
may provide additional or different license terms and conditions
|
126 |
+
for use, reproduction, or distribution of Your modifications, or
|
127 |
+
for any such Derivative Works as a whole, provided Your use,
|
128 |
+
reproduction, and distribution of the Work otherwise complies with
|
129 |
+
the conditions stated in this License.
|
130 |
+
|
131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
133 |
+
by You to the Licensor shall be under the terms and conditions of
|
134 |
+
this License, without any additional terms or conditions.
|
135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136 |
+
the terms of any separate license agreement you may have executed
|
137 |
+
with Licensor regarding such Contributions.
|
138 |
+
|
139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
141 |
+
except as required for reasonable and customary use in describing the
|
142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
143 |
+
|
144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145 |
+
agreed to in writing, Licensor provides the Work (and each
|
146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148 |
+
implied, including, without limitation, any warranties or conditions
|
149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151 |
+
appropriateness of using or redistributing the Work and assume any
|
152 |
+
risks associated with Your exercise of permissions under this License.
|
153 |
+
|
154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
155 |
+
whether in tort (including negligence), contract, or otherwise,
|
156 |
+
unless required by applicable law (such as deliberate and grossly
|
157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158 |
+
liable to You for damages, including any direct, indirect, special,
|
159 |
+
incidental, or consequential damages of any character arising as a
|
160 |
+
result of this License or out of the use or inability to use the
|
161 |
+
Work (including but not limited to damages for loss of goodwill,
|
162 |
+
work stoppage, computer failure or malfunction, or any and all
|
163 |
+
other commercial damages or losses), even if such Contributor
|
164 |
+
has been advised of the possibility of such damages.
|
165 |
+
|
166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169 |
+
or other liability obligations and/or rights consistent with this
|
170 |
+
License. However, in accepting such obligations, You may act only
|
171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172 |
+
of any other Contributor, and only if You agree to indemnify,
|
173 |
+
defend, and hold each Contributor harmless for any liability
|
174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
175 |
+
of your accepting any such warranty or additional liability.
|
176 |
+
|
177 |
+
END OF TERMS AND CONDITIONS
|
178 |
+
|
179 |
+
APPENDIX: How to apply the Apache License to your work.
|
180 |
+
|
181 |
+
To apply the Apache License to your work, attach the following
|
182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183 |
+
replaced with your own identifying information. (Don't include
|
184 |
+
the brackets!) The text should be enclosed in the appropriate
|
185 |
+
comment syntax for the file format. We also recommend that a
|
186 |
+
file or class name and description of purpose be included on the
|
187 |
+
same "printed page" as the copyright notice for easier
|
188 |
+
identification within third-party archives.
|
189 |
+
|
190 |
+
Copyright [yyyy] [name of copyright owner]
|
191 |
+
|
192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193 |
+
you may not use this file except in compliance with the License.
|
194 |
+
You may obtain a copy of the License at
|
195 |
+
|
196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
197 |
+
|
198 |
+
Unless required by applicable law or agreed to in writing, software
|
199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201 |
+
See the License for the specific language governing permissions and
|
202 |
+
limitations under the License.
|
Notice.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Copyright (year) Bytedance Ltd. and/or its affiliates
|
README.md
CHANGED
@@ -1,3 +1,148 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
- zh
|
6 |
+
base_model:
|
7 |
+
- apple/aimv2-large-patch14-448
|
8 |
+
pipeline_tag: image-feature-extraction
|
9 |
+
tags:
|
10 |
+
- vision
|
11 |
+
- image-feature-extraction
|
12 |
+
- vlm
|
13 |
+
- pytorch
|
14 |
+
---
|
15 |
+
|
16 |
+
# Introduction
|
17 |
+
[[`SAILViT Paper`](https://arxiv.org/abs/2507.01643)] [[`BibTeX`](#citation)]
|
18 |
+
|
19 |
+
We are pleased to announce the release of SAILViT, a series of versatile vision foundation models of our sota [SAIL-VL-1d6-8B](https://huggingface.co/BytedanceDouyinContent/SAIL-VL-1d6-8B) and [SAIL-VL-1d5-2B](https://huggingface.co/BytedanceDouyinContent/SAIL-VL-1.5-2B).
|
20 |
+
The core philosophy is to mitigate parameter initialization conflicts and modality semantic discrepancies among components by progressive learning before MLLMs perform target training. The main contributions are summarized as follows:
|
21 |
+
|
22 |
+
1. SAILViT eliminates multimodal perception performance bottlenecks on sophisticated visual understanding for constructing more powerful MLLMs.
|
23 |
+
2. We carefully design a training pipeline for gradual feature refinement, which accommodates different vision foundation models in a hierarchical and flexible optimization pattern, and achieves cross-modal alignment and integrated reinforcement of visual representations.
|
24 |
+
3. We prove the robustness and generalizability of SAILViT via multi-dimensional analyses, including different parameter sizes, model architectures, training strategies, and data scales. SAILViT-Large outperforms the same-sized visual backbones by large margins on diverse tasks, while its Huge version assists MLLMs to achieve significant performance gains.
|
25 |
+
4. Equipped with the SAILViT-Huge, our SAIL-VL-1d5-2B and SAIL-VL-1d6-8B achieve the #1 ranking in the publicly available OpenCompass Benchmark when compared to VLMs of the same size.
|
26 |
+
|
27 |
+
## Training Recipes
|
28 |
+
|
29 |
+
We progressively inculcate hierarchical multimodal knowledge for the vision foundation model through three training stages in order to enhance visual representations and accomplish a seamless modality-semantic transition with LLMs.
|
30 |
+
|
31 |
+
<img src="method.png" alt="Training pipeline of SAILViT"/>
|
32 |
+
|
33 |
+
## Model Zoo
|
34 |
+
| Architecture | Parameter | Patch Size | Resolution |
|
35 |
+
| --- | --- | --- | --- |
|
36 |
+
| [🤗SAILViT-Large-300M-448px](https://huggingface.co/BytedanceDouyinContent/SAILViT-Large-300M-448px) | 300M | 14 | 448x448 |
|
37 |
+
| [🤗SAILViT-Huge-600M-448px](https://huggingface.co/BytedanceDouyinContent/SAILViT-Large-300M-448px) | 600M | 14 | 448x448 |
|
38 |
+
|
39 |
+
## Evaluation
|
40 |
+
|
41 |
+
### MLLM Benchmarks
|
42 |
+
We compared SAILViT with other visual backbones connected with various LLMs on OpenCompass and OpenSource. The SAILViT series has significant performance gains on different families of LLMs.
|
43 |
+
#### OpenCompass
|
44 |
+
<!-- | LLM Series | Visual Backbones Series | Avg. | AI2D (test) | HallusionBench | MMBench (val) | MMMU (val) | MMVet | OCRBench | MMStar | MathVista (testmini) |
|
45 |
+
|--------------------|-------------------------------|------|-------------|----------------|----------------|------------|-------|----------|--------|----------------------|
|
46 |
+
| **InternLM2.5 Series** | | | | | | | | | | |
|
47 |
+
| InternLM2.5-1.8B | InternViT-300M-v2.5 | 49.9 | 69.27 | 33.35 | 65.98 | 35.11 | 29.59 | 713 | 47.80 | 47.1 |
|
48 |
+
| InternLM2.5-1.8B | AIMv2-Large (300M) | 51.2 | 71.53 | 33.02 | 66.45 | 35.33 | 32.34 | 729 | 49.93 | 48.0 |
|
49 |
+
| InternLM2.5-1.8B | SAILViT-Large | 52.4 | 73.09 | 35.32 | 67.80 | 36.78 | 34.40 | 716 | 50.80 | 49.3 |
|
50 |
+
| InternLM2.5-1.8B | AIMv2-Huge (600M) | 51.9 | 72.44 | 29.84 | 68.34 | 33.11 | 34.40 | 759 | 51.47 | 49.7 |
|
51 |
+
| InternLM2.5-1.8B | SAILViT-Huge (600M) | 54.4 | 73.19 | 37.62 | 70.16 | 36.89 | 37.16 | 757 | 53.20 | 51.2 |
|
52 |
+
| **Qwen2.5 Series** | | | | | | | | | | |
|
53 |
+
| Qwen2.5-1.5B | InternViT-300M-v2.5 | 52.2 | 64.02 | 33.56 | 69.16 | 41.56 | 38.72 | 725 | 48.33 | 50.0 |
|
54 |
+
| Qwen2.5-1.5B | AIMv2-Large (300M) | 54.6 | 75.29 | 33.73 | 70.94 | 40.56 | 37.16 | 749 | 53.33 | 50.8 |
|
55 |
+
| Qwen2.5-1.5B | SAILViT-Large | 56.9 | 76.20 | 40.93 | 71.94 | 41.89 | 38.99 | 772 | 53.89 | 53.9 |
|
56 |
+
| Qwen2.5-1.5B | AIMv2-Huge (600M) | 56.3 | 77.66 | 35.44 | 72.33 | 42.56 | 39.72 | 769 | 54.13 | 51.4 |
|
57 |
+
| Qwen2.5-1.5B | SAILViT-Huge (600M) | 57.7 | 78.27 | 37.91 | 73.99 | 43.44 | 40.55 | 795 | 55.60 | 52.1 |
|
58 |
+
| Qwen2.5-7B | InternViT-300M-v2.5 | 62.1 | 81.28 | 44.82 | 77.67 | 49.44 | 43.90 | 784 | 59.27 | 62.2 |
|
59 |
+
| Qwen2.5-7B | AIMv2-Large (300M) | 63.7 | 81.74 | 45.36 | 77.78 | 49.00 | 48.07 | 828 | 60.80 | 64.0 |
|
60 |
+
| Qwen2.5-7B | SAILViT-Large | 64.5 | 82.12 | 45.63 | 78.95 | 51.67 | 49.50 | 805 | 60.87 | 67.1 |
|
61 |
+
| Qwen2.5-7B | AIMv2-Huge (600M) | 64.2 | 81.44 | 44.04 | 80.30 | 50.78 | 46.10 | 815 | 62.33 | 67.4 |
|
62 |
+
| Qwen2.5-7B | SAILViT-Huge (600M) | 65.2 | 83.00 | 48.65 | 79.64 | 50.33 | 49.22 | 833 | 62.60 | 65.2 |
|
63 |
+
| **Qwen3 Series** | | | | | | | | | | |
|
64 |
+
| Qwen3-0.6B | AIMv2-Large (300M) | 51.7 | 71.37 | 38.92 | 65.52 | 35.11 | 33.07 | 703 | 49.80 | 49.2 |
|
65 |
+
| Qwen3-0.6B | SAILViT-Large (300M) | 52.9 | 71.05 | 41.05 | 64.86 | 36.67 | 34.77 | 741 | 50.93 | 49.4 |
|
66 |
+
| Qwen3-1.7B | AIMv2-Large (300M) | 56.3 | 77.49 | 39.76 | 71.28 | 42.78 | 39.17 | 751 | 53.40 | 51.4 |
|
67 |
+
| Qwen3-1.7B | SAILViT-Large (300M) | 58.1 | 78.82 | 41.84 | 71.44 | 42.56 | 43.21 | 790 | 54.80 | 52.8 |
|
68 |
+
| Qwen3-1.7B | AIMv2-Huge (600M) | 57.7 | 79.24 | 40.44 | 71.09 | 42.00 | 43.07 | 781 | 54.80 | 52.9 |
|
69 |
+
| Qwen3-1.7B | SAILViT-Huge (600M) | 59.4 | 79.89 | 41.23 | 74.19 | 43.11 | 44.31 | 806 | 56.93 | 54.9 |
|
70 |
+
| Qwen3-8B | AIMv2-Huge (600M) | 66.0 | 83.35 | 43.50 | 80.92 | 52.78 | 50.05 | 839 | 65.60 | 67.8 |
|
71 |
+
| Qwen3-8B | SAILViT-Huge (600M) | 66.6 | 84.17 | 48.23 | 81.89 | 51.78 | 46.83 | 857 | 65.13 | 69.4 | -->
|
72 |
+
<img src="Results of VLM OC.png" />
|
73 |
+
|
74 |
+
#### OpenSource
|
75 |
+
<img src="Results of VLM OS.png" />
|
76 |
+
|
77 |
+
### Visual perception tasks
|
78 |
+
We conducted a comparison of SAILViT against other visual backbones in visual recognition tasks, specifically focusing on image classification. Under strictly fair experimental conditions, our findings show that SAILViT outperforms peer models of similar scale, such as Aimv2 and InternViT. Impressively, SAILViT-huge even matches the performance of InternViT-6B on challenging benchmarks like ImageNet-R and ImageNet-v2.
|
79 |
+
|
80 |
+
| Settings | AIMv2-Large | InternViT-300M-448px-V2.5 | SAILViT-Large | AIMv2-Huge | SAILViT-Huge | InternViT-6B-448px-V2.5 |
|
81 |
+
|--------------|-------------|---------------------------|---------------|------------|--------------|-------------------------|
|
82 |
+
| ImageNet-1k | 79.88% | 73.70% | 80.71% | 81.68% | 82.21% | 84.18% |
|
83 |
+
| ImageNet-A | 25.41% | 13.45% | 29.31% | 28.96% | 33.04% | 46.27% |
|
84 |
+
| ImageNet-R | 55.73% | 39.99% | 56.42% | 58.13% | 60.33% | 59.88% |
|
85 |
+
| ImageNet-V2 | 76.45% | 69.55% | 77.06% | 77.32% | 78.94% | 80.92% |
|
86 |
+
| Average | 59.37% | 49.17% | 60.87% | 61.52% | 63.63% | 67.81% |
|
87 |
+
|
88 |
+
|
89 |
+
## Usage
|
90 |
+
|
91 |
+
```python
|
92 |
+
import torch
|
93 |
+
import torchvision.transforms as T
|
94 |
+
from PIL import Image
|
95 |
+
import requests
|
96 |
+
from torchvision.transforms.functional import InterpolationMode
|
97 |
+
from transformers import AutoModel, AutoTokenizer
|
98 |
+
|
99 |
+
IMAGENET_MEAN = (0.485, 0.456, 0.406)
|
100 |
+
IMAGENET_STD = (0.229, 0.224, 0.225)
|
101 |
+
def build_transform(input_size):
|
102 |
+
MEAN, STD = IMAGENET_MEAN, IMAGENET_STD
|
103 |
+
transform = T.Compose([
|
104 |
+
T.Lambda(lambda img: img.convert('RGB') if img.mode != 'RGB' else img),
|
105 |
+
T.Resize((input_size, input_size), interpolation=InterpolationMode.BICUBIC),
|
106 |
+
T.ToTensor(),
|
107 |
+
T.Normalize(mean=MEAN, std=STD)
|
108 |
+
])
|
109 |
+
return transform
|
110 |
+
|
111 |
+
path = "BytedanceDouyinContent/SAILViT-Large-300M-448px"
|
112 |
+
model = AutoModel.from_pretrained(
|
113 |
+
path,
|
114 |
+
torch_dtype=torch.bfloat16,
|
115 |
+
trust_remote_code=True).eval().cuda()
|
116 |
+
|
117 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
118 |
+
input_size = 448
|
119 |
+
image = Image.open(requests.get(url, stream=True).raw).convert('RGB')
|
120 |
+
transform = build_transform(input_size=input_size)
|
121 |
+
pixel_values = transform(image).unsqueeze(0).to(torch.bfloat16).cuda()
|
122 |
+
visual_tokens = model(pixel_values=pixel_values)
|
123 |
+
|
124 |
+
```
|
125 |
+
|
126 |
+
## Acknowledgments
|
127 |
+
Our model is built upon [Aimv2](https://huggingface.co/collections/apple/aimv2-6720fe1558d94c7805f7688c) and [Ovis2](https://huggingface.co/collections/AIDC-AI/ovis2-67ab36c7e497429034874464) and we are grateful for their contributions.
|
128 |
+
|
129 |
+
|
130 |
+
## Citation
|
131 |
+
If you find our work useful, please consider citing us as :
|
132 |
+
```bibtex
|
133 |
+
@misc{yin2025sailvitrobustgeneralizablevisual,
|
134 |
+
title={SAILViT: Towards Robust and Generalizable Visual Backbones for MLLMs via Gradual Feature Refinement},
|
135 |
+
author={Weijie Yin and Dingkang Yang and Hongyuan Dong and Zijian Kang and Jiacong Wang and Xiao Liang and Chao Feng and Jiao Ran},
|
136 |
+
year={2025},
|
137 |
+
eprint={2507.01643},
|
138 |
+
archivePrefix={arXiv},
|
139 |
+
primaryClass={cs.CV},
|
140 |
+
url={https://arxiv.org/abs/2507.01643},
|
141 |
+
}
|
142 |
+
```
|
143 |
+
|
144 |
+
## Licence
|
145 |
+
This project is licensed under [Apache License 2.0](LICENSE).
|
146 |
+
|
147 |
+
## Contact
|
148 |
+
If you have any question, please feel free to contact us: [email protected]
|
Results%20of%20VLM%20OC.png
ADDED
![]() |
Git LFS Details
|
Results%20of%20VLM%20OS.png
ADDED
![]() |
Git LFS Details
|
config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"SAILViTModel"
|
4 |
+
],
|
5 |
+
"attention_dropout": 0.0,
|
6 |
+
"auto_map": {
|
7 |
+
"AutoConfig": "configuration_sailvit.SAILViTConfig",
|
8 |
+
"AutoModel": "modeling_sailvit.SAILViTModel"
|
9 |
+
},
|
10 |
+
"hidden_size": 1536,
|
11 |
+
"image_size": 448,
|
12 |
+
"intermediate_size": 4096,
|
13 |
+
"model_type": "sailvit",
|
14 |
+
"num_attention_heads": 12,
|
15 |
+
"num_channels": 3,
|
16 |
+
"num_hidden_layers": 24,
|
17 |
+
"patch_size": 14,
|
18 |
+
"projection_dropout": 0.0,
|
19 |
+
"qkv_bias": false,
|
20 |
+
"rms_norm_eps": 1e-05,
|
21 |
+
"torch_dtype": "bfloat16",
|
22 |
+
"transformers_version": "4.45.1",
|
23 |
+
"use_bias": false
|
24 |
+
}
|
configuration_sailvit.py
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Any
|
2 |
+
|
3 |
+
from transformers.configuration_utils import PretrainedConfig
|
4 |
+
|
5 |
+
__all__ = ["SAILViTConfig"]
|
6 |
+
|
7 |
+
|
8 |
+
class SAILViTConfig(PretrainedConfig):
|
9 |
+
"""This is the configuration class to store the configuration of an [`SAILViTModel`].
|
10 |
+
|
11 |
+
Instantiating a configuration with the defaults will yield a similar configuration
|
12 |
+
to that of the [apple/SAILViT-Huge-600M-448px](https://huggingface.co/BytedanceDouyinContent/SAILViT-Huge-600M-448px).
|
13 |
+
|
14 |
+
Args:
|
15 |
+
hidden_size: Dimension of the hidden representations.
|
16 |
+
intermediate_size: Dimension of the SwiGLU representations.
|
17 |
+
num_hidden_layers: Number of hidden layers in the Transformer.
|
18 |
+
num_attention_heads: Number of attention heads for each attention layer
|
19 |
+
in the Transformer.
|
20 |
+
num_channels: Number of input channels.
|
21 |
+
image_size: Image size.
|
22 |
+
patch_size: Patch size.
|
23 |
+
rms_norm_eps: Epsilon value used for the RMS normalization layer.
|
24 |
+
attention_dropout: Dropout ratio for attention probabilities.
|
25 |
+
projection_dropout: Dropout ratio for the projection layer after the attention.
|
26 |
+
qkv_bias: Whether to add a bias to the queries, keys and values.
|
27 |
+
use_bias: Whether to add a bias in the feed-forward and projection layers.
|
28 |
+
kwargs: Keyword arguments for the [`PretrainedConfig`].
|
29 |
+
"""
|
30 |
+
|
31 |
+
model_type: str = "sailvit"
|
32 |
+
|
33 |
+
def __init__(
|
34 |
+
self,
|
35 |
+
hidden_size: int = 1024,
|
36 |
+
intermediate_size: int = 2816,
|
37 |
+
num_hidden_layers: int = 24,
|
38 |
+
num_attention_heads: int = 8,
|
39 |
+
num_channels: int = 3,
|
40 |
+
image_size: int = 224,
|
41 |
+
patch_size: int = 14,
|
42 |
+
rms_norm_eps: float = 1e-5,
|
43 |
+
attention_dropout: float = 0.0,
|
44 |
+
projection_dropout: float = 0.0,
|
45 |
+
qkv_bias: bool = False,
|
46 |
+
use_bias: bool = False,
|
47 |
+
**kwargs: Any,
|
48 |
+
):
|
49 |
+
super().__init__(**kwargs)
|
50 |
+
self.hidden_size = hidden_size
|
51 |
+
self.intermediate_size = intermediate_size
|
52 |
+
self.num_hidden_layers = num_hidden_layers
|
53 |
+
self.num_attention_heads = num_attention_heads
|
54 |
+
self.num_channels = num_channels
|
55 |
+
self.patch_size = patch_size
|
56 |
+
self.image_size = image_size
|
57 |
+
self.attention_dropout = attention_dropout
|
58 |
+
self.rms_norm_eps = rms_norm_eps
|
59 |
+
|
60 |
+
self.projection_dropout = projection_dropout
|
61 |
+
self.qkv_bias = qkv_bias
|
62 |
+
self.use_bias = use_bias
|
method.png
ADDED
![]() |
Git LFS Details
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0cef10930416041c4741c3c14ac226941b66f1ee4484cc495bf1160d767f67c1
|
3 |
+
size 1364081528
|
modeling_sailvit.py
ADDED
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# adapted from https://huggingface.co/apple/aimv2-huge-patch14-448 (modification: add gradient checkpoint support)
|
2 |
+
from typing import Optional, Tuple, Union
|
3 |
+
|
4 |
+
import torch
|
5 |
+
from .configuration_sailvit import SAILViTConfig
|
6 |
+
from torch import nn
|
7 |
+
from torch.nn import functional as F
|
8 |
+
from transformers.modeling_outputs import BaseModelOutputWithNoAttention
|
9 |
+
from transformers.modeling_utils import PreTrainedModel
|
10 |
+
|
11 |
+
__all__ = ["SAILViTModel"]
|
12 |
+
|
13 |
+
|
14 |
+
class RMSNorm(nn.Module):
|
15 |
+
def __init__(self, dim: int, eps: float = 1e-6):
|
16 |
+
super().__init__()
|
17 |
+
self.weight = nn.Parameter(torch.ones(dim))
|
18 |
+
self.eps = eps
|
19 |
+
|
20 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
21 |
+
output = self._norm(x.float()).type_as(x)
|
22 |
+
return output * self.weight
|
23 |
+
|
24 |
+
def extra_repr(self) -> str:
|
25 |
+
return f"{tuple(self.weight.shape)}, eps={self.eps}"
|
26 |
+
|
27 |
+
def _norm(self, x: torch.Tensor) -> torch.Tensor:
|
28 |
+
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
|
29 |
+
|
30 |
+
|
31 |
+
class SAILViTSwiGLUFFN(nn.Module):
|
32 |
+
def __init__(self, config: SAILViTConfig):
|
33 |
+
super().__init__()
|
34 |
+
hidden_features = config.intermediate_size
|
35 |
+
in_features = config.hidden_size
|
36 |
+
bias = config.use_bias
|
37 |
+
|
38 |
+
self.fc1 = nn.Linear(in_features, hidden_features, bias=bias)
|
39 |
+
self.fc2 = nn.Linear(hidden_features, in_features, bias=bias)
|
40 |
+
self.fc3 = nn.Linear(in_features, hidden_features, bias=bias)
|
41 |
+
|
42 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
43 |
+
x = F.silu(self.fc1(x)) * self.fc3(x)
|
44 |
+
x = self.fc2(x)
|
45 |
+
return x
|
46 |
+
|
47 |
+
|
48 |
+
class SAILViTPatchEmbed(nn.Module):
|
49 |
+
def __init__(self, config: SAILViTConfig):
|
50 |
+
super().__init__()
|
51 |
+
self.proj = nn.Conv2d(
|
52 |
+
config.num_channels,
|
53 |
+
config.hidden_size,
|
54 |
+
kernel_size=(config.patch_size, config.patch_size),
|
55 |
+
stride=(config.patch_size, config.patch_size),
|
56 |
+
)
|
57 |
+
self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
58 |
+
|
59 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
60 |
+
x = self.proj(x).flatten(2).transpose(1, 2)
|
61 |
+
x = self.norm(x)
|
62 |
+
return x
|
63 |
+
|
64 |
+
|
65 |
+
class SAILViTPreprocessor(nn.Module):
|
66 |
+
def __init__(self, config: SAILViTConfig):
|
67 |
+
super().__init__()
|
68 |
+
num_patches = (config.image_size // config.patch_size) ** 2
|
69 |
+
|
70 |
+
self.patchifier = SAILViTPatchEmbed(config)
|
71 |
+
self.pos_embed = nn.Parameter(torch.zeros((1, num_patches, config.hidden_size)))
|
72 |
+
|
73 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
74 |
+
tokens = self.patchifier(x)
|
75 |
+
_, N, _ = tokens.shape
|
76 |
+
pos_embed = self.pos_embed.to(tokens.device)
|
77 |
+
tokens = tokens + pos_embed[:, :N]
|
78 |
+
return tokens
|
79 |
+
|
80 |
+
|
81 |
+
class SAILViTAttention(nn.Module):
|
82 |
+
def __init__(self, config: SAILViTConfig):
|
83 |
+
super().__init__()
|
84 |
+
dim = config.hidden_size
|
85 |
+
|
86 |
+
self.num_heads = config.num_attention_heads
|
87 |
+
self.qkv = nn.Linear(dim, dim * 3, bias=config.qkv_bias)
|
88 |
+
self.attn_drop = nn.Dropout(config.attention_dropout)
|
89 |
+
self.proj = nn.Linear(dim, dim, bias=config.use_bias)
|
90 |
+
self.proj_drop = nn.Dropout(config.projection_dropout)
|
91 |
+
|
92 |
+
def forward(
|
93 |
+
self, x: torch.Tensor, mask: Optional[torch.Tensor] = None
|
94 |
+
) -> torch.Tensor:
|
95 |
+
B, N, C = x.shape
|
96 |
+
qkv = (
|
97 |
+
self.qkv(x)
|
98 |
+
.reshape(B, N, 3, self.num_heads, C // self.num_heads)
|
99 |
+
.permute(2, 0, 3, 1, 4)
|
100 |
+
)
|
101 |
+
q, k, v = qkv.unbind(0)
|
102 |
+
|
103 |
+
x = F.scaled_dot_product_attention(q, k, v, attn_mask=mask)
|
104 |
+
x = x.transpose(1, 2).contiguous().reshape(B, N, C)
|
105 |
+
x = self.proj(x)
|
106 |
+
x = self.proj_drop(x)
|
107 |
+
return x
|
108 |
+
|
109 |
+
|
110 |
+
class SAILViTBlock(nn.Module):
|
111 |
+
def __init__(self, config: SAILViTConfig):
|
112 |
+
super().__init__()
|
113 |
+
self.attn = SAILViTAttention(config)
|
114 |
+
self.norm_1 = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
115 |
+
self.mlp = SAILViTSwiGLUFFN(config)
|
116 |
+
self.norm_2 = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
117 |
+
|
118 |
+
def forward(
|
119 |
+
self, x: torch.Tensor, mask: Optional[torch.Tensor] = None
|
120 |
+
) -> torch.Tensor:
|
121 |
+
x = x + self.attn(self.norm_1(x), mask)
|
122 |
+
x = x + self.mlp(self.norm_2(x))
|
123 |
+
return x
|
124 |
+
|
125 |
+
|
126 |
+
class SAILViTTransformer(nn.Module):
|
127 |
+
def __init__(self, config: SAILViTConfig):
|
128 |
+
super().__init__()
|
129 |
+
self.blocks = nn.ModuleList(
|
130 |
+
[SAILViTBlock(config) for _ in range(config.num_hidden_layers)]
|
131 |
+
)
|
132 |
+
self.post_trunk_norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
133 |
+
self.gradient_checkpointing = False
|
134 |
+
|
135 |
+
def forward(
|
136 |
+
self,
|
137 |
+
tokens: torch.Tensor,
|
138 |
+
mask: Optional[torch.Tensor] = None,
|
139 |
+
output_hidden_states: bool = False,
|
140 |
+
) -> Tuple[torch.Tensor, Optional[Tuple[torch.Tensor, ...]]]:
|
141 |
+
hidden_states = () if output_hidden_states else None
|
142 |
+
for block in self.blocks:
|
143 |
+
if self.gradient_checkpointing and self.training:
|
144 |
+
tokens = self._gradient_checkpointing_func(block.__call__, tokens, mask)
|
145 |
+
else:
|
146 |
+
tokens = block(tokens, mask)
|
147 |
+
if output_hidden_states:
|
148 |
+
hidden_states += (tokens,)
|
149 |
+
tokens = self.post_trunk_norm(tokens)
|
150 |
+
return tokens, hidden_states
|
151 |
+
|
152 |
+
|
153 |
+
class SAILViTPretrainedModel(PreTrainedModel):
|
154 |
+
config_class = SAILViTConfig
|
155 |
+
base_model_prefix = "sailvit"
|
156 |
+
supports_gradient_checkpointing = True
|
157 |
+
main_input_name = "pixel_values"
|
158 |
+
_no_split_modules = ["SAILViTPreprocessor", "SAILViTBlock"]
|
159 |
+
_supports_sdpa = True
|
160 |
+
|
161 |
+
|
162 |
+
class SAILViTModel(SAILViTPretrainedModel):
|
163 |
+
def __init__(self, config: SAILViTConfig):
|
164 |
+
super().__init__(config)
|
165 |
+
self.preprocessor = SAILViTPreprocessor(config)
|
166 |
+
self.trunk = SAILViTTransformer(config)
|
167 |
+
|
168 |
+
def forward(
|
169 |
+
self,
|
170 |
+
pixel_values: torch.Tensor,
|
171 |
+
mask: Optional[torch.Tensor] = None,
|
172 |
+
output_hidden_states: Optional[bool] = None,
|
173 |
+
return_dict: Optional[bool] = None,
|
174 |
+
) -> Union[
|
175 |
+
Tuple[torch.Tensor],
|
176 |
+
Tuple[torch.Tensor, Tuple[torch.Tensor, ...]],
|
177 |
+
BaseModelOutputWithNoAttention,
|
178 |
+
]:
|
179 |
+
if output_hidden_states is None:
|
180 |
+
output_hidden_states = self.config.output_hidden_states
|
181 |
+
if return_dict is None:
|
182 |
+
return_dict = self.config.use_return_dict
|
183 |
+
|
184 |
+
x = self.preprocessor(pixel_values)
|
185 |
+
x, hidden_states = self.trunk(
|
186 |
+
x, mask, output_hidden_states=output_hidden_states
|
187 |
+
)
|
188 |
+
|
189 |
+
if not return_dict:
|
190 |
+
res = (x,)
|
191 |
+
res += (hidden_states,) if output_hidden_states else ()
|
192 |
+
return res
|
193 |
+
|
194 |
+
return BaseModelOutputWithNoAttention(
|
195 |
+
last_hidden_state=x,
|
196 |
+
hidden_states=hidden_states,
|
197 |
+
)
|
198 |
+
|