Duplicate from Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4
Browse filesCo-authored-by: Keqin Chen <[email protected]>
- .gitattributes +35 -0
- LICENSE +202 -0
- README.md +520 -0
- added_tokens.json +16 -0
- chat_template.json +3 -0
- config.json +57 -0
- generation_config.json +14 -0
- merges.txt +0 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +0 -0
- preprocessor_config.json +29 -0
- quantize_config.json +11 -0
- special_tokens_map.json +31 -0
- tokenizer.json +0 -0
- tokenizer_config.json +144 -0
- vocab.json +0 -0
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz 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
|
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 2024 Alibaba Cloud
|
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.
|
README.md
ADDED
@@ -0,0 +1,520 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: image-text-to-text
|
6 |
+
tags:
|
7 |
+
- multimodal
|
8 |
+
base_model: Qwen/Qwen2-VL-7B-Instruct
|
9 |
+
library_name: transformers
|
10 |
+
---
|
11 |
+
|
12 |
+
# Qwen2-VL-7B-Instruct-GPTQ-Int4
|
13 |
+
|
14 |
+
## Introduction
|
15 |
+
|
16 |
+
We're excited to unveil **Qwen2-VL**, the latest iteration of our Qwen-VL model, representing nearly a year of innovation.
|
17 |
+
|
18 |
+
### What’s New in Qwen2-VL?
|
19 |
+
|
20 |
+
#### Key Enhancements:
|
21 |
+
|
22 |
+
* **SoTA understanding of images of various resolution & ratio**: Qwen2-VL achieves state-of-the-art performance on visual understanding benchmarks, including MathVista, DocVQA, RealWorldQA, MTVQA, etc.
|
23 |
+
|
24 |
+
* **Understanding videos of 20min+**: Qwen2-VL can understand videos over 20 minutes for high-quality video-based question answering, dialog, content creation, etc.
|
25 |
+
|
26 |
+
* **Agent that can operate your mobiles, robots, etc.**: with the abilities of complex reasoning and decision making, Qwen2-VL can be integrated with devices like mobile phones, robots, etc., for automatic operation based on visual environment and text instructions.
|
27 |
+
|
28 |
+
* **Multilingual Support**: to serve global users, besides English and Chinese, Qwen2-VL now supports the understanding of texts in different languages inside images, including most European languages, Japanese, Korean, Arabic, Vietnamese, etc.
|
29 |
+
|
30 |
+
|
31 |
+
#### Model Architecture Updates:
|
32 |
+
|
33 |
+
* **Naive Dynamic Resolution**: Unlike before, Qwen2-VL can handle arbitrary image resolutions, mapping them into a dynamic number of visual tokens, offering a more human-like visual processing experience.
|
34 |
+
|
35 |
+
<p align="center">
|
36 |
+
<img src="https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/Qwen2-VL/qwen2_vl.jpg" width="80%"/>
|
37 |
+
<p>
|
38 |
+
|
39 |
+
* **Multimodal Rotary Position Embedding (M-ROPE)**: Decomposes positional embedding into parts to capture 1D textual, 2D visual, and 3D video positional information, enhancing its multimodal processing capabilities.
|
40 |
+
|
41 |
+
<p align="center">
|
42 |
+
<img src="http://qianwen-res.oss-accelerate-overseas.aliyuncs.com/Qwen2-VL/mrope.png" width="80%"/>
|
43 |
+
<p>
|
44 |
+
|
45 |
+
We have three models with 2, 7 and 72 billion parameters. This repo contains the instruction-tuned 7B Qwen2-VL model. For more information, visit our [Blog](https://qwenlm.github.io/blog/qwen2-vl/) and [GitHub](https://github.com/QwenLM/Qwen2-VL).
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
### Benchmark
|
50 |
+
#### Performance of Quantized Models
|
51 |
+
This section reports the generation performance of quantized models (including GPTQ and AWQ) of the Qwen2-VL series. Specifically, we report:
|
52 |
+
|
53 |
+
- MMMU_VAL (Accuracy)
|
54 |
+
- DocVQA_VAL (Accuracy)
|
55 |
+
- MMBench_DEV_EN (Accuracy)
|
56 |
+
- MathVista_MINI (Accuracy)
|
57 |
+
|
58 |
+
We use [VLMEvalkit](https://github.com/kq-chen/VLMEvalKit/tree/add_qwen2vl) to evaluate all models.
|
59 |
+
|
60 |
+
|
61 |
+
| Model Size | Quantization | MMMU | DocVQA | MMBench | MathVista |
|
62 |
+
| --- | --- | --- | --- | --- | --- |
|
63 |
+
| Qwen2-VL-7B-Instruct | BF16<br><sup>([🤗](https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct)[🤖](https://modelscope.cn/models/qwen/Qwen2-VL-7B-Instruct)) | 53.77 | 93.89 | 81.78 | 58.20 |
|
64 |
+
| | GPTQ-Int8<br><sup>([🤗](https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int8)[🤖](https://modelscope.cn/models/qwen/Qwen2-VL-7B-Instruct-GPTQ-Int8)) | 53.00 | 93.94 | 82.38 | 57.90 |
|
65 |
+
| | GPTQ-Int4<br><sup>([🤗](https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4)[🤖](https://modelscope.cn/models/qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4)) | 52.55 | 93.16 | 81.27 | 60.30 |
|
66 |
+
| | AWQ<br><sup>([🤗](https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct-AWQ)[🤖](https://modelscope.cn/models/qwen/Qwen2-VL-7B-Instruct-AWQ)) | 53.66 | 93.10 | 81.61 | 56.80 |
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
#### Speed Benchmark
|
71 |
+
This section reports the speed performance of bf16 models, quantized models (including GPTQ-Int4, GPTQ-Int8 and AWQ) of the Qwen2-VL series. Specifically, we report the inference speed (tokens/s) as well as memory footprint (GB) under the conditions of different context lengths.
|
72 |
+
|
73 |
+
The environment of the evaluation with huggingface transformers is:
|
74 |
+
|
75 |
+
- NVIDIA A100 80GB
|
76 |
+
- CUDA 11.8
|
77 |
+
- Pytorch 2.2.1+cu118
|
78 |
+
- Flash Attention 2.6.1
|
79 |
+
- Transformers 4.38.2
|
80 |
+
- AutoGPTQ 0.6.0+cu118
|
81 |
+
- AutoAWQ 0.2.5+cu118 (autoawq_kernels 0.0.6+cu118)
|
82 |
+
|
83 |
+
Note:
|
84 |
+
|
85 |
+
- We use the batch size of 1 and the least number of GPUs as possible for the evalution.
|
86 |
+
- We test the speed and memory of generating 2048 tokens with the input lengths of 1, 6144, 14336, 30720, 63488, and 129024 tokens (>32k is only avaliable for Qwen2-72B-Instuct and Qwen2-7B-Instuct).
|
87 |
+
|
88 |
+
- 7B (transformers)
|
89 |
+
|
90 |
+
| Model | Input Length | Quantization | GPU Num | Speed(tokens/s) | GPU Memory(GB) |
|
91 |
+
| --- | --- | --- | --- | --- | --- |
|
92 |
+
| Qwen2-VL-7B-Instruct | 1 | BF16 | 1 | 39.02 | 16.07 |
|
93 |
+
| | | GPTQ-Int8 | 1 | 31.60 | 10.11 |
|
94 |
+
| | | GPTQ-Int4 | 1 | 42.76 | 7.20 |
|
95 |
+
| | | AWQ | 1 | 32.08 | 7.07 |
|
96 |
+
| | 6144 | BF16 | 1 | 38.75 | 21.56 |
|
97 |
+
| | | GPTQ-Int8 | 1 | 31.31 | 15.61 |
|
98 |
+
| | | GPTQ-Int4 | 1 | 39.75 | 12.69 |
|
99 |
+
| | | AWQ | 1 | 32.66 | 12.56 |
|
100 |
+
| | 14336 | BF16 | 1 | 30.65 | 29.07 |
|
101 |
+
| | | GPTQ-Int8 | 1 | 27.96 | 23.11 |
|
102 |
+
| | | GPTQ-Int4 | 1 | 29.72 | 20.20 |
|
103 |
+
| | | AWQ | 1 | 31.42 | 20.07 |
|
104 |
+
| | 30720 | BF16 | 1 | 19.53 | 44.08 |
|
105 |
+
| | | GPTQ-Int8 | 1 | 18.37 | 38.13 |
|
106 |
+
| | | GPTQ-Int4 | 1 | 19.15 | 35.22 |
|
107 |
+
| | | AWQ | 1 | 19.95 | 35.08 |
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
## Requirements
|
113 |
+
The code of Qwen2-VL has been in the latest Hugging face transformers and we advise you to build from source with command `pip install git+https://github.com/huggingface/transformers`, or you might encounter the following error:
|
114 |
+
```
|
115 |
+
KeyError: 'qwen2_vl'
|
116 |
+
```
|
117 |
+
|
118 |
+
## Quickstart
|
119 |
+
We offer a toolkit to help you handle various types of visual input more conveniently, as if you were using an API. This includes base64, URLs, and interleaved images and videos. You can install it using the following command:
|
120 |
+
|
121 |
+
```bash
|
122 |
+
pip install qwen-vl-utils
|
123 |
+
```
|
124 |
+
|
125 |
+
Here we show a code snippet to show you how to use the chat model with `transformers` and `qwen_vl_utils`:
|
126 |
+
|
127 |
+
```python
|
128 |
+
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
129 |
+
from qwen_vl_utils import process_vision_info
|
130 |
+
|
131 |
+
# default: Load the model on the available device(s)
|
132 |
+
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
133 |
+
"Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4", torch_dtype="auto", device_map="auto"
|
134 |
+
)
|
135 |
+
|
136 |
+
# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
|
137 |
+
# model = Qwen2VLForConditionalGeneration.from_pretrained(
|
138 |
+
# "Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4",
|
139 |
+
# torch_dtype=torch.bfloat16,
|
140 |
+
# attn_implementation="flash_attention_2",
|
141 |
+
# device_map="auto",
|
142 |
+
# )
|
143 |
+
|
144 |
+
# default processer
|
145 |
+
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4")
|
146 |
+
|
147 |
+
# The default range for the number of visual tokens per image in the model is 4-16384. You can set min_pixels and max_pixels according to your needs, such as a token count range of 256-1280, to balance speed and memory usage.
|
148 |
+
# min_pixels = 256*28*28
|
149 |
+
# max_pixels = 1280*28*28
|
150 |
+
# processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4", min_pixels=min_pixels, max_pixels=max_pixels)
|
151 |
+
|
152 |
+
messages = [
|
153 |
+
{
|
154 |
+
"role": "user",
|
155 |
+
"content": [
|
156 |
+
{
|
157 |
+
"type": "image",
|
158 |
+
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
|
159 |
+
},
|
160 |
+
{"type": "text", "text": "Describe this image."},
|
161 |
+
],
|
162 |
+
}
|
163 |
+
]
|
164 |
+
|
165 |
+
# Preparation for inference
|
166 |
+
text = processor.apply_chat_template(
|
167 |
+
messages, tokenize=False, add_generation_prompt=True
|
168 |
+
)
|
169 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
170 |
+
inputs = processor(
|
171 |
+
text=[text],
|
172 |
+
images=image_inputs,
|
173 |
+
videos=video_inputs,
|
174 |
+
padding=True,
|
175 |
+
return_tensors="pt",
|
176 |
+
)
|
177 |
+
inputs = inputs.to("cuda")
|
178 |
+
|
179 |
+
# Inference: Generation of the output
|
180 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
181 |
+
generated_ids_trimmed = [
|
182 |
+
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
183 |
+
]
|
184 |
+
output_text = processor.batch_decode(
|
185 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
186 |
+
)
|
187 |
+
print(output_text)
|
188 |
+
```
|
189 |
+
<details>
|
190 |
+
<summary>Without qwen_vl_utils</summary>
|
191 |
+
|
192 |
+
```python
|
193 |
+
from PIL import Image
|
194 |
+
import requests
|
195 |
+
import torch
|
196 |
+
from torchvision import io
|
197 |
+
from typing import Dict
|
198 |
+
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
199 |
+
|
200 |
+
# Load the model in half-precision on the available device(s)
|
201 |
+
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
202 |
+
"Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4", torch_dtype="auto", device_map="auto"
|
203 |
+
)
|
204 |
+
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4")
|
205 |
+
|
206 |
+
# Image
|
207 |
+
url = "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"
|
208 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
209 |
+
|
210 |
+
conversation = [
|
211 |
+
{
|
212 |
+
"role": "user",
|
213 |
+
"content": [
|
214 |
+
{
|
215 |
+
"type": "image",
|
216 |
+
},
|
217 |
+
{"type": "text", "text": "Describe this image."},
|
218 |
+
],
|
219 |
+
}
|
220 |
+
]
|
221 |
+
|
222 |
+
|
223 |
+
# Preprocess the inputs
|
224 |
+
text_prompt = processor.apply_chat_template(conversation, add_generation_prompt=True)
|
225 |
+
# Excepted output: '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n<|vision_start|><|image_pad|><|vision_end|>Describe this image.<|im_end|>\n<|im_start|>assistant\n'
|
226 |
+
|
227 |
+
inputs = processor(
|
228 |
+
text=[text_prompt], images=[image], padding=True, return_tensors="pt"
|
229 |
+
)
|
230 |
+
inputs = inputs.to("cuda")
|
231 |
+
|
232 |
+
# Inference: Generation of the output
|
233 |
+
output_ids = model.generate(**inputs, max_new_tokens=128)
|
234 |
+
generated_ids = [
|
235 |
+
output_ids[len(input_ids) :]
|
236 |
+
for input_ids, output_ids in zip(inputs.input_ids, output_ids)
|
237 |
+
]
|
238 |
+
output_text = processor.batch_decode(
|
239 |
+
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True
|
240 |
+
)
|
241 |
+
print(output_text)
|
242 |
+
```
|
243 |
+
</details>
|
244 |
+
<details>
|
245 |
+
<summary>Multi image inference</summary>
|
246 |
+
|
247 |
+
```python
|
248 |
+
# Messages containing multiple images and a text query
|
249 |
+
messages = [
|
250 |
+
{
|
251 |
+
"role": "user",
|
252 |
+
"content": [
|
253 |
+
{"type": "image", "image": "file:///path/to/image1.jpg"},
|
254 |
+
{"type": "image", "image": "file:///path/to/image2.jpg"},
|
255 |
+
{"type": "text", "text": "Identify the similarities between these images."},
|
256 |
+
],
|
257 |
+
}
|
258 |
+
]
|
259 |
+
|
260 |
+
# Preparation for inference
|
261 |
+
text = processor.apply_chat_template(
|
262 |
+
messages, tokenize=False, add_generation_prompt=True
|
263 |
+
)
|
264 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
265 |
+
inputs = processor(
|
266 |
+
text=[text],
|
267 |
+
images=image_inputs,
|
268 |
+
videos=video_inputs,
|
269 |
+
padding=True,
|
270 |
+
return_tensors="pt",
|
271 |
+
)
|
272 |
+
inputs = inputs.to("cuda")
|
273 |
+
|
274 |
+
# Inference
|
275 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
276 |
+
generated_ids_trimmed = [
|
277 |
+
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
278 |
+
]
|
279 |
+
output_text = processor.batch_decode(
|
280 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
281 |
+
)
|
282 |
+
print(output_text)
|
283 |
+
```
|
284 |
+
</details>
|
285 |
+
|
286 |
+
<details>
|
287 |
+
<summary>Video inference</summary>
|
288 |
+
|
289 |
+
```python
|
290 |
+
# Messages containing a images list as a video and a text query
|
291 |
+
messages = [
|
292 |
+
{
|
293 |
+
"role": "user",
|
294 |
+
"content": [
|
295 |
+
{
|
296 |
+
"type": "video",
|
297 |
+
"video": [
|
298 |
+
"file:///path/to/frame1.jpg",
|
299 |
+
"file:///path/to/frame2.jpg",
|
300 |
+
"file:///path/to/frame3.jpg",
|
301 |
+
"file:///path/to/frame4.jpg",
|
302 |
+
],
|
303 |
+
"fps": 1.0,
|
304 |
+
},
|
305 |
+
{"type": "text", "text": "Describe this video."},
|
306 |
+
],
|
307 |
+
}
|
308 |
+
]
|
309 |
+
# Messages containing a video and a text query
|
310 |
+
messages = [
|
311 |
+
{
|
312 |
+
"role": "user",
|
313 |
+
"content": [
|
314 |
+
{
|
315 |
+
"type": "video",
|
316 |
+
"video": "file:///path/to/video1.mp4",
|
317 |
+
"max_pixels": 360 * 420,
|
318 |
+
"fps": 1.0,
|
319 |
+
},
|
320 |
+
{"type": "text", "text": "Describe this video."},
|
321 |
+
],
|
322 |
+
}
|
323 |
+
]
|
324 |
+
|
325 |
+
# Preparation for inference
|
326 |
+
text = processor.apply_chat_template(
|
327 |
+
messages, tokenize=False, add_generation_prompt=True
|
328 |
+
)
|
329 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
330 |
+
inputs = processor(
|
331 |
+
text=[text],
|
332 |
+
images=image_inputs,
|
333 |
+
videos=video_inputs,
|
334 |
+
padding=True,
|
335 |
+
return_tensors="pt",
|
336 |
+
)
|
337 |
+
inputs = inputs.to("cuda")
|
338 |
+
|
339 |
+
# Inference
|
340 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
341 |
+
generated_ids_trimmed = [
|
342 |
+
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
343 |
+
]
|
344 |
+
output_text = processor.batch_decode(
|
345 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
346 |
+
)
|
347 |
+
print(output_text)
|
348 |
+
```
|
349 |
+
</details>
|
350 |
+
|
351 |
+
<details>
|
352 |
+
<summary>Batch inference</summary>
|
353 |
+
|
354 |
+
```python
|
355 |
+
# Sample messages for batch inference
|
356 |
+
messages1 = [
|
357 |
+
{
|
358 |
+
"role": "user",
|
359 |
+
"content": [
|
360 |
+
{"type": "image", "image": "file:///path/to/image1.jpg"},
|
361 |
+
{"type": "image", "image": "file:///path/to/image2.jpg"},
|
362 |
+
{"type": "text", "text": "What are the common elements in these pictures?"},
|
363 |
+
],
|
364 |
+
}
|
365 |
+
]
|
366 |
+
messages2 = [
|
367 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
368 |
+
{"role": "user", "content": "Who are you?"},
|
369 |
+
]
|
370 |
+
# Combine messages for batch processing
|
371 |
+
messages = [messages1, messages1]
|
372 |
+
|
373 |
+
# Preparation for batch inference
|
374 |
+
texts = [
|
375 |
+
processor.apply_chat_template(msg, tokenize=False, add_generation_prompt=True)
|
376 |
+
for msg in messages
|
377 |
+
]
|
378 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
379 |
+
inputs = processor(
|
380 |
+
text=texts,
|
381 |
+
images=image_inputs,
|
382 |
+
videos=video_inputs,
|
383 |
+
padding=True,
|
384 |
+
return_tensors="pt",
|
385 |
+
)
|
386 |
+
inputs = inputs.to("cuda")
|
387 |
+
|
388 |
+
# Batch Inference
|
389 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
390 |
+
generated_ids_trimmed = [
|
391 |
+
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
392 |
+
]
|
393 |
+
output_texts = processor.batch_decode(
|
394 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
395 |
+
)
|
396 |
+
print(output_texts)
|
397 |
+
```
|
398 |
+
</details>
|
399 |
+
|
400 |
+
### More Usage Tips
|
401 |
+
|
402 |
+
For input images, we support local files, base64, and URLs. For videos, we currently only support local files.
|
403 |
+
|
404 |
+
```python
|
405 |
+
# You can directly insert a local file path, a URL, or a base64-encoded image into the position where you want in the text.
|
406 |
+
## Local file path
|
407 |
+
messages = [
|
408 |
+
{
|
409 |
+
"role": "user",
|
410 |
+
"content": [
|
411 |
+
{"type": "image", "image": "file:///path/to/your/image.jpg"},
|
412 |
+
{"type": "text", "text": "Describe this image."},
|
413 |
+
],
|
414 |
+
}
|
415 |
+
]
|
416 |
+
## Image URL
|
417 |
+
messages = [
|
418 |
+
{
|
419 |
+
"role": "user",
|
420 |
+
"content": [
|
421 |
+
{"type": "image", "image": "http://path/to/your/image.jpg"},
|
422 |
+
{"type": "text", "text": "Describe this image."},
|
423 |
+
],
|
424 |
+
}
|
425 |
+
]
|
426 |
+
## Base64 encoded image
|
427 |
+
messages = [
|
428 |
+
{
|
429 |
+
"role": "user",
|
430 |
+
"content": [
|
431 |
+
{"type": "image", "image": "data:image;base64,/9j/..."},
|
432 |
+
{"type": "text", "text": "Describe this image."},
|
433 |
+
],
|
434 |
+
}
|
435 |
+
]
|
436 |
+
```
|
437 |
+
#### Image Resolution for performance boost
|
438 |
+
|
439 |
+
The model supports a wide range of resolution inputs. By default, it uses the native resolution for input, but higher resolutions can enhance performance at the cost of more computation. Users can set the minimum and maximum number of pixels to achieve an optimal configuration for their needs, such as a token count range of 256-1280, to balance speed and memory usage.
|
440 |
+
|
441 |
+
```python
|
442 |
+
min_pixels = 256 * 28 * 28
|
443 |
+
max_pixels = 1280 * 28 * 28
|
444 |
+
processor = AutoProcessor.from_pretrained(
|
445 |
+
"Qwen/Qwen2-VL-7B-Instruct-GPTQ-Int4", min_pixels=min_pixels, max_pixels=max_pixels
|
446 |
+
)
|
447 |
+
```
|
448 |
+
|
449 |
+
Besides, We provide two methods for fine-grained control over the image size input to the model:
|
450 |
+
|
451 |
+
1. Define min_pixels and max_pixels: Images will be resized to maintain their aspect ratio within the range of min_pixels and max_pixels.
|
452 |
+
|
453 |
+
2. Specify exact dimensions: Directly set `resized_height` and `resized_width`. These values will be rounded to the nearest multiple of 28.
|
454 |
+
|
455 |
+
```python
|
456 |
+
# min_pixels and max_pixels
|
457 |
+
messages = [
|
458 |
+
{
|
459 |
+
"role": "user",
|
460 |
+
"content": [
|
461 |
+
{
|
462 |
+
"type": "image",
|
463 |
+
"image": "file:///path/to/your/image.jpg",
|
464 |
+
"resized_height": 280,
|
465 |
+
"resized_width": 420,
|
466 |
+
},
|
467 |
+
{"type": "text", "text": "Describe this image."},
|
468 |
+
],
|
469 |
+
}
|
470 |
+
]
|
471 |
+
# resized_height and resized_width
|
472 |
+
messages = [
|
473 |
+
{
|
474 |
+
"role": "user",
|
475 |
+
"content": [
|
476 |
+
{
|
477 |
+
"type": "image",
|
478 |
+
"image": "file:///path/to/your/image.jpg",
|
479 |
+
"min_pixels": 50176,
|
480 |
+
"max_pixels": 50176,
|
481 |
+
},
|
482 |
+
{"type": "text", "text": "Describe this image."},
|
483 |
+
],
|
484 |
+
}
|
485 |
+
]
|
486 |
+
```
|
487 |
+
|
488 |
+
## Limitations
|
489 |
+
|
490 |
+
While Qwen2-VL are applicable to a wide range of visual tasks, it is equally important to understand its limitations. Here are some known restrictions:
|
491 |
+
|
492 |
+
1. Lack of Audio Support: The current model does **not comprehend audio information** within videos.
|
493 |
+
2. Data timeliness: Our image dataset is **updated until June 2023**, and information subsequent to this date may not be covered.
|
494 |
+
3. Constraints in Individuals and Intellectual Property (IP): The model's capacity to recognize specific individuals or IPs is limited, potentially failing to comprehensively cover all well-known personalities or brands.
|
495 |
+
4. Limited Capacity for Complex Instruction: When faced with intricate multi-step instructions, the model's understanding and execution capabilities require enhancement.
|
496 |
+
5. Insufficient Counting Accuracy: Particularly in complex scenes, the accuracy of object counting is not high, necessitating further improvements.
|
497 |
+
6. Weak Spatial Reasoning Skills: Especially in 3D spaces, the model's inference of object positional relationships is inadequate, making it difficult to precisely judge the relative positions of objects.
|
498 |
+
|
499 |
+
These limitations serve as ongoing directions for model optimization and improvement, and we are committed to continually enhancing the model's performance and scope of application.
|
500 |
+
|
501 |
+
|
502 |
+
## Citation
|
503 |
+
|
504 |
+
If you find our work helpful, feel free to give us a cite.
|
505 |
+
|
506 |
+
```
|
507 |
+
@article{Qwen2VL,
|
508 |
+
title={Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution},
|
509 |
+
author={Wang, Peng and Bai, Shuai and Tan, Sinan and Wang, Shijie and Fan, Zhihao and Bai, Jinze and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Fan, Yang and Dang, Kai and Du, Mengfei and Ren, Xuancheng and Men, Rui and Liu, Dayiheng and Zhou, Chang and Zhou, Jingren and Lin, Junyang},
|
510 |
+
journal={arXiv preprint arXiv:2409.12191},
|
511 |
+
year={2024}
|
512 |
+
}
|
513 |
+
|
514 |
+
@article{Qwen-VL,
|
515 |
+
title={Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond},
|
516 |
+
author={Bai, Jinze and Bai, Shuai and Yang, Shusheng and Wang, Shijie and Tan, Sinan and Wang, Peng and Lin, Junyang and Zhou, Chang and Zhou, Jingren},
|
517 |
+
journal={arXiv preprint arXiv:2308.12966},
|
518 |
+
year={2023}
|
519 |
+
}
|
520 |
+
```
|
added_tokens.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"<|box_end|>": 151649,
|
3 |
+
"<|box_start|>": 151648,
|
4 |
+
"<|endoftext|>": 151643,
|
5 |
+
"<|im_end|>": 151645,
|
6 |
+
"<|im_start|>": 151644,
|
7 |
+
"<|image_pad|>": 151655,
|
8 |
+
"<|object_ref_end|>": 151647,
|
9 |
+
"<|object_ref_start|>": 151646,
|
10 |
+
"<|quad_end|>": 151651,
|
11 |
+
"<|quad_start|>": 151650,
|
12 |
+
"<|video_pad|>": 151656,
|
13 |
+
"<|vision_end|>": 151653,
|
14 |
+
"<|vision_pad|>": 151654,
|
15 |
+
"<|vision_start|>": 151652
|
16 |
+
}
|
chat_template.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"
|
3 |
+
}
|
config.json
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "Qwen/Qwen2-VL-7B-Instruct-319-PRO",
|
3 |
+
"architectures": [
|
4 |
+
"Qwen2VLForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 151643,
|
8 |
+
"eos_token_id": 151645,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 3584,
|
11 |
+
"image_token_id": 151655,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 18944,
|
14 |
+
"max_position_embeddings": 32768,
|
15 |
+
"max_window_layers": 28,
|
16 |
+
"model_type": "qwen2_vl",
|
17 |
+
"num_attention_heads": 28,
|
18 |
+
"num_hidden_layers": 28,
|
19 |
+
"num_key_value_heads": 4,
|
20 |
+
"quantization_config": {
|
21 |
+
"bits": 4,
|
22 |
+
"damp_percent": 0.1,
|
23 |
+
"dataset": null,
|
24 |
+
"desc_act": false,
|
25 |
+
"group_size": 128,
|
26 |
+
"modules_in_block_to_quantize": null,
|
27 |
+
"quant_method": "gptq",
|
28 |
+
"sym": true,
|
29 |
+
"true_sequential": true
|
30 |
+
},
|
31 |
+
"rms_norm_eps": 1e-06,
|
32 |
+
"rope_scaling": {
|
33 |
+
"mrope_section": [
|
34 |
+
16,
|
35 |
+
24,
|
36 |
+
24
|
37 |
+
],
|
38 |
+
"type": "mrope"
|
39 |
+
},
|
40 |
+
"rope_theta": 1000000.0,
|
41 |
+
"sliding_window": 32768,
|
42 |
+
"tie_word_embeddings": false,
|
43 |
+
"torch_dtype": "float16",
|
44 |
+
"transformers_version": "4.45.0.dev0",
|
45 |
+
"use_cache": true,
|
46 |
+
"use_sliding_window": false,
|
47 |
+
"video_token_id": 151656,
|
48 |
+
"vision_config": {
|
49 |
+
"in_chans": 3,
|
50 |
+
"model_type": "qwen2_vl",
|
51 |
+
"spatial_patch_size": 14
|
52 |
+
},
|
53 |
+
"vision_end_token_id": 151653,
|
54 |
+
"vision_start_token_id": 151652,
|
55 |
+
"vision_token_id": 151654,
|
56 |
+
"vocab_size": 152064
|
57 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token_id": 151643,
|
3 |
+
"do_sample": true,
|
4 |
+
"eos_token_id": [
|
5 |
+
151645,
|
6 |
+
151643
|
7 |
+
],
|
8 |
+
"pad_token_id": 151643,
|
9 |
+
"repetition_penalty": 1.0,
|
10 |
+
"temperature": 0.01,
|
11 |
+
"top_k": 1,
|
12 |
+
"top_p": 0.001,
|
13 |
+
"transformers_version": "4.45.0.dev0"
|
14 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model-00001-of-00002.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:195211506e67a8dfe1a0556ee3c23a54279b5537fc8492f527f61dc586888ee9
|
3 |
+
size 3982678800
|
model-00002-of-00002.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4a29e3934dd9229fdd28c6b1b678f5b3b7826020183ea87a7a06ad13ff7efd20
|
3 |
+
size 2944261096
|
model.safetensors.index.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
preprocessor_config.json
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_convert_rgb": true,
|
3 |
+
"do_normalize": true,
|
4 |
+
"do_rescale": true,
|
5 |
+
"do_resize": true,
|
6 |
+
"image_mean": [
|
7 |
+
0.48145466,
|
8 |
+
0.4578275,
|
9 |
+
0.40821073
|
10 |
+
],
|
11 |
+
"image_processor_type": "Qwen2VLImageProcessor",
|
12 |
+
"image_std": [
|
13 |
+
0.26862954,
|
14 |
+
0.26130258,
|
15 |
+
0.27577711
|
16 |
+
],
|
17 |
+
"max_pixels": 12845056,
|
18 |
+
"merge_size": 2,
|
19 |
+
"min_pixels": 3136,
|
20 |
+
"patch_size": 14,
|
21 |
+
"processor_class": "Qwen2VLProcessor",
|
22 |
+
"resample": 3,
|
23 |
+
"rescale_factor": 0.00392156862745098,
|
24 |
+
"size": {
|
25 |
+
"max_pixels": 12845056,
|
26 |
+
"min_pixels": 3136
|
27 |
+
},
|
28 |
+
"temporal_patch_size": 2
|
29 |
+
}
|
quantize_config.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bits": 4,
|
3 |
+
"dataset": null,
|
4 |
+
"group_size": 128,
|
5 |
+
"damp_percent": 0.1,
|
6 |
+
"desc_act": false,
|
7 |
+
"sym": true,
|
8 |
+
"true_sequential": true,
|
9 |
+
"quant_method": "gptq",
|
10 |
+
"modules_in_block_to_quantize": null
|
11 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": [
|
3 |
+
"<|im_start|>",
|
4 |
+
"<|im_end|>",
|
5 |
+
"<|object_ref_start|>",
|
6 |
+
"<|object_ref_end|>",
|
7 |
+
"<|box_start|>",
|
8 |
+
"<|box_end|>",
|
9 |
+
"<|quad_start|>",
|
10 |
+
"<|quad_end|>",
|
11 |
+
"<|vision_start|>",
|
12 |
+
"<|vision_end|>",
|
13 |
+
"<|vision_pad|>",
|
14 |
+
"<|image_pad|>",
|
15 |
+
"<|video_pad|>"
|
16 |
+
],
|
17 |
+
"eos_token": {
|
18 |
+
"content": "<|im_end|>",
|
19 |
+
"lstrip": false,
|
20 |
+
"normalized": false,
|
21 |
+
"rstrip": false,
|
22 |
+
"single_word": false
|
23 |
+
},
|
24 |
+
"pad_token": {
|
25 |
+
"content": "<|endoftext|>",
|
26 |
+
"lstrip": false,
|
27 |
+
"normalized": false,
|
28 |
+
"rstrip": false,
|
29 |
+
"single_word": false
|
30 |
+
}
|
31 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"added_tokens_decoder": {
|
4 |
+
"151643": {
|
5 |
+
"content": "<|endoftext|>",
|
6 |
+
"lstrip": false,
|
7 |
+
"normalized": false,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false,
|
10 |
+
"special": true
|
11 |
+
},
|
12 |
+
"151644": {
|
13 |
+
"content": "<|im_start|>",
|
14 |
+
"lstrip": false,
|
15 |
+
"normalized": false,
|
16 |
+
"rstrip": false,
|
17 |
+
"single_word": false,
|
18 |
+
"special": true
|
19 |
+
},
|
20 |
+
"151645": {
|
21 |
+
"content": "<|im_end|>",
|
22 |
+
"lstrip": false,
|
23 |
+
"normalized": false,
|
24 |
+
"rstrip": false,
|
25 |
+
"single_word": false,
|
26 |
+
"special": true
|
27 |
+
},
|
28 |
+
"151646": {
|
29 |
+
"content": "<|object_ref_start|>",
|
30 |
+
"lstrip": false,
|
31 |
+
"normalized": false,
|
32 |
+
"rstrip": false,
|
33 |
+
"single_word": false,
|
34 |
+
"special": true
|
35 |
+
},
|
36 |
+
"151647": {
|
37 |
+
"content": "<|object_ref_end|>",
|
38 |
+
"lstrip": false,
|
39 |
+
"normalized": false,
|
40 |
+
"rstrip": false,
|
41 |
+
"single_word": false,
|
42 |
+
"special": true
|
43 |
+
},
|
44 |
+
"151648": {
|
45 |
+
"content": "<|box_start|>",
|
46 |
+
"lstrip": false,
|
47 |
+
"normalized": false,
|
48 |
+
"rstrip": false,
|
49 |
+
"single_word": false,
|
50 |
+
"special": true
|
51 |
+
},
|
52 |
+
"151649": {
|
53 |
+
"content": "<|box_end|>",
|
54 |
+
"lstrip": false,
|
55 |
+
"normalized": false,
|
56 |
+
"rstrip": false,
|
57 |
+
"single_word": false,
|
58 |
+
"special": true
|
59 |
+
},
|
60 |
+
"151650": {
|
61 |
+
"content": "<|quad_start|>",
|
62 |
+
"lstrip": false,
|
63 |
+
"normalized": false,
|
64 |
+
"rstrip": false,
|
65 |
+
"single_word": false,
|
66 |
+
"special": true
|
67 |
+
},
|
68 |
+
"151651": {
|
69 |
+
"content": "<|quad_end|>",
|
70 |
+
"lstrip": false,
|
71 |
+
"normalized": false,
|
72 |
+
"rstrip": false,
|
73 |
+
"single_word": false,
|
74 |
+
"special": true
|
75 |
+
},
|
76 |
+
"151652": {
|
77 |
+
"content": "<|vision_start|>",
|
78 |
+
"lstrip": false,
|
79 |
+
"normalized": false,
|
80 |
+
"rstrip": false,
|
81 |
+
"single_word": false,
|
82 |
+
"special": true
|
83 |
+
},
|
84 |
+
"151653": {
|
85 |
+
"content": "<|vision_end|>",
|
86 |
+
"lstrip": false,
|
87 |
+
"normalized": false,
|
88 |
+
"rstrip": false,
|
89 |
+
"single_word": false,
|
90 |
+
"special": true
|
91 |
+
},
|
92 |
+
"151654": {
|
93 |
+
"content": "<|vision_pad|>",
|
94 |
+
"lstrip": false,
|
95 |
+
"normalized": false,
|
96 |
+
"rstrip": false,
|
97 |
+
"single_word": false,
|
98 |
+
"special": true
|
99 |
+
},
|
100 |
+
"151655": {
|
101 |
+
"content": "<|image_pad|>",
|
102 |
+
"lstrip": false,
|
103 |
+
"normalized": false,
|
104 |
+
"rstrip": false,
|
105 |
+
"single_word": false,
|
106 |
+
"special": true
|
107 |
+
},
|
108 |
+
"151656": {
|
109 |
+
"content": "<|video_pad|>",
|
110 |
+
"lstrip": false,
|
111 |
+
"normalized": false,
|
112 |
+
"rstrip": false,
|
113 |
+
"single_word": false,
|
114 |
+
"special": true
|
115 |
+
}
|
116 |
+
},
|
117 |
+
"additional_special_tokens": [
|
118 |
+
"<|im_start|>",
|
119 |
+
"<|im_end|>",
|
120 |
+
"<|object_ref_start|>",
|
121 |
+
"<|object_ref_end|>",
|
122 |
+
"<|box_start|>",
|
123 |
+
"<|box_end|>",
|
124 |
+
"<|quad_start|>",
|
125 |
+
"<|quad_end|>",
|
126 |
+
"<|vision_start|>",
|
127 |
+
"<|vision_end|>",
|
128 |
+
"<|vision_pad|>",
|
129 |
+
"<|image_pad|>",
|
130 |
+
"<|video_pad|>"
|
131 |
+
],
|
132 |
+
"bos_token": null,
|
133 |
+
"chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}",
|
134 |
+
"clean_up_tokenization_spaces": false,
|
135 |
+
"eos_token": "<|im_end|>",
|
136 |
+
"errors": "replace",
|
137 |
+
"model_max_length": 32768,
|
138 |
+
"pad_token": "<|endoftext|>",
|
139 |
+
"padding_side": "left",
|
140 |
+
"processor_class": "Qwen2VLProcessor",
|
141 |
+
"split_special_tokens": false,
|
142 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
143 |
+
"unk_token": null
|
144 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|