LandyGuo
commited on
Commit
·
46e1d99
1
Parent(s):
0b78203
First model version
Browse files- connector/LICENSE +202 -0
- connector/README.md +69 -0
- connector/config.json +30 -0
- connector/generation_config.json +6 -0
- connector/merges.txt +0 -0
- connector/model.safetensors +3 -0
- connector/tokenizer.json +0 -0
- connector/tokenizer_config.json +207 -0
- connector/vocab.json +0 -0
- mlp/config.json +11 -0
- mlp/model.safetensors +3 -0
- qwen2_5_llm/LICENSE +202 -0
- qwen2_5_llm/README.md +1 -0
- qwen2_5_llm/config.json +41 -0
- qwen2_5_llm/generation_config.json +6 -0
- qwen2_5_llm/merges.txt +0 -0
- qwen2_5_llm/model-00001-of-00007.safetensors +3 -0
- qwen2_5_llm/model-00002-of-00007.safetensors +3 -0
- qwen2_5_llm/model-00003-of-00007.safetensors +3 -0
- qwen2_5_llm/model-00004-of-00007.safetensors +3 -0
- qwen2_5_llm/model-00005-of-00007.safetensors +3 -0
- qwen2_5_llm/model-00006-of-00007.safetensors +3 -0
- qwen2_5_llm/model-00007-of-00007.safetensors +3 -0
- qwen2_5_llm/model.safetensors.index.json +346 -0
- qwen2_5_llm/test.txt +0 -0
- qwen2_5_llm/tokenizer.json +0 -0
- qwen2_5_llm/tokenizer_config.json +207 -0
- qwen2_5_llm/vocab.json +0 -0
- qwen2_5_vit/config.json +33 -0
- qwen2_5_vit/configuration_qwen2_5_vit.py +78 -0
- qwen2_5_vit/model.safetensors +3 -0
- qwen2_5_vit/preprocessor_config.json +19 -0
- qwen2_5_vit/qwen2_5_vit.py +445 -0
- scheduler/scheduler_config.json +30 -0
- transformer/config.json +23 -0
- transformer/diffusion_pytorch_model.fp16.safetensors +3 -0
- transformer/diffusion_pytorch_model.safetensors +3 -0
- vae/config.json +89 -0
- vae/diffusion_pytorch_model.safetensors +3 -0
connector/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.
|
connector/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
license_link: https://huggingface.co/Qwen/Qwen2.5-0.5B/blob/main/LICENSE
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
library_name: transformers
|
8 |
+
---
|
9 |
+
|
10 |
+
# Qwen2.5-0.5B
|
11 |
+
|
12 |
+
## Introduction
|
13 |
+
|
14 |
+
Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. Qwen2.5 brings the following improvements upon Qwen2:
|
15 |
+
|
16 |
+
- Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
|
17 |
+
- Significant improvements in **instruction following**, **generating long texts** (over 8K tokens), **understanding structured data** (e.g, tables), and **generating structured outputs** especially JSON. **More resilient to the diversity of system prompts**, enhancing role-play implementation and condition-setting for chatbots.
|
18 |
+
- **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
|
19 |
+
- **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
|
20 |
+
|
21 |
+
**This repo contains the base 0.5B Qwen2.5 model**, which has the following features:
|
22 |
+
- Type: Causal Language Models
|
23 |
+
- Training Stage: Pretraining
|
24 |
+
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, Attention QKV bias and tied word embeddings
|
25 |
+
- Number of Parameters: 0.49B
|
26 |
+
- Number of Paramaters (Non-Embedding): 0.36B
|
27 |
+
- Number of Layers: 24
|
28 |
+
- Number of Attention Heads (GQA): 14 for Q and 2 for KV
|
29 |
+
- Context Length: Full 32,768 tokens
|
30 |
+
|
31 |
+
**We do not recommend using base language models for conversations.** Instead, you can apply post-training, e.g., SFT, RLHF, continued pretraining, etc., on this model.
|
32 |
+
|
33 |
+
For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5/), [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
|
34 |
+
|
35 |
+
## Requirements
|
36 |
+
|
37 |
+
The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
|
38 |
+
|
39 |
+
With `transformers<4.37.0`, you will encounter the following error:
|
40 |
+
```
|
41 |
+
KeyError: 'qwen2'
|
42 |
+
```
|
43 |
+
|
44 |
+
## Evaluation & Performance
|
45 |
+
|
46 |
+
Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
|
47 |
+
|
48 |
+
For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
|
49 |
+
|
50 |
+
## Citation
|
51 |
+
|
52 |
+
If you find our work helpful, feel free to give us a cite.
|
53 |
+
|
54 |
+
```
|
55 |
+
@misc{qwen2.5,
|
56 |
+
title = {Qwen2.5: A Party of Foundation Models},
|
57 |
+
url = {https://qwenlm.github.io/blog/qwen2.5/},
|
58 |
+
author = {Qwen Team},
|
59 |
+
month = {September},
|
60 |
+
year = {2024}
|
61 |
+
}
|
62 |
+
|
63 |
+
@article{qwen2,
|
64 |
+
title={Qwen2 Technical Report},
|
65 |
+
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
|
66 |
+
journal={arXiv preprint arXiv:2407.10671},
|
67 |
+
year={2024}
|
68 |
+
}
|
69 |
+
```
|
connector/config.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/video_hy2/modelzoo/Qwen__Qwen2.5-0.5B",
|
3 |
+
"architectures": [
|
4 |
+
"Qwen2ForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 151643,
|
8 |
+
"eos_token_id": 151643,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 896,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 4864,
|
13 |
+
"max_position_embeddings": 32768,
|
14 |
+
"max_window_layers": 24,
|
15 |
+
"model_type": "qwen2",
|
16 |
+
"num_attention_heads": 14,
|
17 |
+
"num_hidden_layers": 24,
|
18 |
+
"num_key_value_heads": 2,
|
19 |
+
"rms_norm_eps": 1e-06,
|
20 |
+
"rope_scaling": null,
|
21 |
+
"rope_theta": 1000000.0,
|
22 |
+
"sliding_window": null,
|
23 |
+
"tie_word_embeddings": true,
|
24 |
+
"torch_dtype": "float32",
|
25 |
+
"transformers_version": "4.46.3",
|
26 |
+
"use_cache": true,
|
27 |
+
"use_mrope": false,
|
28 |
+
"use_sliding_window": false,
|
29 |
+
"vocab_size": 151936
|
30 |
+
}
|
connector/generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token_id": 151643,
|
3 |
+
"eos_token_id": 151643,
|
4 |
+
"max_new_tokens": 2048,
|
5 |
+
"transformers_version": "4.46.3"
|
6 |
+
}
|
connector/merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
connector/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7f4ce916421da0b3fc131d318f567e6c6e52608af7cf03b55bd130c1bce0feda
|
3 |
+
size 1976163472
|
connector/tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
connector/tokenizer_config.json
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": false,
|
3 |
+
"add_prefix_space": false,
|
4 |
+
"added_tokens_decoder": {
|
5 |
+
"151643": {
|
6 |
+
"content": "<|endoftext|>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false,
|
11 |
+
"special": true
|
12 |
+
},
|
13 |
+
"151644": {
|
14 |
+
"content": "<|im_start|>",
|
15 |
+
"lstrip": false,
|
16 |
+
"normalized": false,
|
17 |
+
"rstrip": false,
|
18 |
+
"single_word": false,
|
19 |
+
"special": true
|
20 |
+
},
|
21 |
+
"151645": {
|
22 |
+
"content": "<|im_end|>",
|
23 |
+
"lstrip": false,
|
24 |
+
"normalized": false,
|
25 |
+
"rstrip": false,
|
26 |
+
"single_word": false,
|
27 |
+
"special": true
|
28 |
+
},
|
29 |
+
"151646": {
|
30 |
+
"content": "<|object_ref_start|>",
|
31 |
+
"lstrip": false,
|
32 |
+
"normalized": false,
|
33 |
+
"rstrip": false,
|
34 |
+
"single_word": false,
|
35 |
+
"special": true
|
36 |
+
},
|
37 |
+
"151647": {
|
38 |
+
"content": "<|object_ref_end|>",
|
39 |
+
"lstrip": false,
|
40 |
+
"normalized": false,
|
41 |
+
"rstrip": false,
|
42 |
+
"single_word": false,
|
43 |
+
"special": true
|
44 |
+
},
|
45 |
+
"151648": {
|
46 |
+
"content": "<|box_start|>",
|
47 |
+
"lstrip": false,
|
48 |
+
"normalized": false,
|
49 |
+
"rstrip": false,
|
50 |
+
"single_word": false,
|
51 |
+
"special": true
|
52 |
+
},
|
53 |
+
"151649": {
|
54 |
+
"content": "<|box_end|>",
|
55 |
+
"lstrip": false,
|
56 |
+
"normalized": false,
|
57 |
+
"rstrip": false,
|
58 |
+
"single_word": false,
|
59 |
+
"special": true
|
60 |
+
},
|
61 |
+
"151650": {
|
62 |
+
"content": "<|quad_start|>",
|
63 |
+
"lstrip": false,
|
64 |
+
"normalized": false,
|
65 |
+
"rstrip": false,
|
66 |
+
"single_word": false,
|
67 |
+
"special": true
|
68 |
+
},
|
69 |
+
"151651": {
|
70 |
+
"content": "<|quad_end|>",
|
71 |
+
"lstrip": false,
|
72 |
+
"normalized": false,
|
73 |
+
"rstrip": false,
|
74 |
+
"single_word": false,
|
75 |
+
"special": true
|
76 |
+
},
|
77 |
+
"151652": {
|
78 |
+
"content": "<|vision_start|>",
|
79 |
+
"lstrip": false,
|
80 |
+
"normalized": false,
|
81 |
+
"rstrip": false,
|
82 |
+
"single_word": false,
|
83 |
+
"special": true
|
84 |
+
},
|
85 |
+
"151653": {
|
86 |
+
"content": "<|vision_end|>",
|
87 |
+
"lstrip": false,
|
88 |
+
"normalized": false,
|
89 |
+
"rstrip": false,
|
90 |
+
"single_word": false,
|
91 |
+
"special": true
|
92 |
+
},
|
93 |
+
"151654": {
|
94 |
+
"content": "<|vision_pad|>",
|
95 |
+
"lstrip": false,
|
96 |
+
"normalized": false,
|
97 |
+
"rstrip": false,
|
98 |
+
"single_word": false,
|
99 |
+
"special": true
|
100 |
+
},
|
101 |
+
"151655": {
|
102 |
+
"content": "<|image_pad|>",
|
103 |
+
"lstrip": false,
|
104 |
+
"normalized": false,
|
105 |
+
"rstrip": false,
|
106 |
+
"single_word": false,
|
107 |
+
"special": true
|
108 |
+
},
|
109 |
+
"151656": {
|
110 |
+
"content": "<|video_pad|>",
|
111 |
+
"lstrip": false,
|
112 |
+
"normalized": false,
|
113 |
+
"rstrip": false,
|
114 |
+
"single_word": false,
|
115 |
+
"special": true
|
116 |
+
},
|
117 |
+
"151657": {
|
118 |
+
"content": "<tool_call>",
|
119 |
+
"lstrip": false,
|
120 |
+
"normalized": false,
|
121 |
+
"rstrip": false,
|
122 |
+
"single_word": false,
|
123 |
+
"special": false
|
124 |
+
},
|
125 |
+
"151658": {
|
126 |
+
"content": "</tool_call>",
|
127 |
+
"lstrip": false,
|
128 |
+
"normalized": false,
|
129 |
+
"rstrip": false,
|
130 |
+
"single_word": false,
|
131 |
+
"special": false
|
132 |
+
},
|
133 |
+
"151659": {
|
134 |
+
"content": "<|fim_prefix|>",
|
135 |
+
"lstrip": false,
|
136 |
+
"normalized": false,
|
137 |
+
"rstrip": false,
|
138 |
+
"single_word": false,
|
139 |
+
"special": false
|
140 |
+
},
|
141 |
+
"151660": {
|
142 |
+
"content": "<|fim_middle|>",
|
143 |
+
"lstrip": false,
|
144 |
+
"normalized": false,
|
145 |
+
"rstrip": false,
|
146 |
+
"single_word": false,
|
147 |
+
"special": false
|
148 |
+
},
|
149 |
+
"151661": {
|
150 |
+
"content": "<|fim_suffix|>",
|
151 |
+
"lstrip": false,
|
152 |
+
"normalized": false,
|
153 |
+
"rstrip": false,
|
154 |
+
"single_word": false,
|
155 |
+
"special": false
|
156 |
+
},
|
157 |
+
"151662": {
|
158 |
+
"content": "<|fim_pad|>",
|
159 |
+
"lstrip": false,
|
160 |
+
"normalized": false,
|
161 |
+
"rstrip": false,
|
162 |
+
"single_word": false,
|
163 |
+
"special": false
|
164 |
+
},
|
165 |
+
"151663": {
|
166 |
+
"content": "<|repo_name|>",
|
167 |
+
"lstrip": false,
|
168 |
+
"normalized": false,
|
169 |
+
"rstrip": false,
|
170 |
+
"single_word": false,
|
171 |
+
"special": false
|
172 |
+
},
|
173 |
+
"151664": {
|
174 |
+
"content": "<|file_sep|>",
|
175 |
+
"lstrip": false,
|
176 |
+
"normalized": false,
|
177 |
+
"rstrip": false,
|
178 |
+
"single_word": false,
|
179 |
+
"special": false
|
180 |
+
}
|
181 |
+
},
|
182 |
+
"additional_special_tokens": [
|
183 |
+
"<|im_start|>",
|
184 |
+
"<|im_end|>",
|
185 |
+
"<|object_ref_start|>",
|
186 |
+
"<|object_ref_end|>",
|
187 |
+
"<|box_start|>",
|
188 |
+
"<|box_end|>",
|
189 |
+
"<|quad_start|>",
|
190 |
+
"<|quad_end|>",
|
191 |
+
"<|vision_start|>",
|
192 |
+
"<|vision_end|>",
|
193 |
+
"<|vision_pad|>",
|
194 |
+
"<|image_pad|>",
|
195 |
+
"<|video_pad|>"
|
196 |
+
],
|
197 |
+
"bos_token": null,
|
198 |
+
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
|
199 |
+
"clean_up_tokenization_spaces": false,
|
200 |
+
"eos_token": "<|endoftext|>",
|
201 |
+
"errors": "replace",
|
202 |
+
"model_max_length": 131072,
|
203 |
+
"pad_token": "<|endoftext|>",
|
204 |
+
"split_special_tokens": false,
|
205 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
206 |
+
"unk_token": null
|
207 |
+
}
|
connector/vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
mlp/config.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"hidden_dim": 2240,
|
3 |
+
"mid_hidden_dim": 4480,
|
4 |
+
"output_dim": 32,
|
5 |
+
"activation": "gelu",
|
6 |
+
"layer_norm_eps": 1e-05,
|
7 |
+
"initializer_range": 0.02,
|
8 |
+
"architectures": [
|
9 |
+
"CustomMidLayerMLPModel"
|
10 |
+
]
|
11 |
+
}
|
mlp/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9ee913fc74aeb449096aa59ab6a043f99dbbf5b811630779b0e0f1920c1c893a
|
3 |
+
size 247662768
|
qwen2_5_llm/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.
|
qwen2_5_llm/README.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
specified path for models download from hugging face
|
qwen2_5_llm/config.json
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"Qwen2ForCausalLM"
|
4 |
+
],
|
5 |
+
"attention_dropout": 0.0,
|
6 |
+
"audio_id_shift": 151699,
|
7 |
+
"audio_vocab_size": 4099,
|
8 |
+
"bos_token_id": 151643,
|
9 |
+
"eos_token_id": 151645,
|
10 |
+
"hidden_act": "silu",
|
11 |
+
"hidden_size": 3584,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 18944,
|
14 |
+
"max_position_embeddings": 32768,
|
15 |
+
"max_window_layers": 28,
|
16 |
+
"model_type": "qwen2",
|
17 |
+
"num_attention_heads": 28,
|
18 |
+
"num_hidden_layers": 28,
|
19 |
+
"num_key_value_heads": 4,
|
20 |
+
"rms_norm_eps": 1e-06,
|
21 |
+
"rope_scaling": {
|
22 |
+
"mrope_section": [
|
23 |
+
16,
|
24 |
+
24,
|
25 |
+
24
|
26 |
+
],
|
27 |
+
"rope_type": "default",
|
28 |
+
"type": "default"
|
29 |
+
},
|
30 |
+
"rope_theta": 1000000.0,
|
31 |
+
"sliding_window": null,
|
32 |
+
"spatial_merge_size": 2,
|
33 |
+
"tie_word_embeddings": false,
|
34 |
+
"tokens_per_second": 2,
|
35 |
+
"torch_dtype": "float32",
|
36 |
+
"transformers_version": "4.46.3",
|
37 |
+
"use_cache": true,
|
38 |
+
"use_llm_3drope": true,
|
39 |
+
"use_sliding_window": false,
|
40 |
+
"vocab_size": 152064
|
41 |
+
}
|
qwen2_5_llm/generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 151643,
|
4 |
+
"eos_token_id": 151645,
|
5 |
+
"transformers_version": "4.46.3"
|
6 |
+
}
|
qwen2_5_llm/merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
qwen2_5_llm/model-00001-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:affff9b2b380664371804c5c71d9127ad2169e9b7f8e87b308644a3b999eb5bd
|
3 |
+
size 4976687216
|
qwen2_5_llm/model-00002-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b57594804eb796a36e3977589182e114c1a500814ee8b6ee68e2c817974144ed
|
3 |
+
size 4778622352
|
qwen2_5_llm/model-00003-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b4c802eea42b73a988e54828ffe7c65f1dc0bbac90a96640f8113eaad3a74d61
|
3 |
+
size 4932743960
|
qwen2_5_llm/model-00004-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1c3b76b47b807df47ae650949e50f88e269cbbd0571c51fabd6c072f16d45e53
|
3 |
+
size 4932743992
|
qwen2_5_llm/model-00005-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ff6877c1f51168e5493fbc10f3a9465b9b3ce0de928f3df3fe3f32fea975055
|
3 |
+
size 4998852296
|
qwen2_5_llm/model-00006-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e3e6942502e3743fc9a3adcce8ccc9236abd2add94abf04a3f8d83371b20ba67
|
3 |
+
size 3662865184
|
qwen2_5_llm/model-00007-of-00007.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:775304ee84a94ee825f423655fb6ce8ff77657531b352c7c707d999eed8f107b
|
3 |
+
size 2179989632
|
qwen2_5_llm/model.safetensors.index.json
ADDED
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 30462466048
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"lm_head.weight": "model-00007-of-00007.safetensors",
|
7 |
+
"model.embed_tokens.weight": "model-00001-of-00007.safetensors",
|
8 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00007.safetensors",
|
9 |
+
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00007.safetensors",
|
10 |
+
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00007.safetensors",
|
11 |
+
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00007.safetensors",
|
12 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00007.safetensors",
|
13 |
+
"model.layers.0.self_attn.k_proj.bias": "model-00001-of-00007.safetensors",
|
14 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00007.safetensors",
|
15 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00007.safetensors",
|
16 |
+
"model.layers.0.self_attn.q_proj.bias": "model-00001-of-00007.safetensors",
|
17 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00007.safetensors",
|
18 |
+
"model.layers.0.self_attn.v_proj.bias": "model-00001-of-00007.safetensors",
|
19 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00007.safetensors",
|
20 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00007.safetensors",
|
21 |
+
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00007.safetensors",
|
22 |
+
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00007.safetensors",
|
23 |
+
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00007.safetensors",
|
24 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00007.safetensors",
|
25 |
+
"model.layers.1.self_attn.k_proj.bias": "model-00001-of-00007.safetensors",
|
26 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00007.safetensors",
|
27 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00007.safetensors",
|
28 |
+
"model.layers.1.self_attn.q_proj.bias": "model-00001-of-00007.safetensors",
|
29 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00007.safetensors",
|
30 |
+
"model.layers.1.self_attn.v_proj.bias": "model-00001-of-00007.safetensors",
|
31 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00007.safetensors",
|
32 |
+
"model.layers.10.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
33 |
+
"model.layers.10.mlp.down_proj.weight": "model-00003-of-00007.safetensors",
|
34 |
+
"model.layers.10.mlp.gate_proj.weight": "model-00003-of-00007.safetensors",
|
35 |
+
"model.layers.10.mlp.up_proj.weight": "model-00003-of-00007.safetensors",
|
36 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
37 |
+
"model.layers.10.self_attn.k_proj.bias": "model-00003-of-00007.safetensors",
|
38 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00003-of-00007.safetensors",
|
39 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00003-of-00007.safetensors",
|
40 |
+
"model.layers.10.self_attn.q_proj.bias": "model-00003-of-00007.safetensors",
|
41 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00003-of-00007.safetensors",
|
42 |
+
"model.layers.10.self_attn.v_proj.bias": "model-00003-of-00007.safetensors",
|
43 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00003-of-00007.safetensors",
|
44 |
+
"model.layers.11.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
45 |
+
"model.layers.11.mlp.down_proj.weight": "model-00003-of-00007.safetensors",
|
46 |
+
"model.layers.11.mlp.gate_proj.weight": "model-00003-of-00007.safetensors",
|
47 |
+
"model.layers.11.mlp.up_proj.weight": "model-00003-of-00007.safetensors",
|
48 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
49 |
+
"model.layers.11.self_attn.k_proj.bias": "model-00003-of-00007.safetensors",
|
50 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00003-of-00007.safetensors",
|
51 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00003-of-00007.safetensors",
|
52 |
+
"model.layers.11.self_attn.q_proj.bias": "model-00003-of-00007.safetensors",
|
53 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00003-of-00007.safetensors",
|
54 |
+
"model.layers.11.self_attn.v_proj.bias": "model-00003-of-00007.safetensors",
|
55 |
+
"model.layers.11.self_attn.v_proj.weight": "model-00003-of-00007.safetensors",
|
56 |
+
"model.layers.12.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
57 |
+
"model.layers.12.mlp.down_proj.weight": "model-00003-of-00007.safetensors",
|
58 |
+
"model.layers.12.mlp.gate_proj.weight": "model-00003-of-00007.safetensors",
|
59 |
+
"model.layers.12.mlp.up_proj.weight": "model-00003-of-00007.safetensors",
|
60 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
61 |
+
"model.layers.12.self_attn.k_proj.bias": "model-00003-of-00007.safetensors",
|
62 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00003-of-00007.safetensors",
|
63 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00003-of-00007.safetensors",
|
64 |
+
"model.layers.12.self_attn.q_proj.bias": "model-00003-of-00007.safetensors",
|
65 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00003-of-00007.safetensors",
|
66 |
+
"model.layers.12.self_attn.v_proj.bias": "model-00003-of-00007.safetensors",
|
67 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00003-of-00007.safetensors",
|
68 |
+
"model.layers.13.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
69 |
+
"model.layers.13.mlp.down_proj.weight": "model-00004-of-00007.safetensors",
|
70 |
+
"model.layers.13.mlp.gate_proj.weight": "model-00003-of-00007.safetensors",
|
71 |
+
"model.layers.13.mlp.up_proj.weight": "model-00004-of-00007.safetensors",
|
72 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
73 |
+
"model.layers.13.self_attn.k_proj.bias": "model-00003-of-00007.safetensors",
|
74 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00003-of-00007.safetensors",
|
75 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00003-of-00007.safetensors",
|
76 |
+
"model.layers.13.self_attn.q_proj.bias": "model-00003-of-00007.safetensors",
|
77 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00003-of-00007.safetensors",
|
78 |
+
"model.layers.13.self_attn.v_proj.bias": "model-00003-of-00007.safetensors",
|
79 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00003-of-00007.safetensors",
|
80 |
+
"model.layers.14.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
81 |
+
"model.layers.14.mlp.down_proj.weight": "model-00004-of-00007.safetensors",
|
82 |
+
"model.layers.14.mlp.gate_proj.weight": "model-00004-of-00007.safetensors",
|
83 |
+
"model.layers.14.mlp.up_proj.weight": "model-00004-of-00007.safetensors",
|
84 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
85 |
+
"model.layers.14.self_attn.k_proj.bias": "model-00004-of-00007.safetensors",
|
86 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00004-of-00007.safetensors",
|
87 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00004-of-00007.safetensors",
|
88 |
+
"model.layers.14.self_attn.q_proj.bias": "model-00004-of-00007.safetensors",
|
89 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00004-of-00007.safetensors",
|
90 |
+
"model.layers.14.self_attn.v_proj.bias": "model-00004-of-00007.safetensors",
|
91 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00004-of-00007.safetensors",
|
92 |
+
"model.layers.15.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
93 |
+
"model.layers.15.mlp.down_proj.weight": "model-00004-of-00007.safetensors",
|
94 |
+
"model.layers.15.mlp.gate_proj.weight": "model-00004-of-00007.safetensors",
|
95 |
+
"model.layers.15.mlp.up_proj.weight": "model-00004-of-00007.safetensors",
|
96 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
97 |
+
"model.layers.15.self_attn.k_proj.bias": "model-00004-of-00007.safetensors",
|
98 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00004-of-00007.safetensors",
|
99 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00004-of-00007.safetensors",
|
100 |
+
"model.layers.15.self_attn.q_proj.bias": "model-00004-of-00007.safetensors",
|
101 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00004-of-00007.safetensors",
|
102 |
+
"model.layers.15.self_attn.v_proj.bias": "model-00004-of-00007.safetensors",
|
103 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00004-of-00007.safetensors",
|
104 |
+
"model.layers.16.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
105 |
+
"model.layers.16.mlp.down_proj.weight": "model-00004-of-00007.safetensors",
|
106 |
+
"model.layers.16.mlp.gate_proj.weight": "model-00004-of-00007.safetensors",
|
107 |
+
"model.layers.16.mlp.up_proj.weight": "model-00004-of-00007.safetensors",
|
108 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
109 |
+
"model.layers.16.self_attn.k_proj.bias": "model-00004-of-00007.safetensors",
|
110 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00004-of-00007.safetensors",
|
111 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00004-of-00007.safetensors",
|
112 |
+
"model.layers.16.self_attn.q_proj.bias": "model-00004-of-00007.safetensors",
|
113 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00004-of-00007.safetensors",
|
114 |
+
"model.layers.16.self_attn.v_proj.bias": "model-00004-of-00007.safetensors",
|
115 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00004-of-00007.safetensors",
|
116 |
+
"model.layers.17.input_layernorm.weight": "model-00004-of-00007.safetensors",
|
117 |
+
"model.layers.17.mlp.down_proj.weight": "model-00004-of-00007.safetensors",
|
118 |
+
"model.layers.17.mlp.gate_proj.weight": "model-00004-of-00007.safetensors",
|
119 |
+
"model.layers.17.mlp.up_proj.weight": "model-00004-of-00007.safetensors",
|
120 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00004-of-00007.safetensors",
|
121 |
+
"model.layers.17.self_attn.k_proj.bias": "model-00004-of-00007.safetensors",
|
122 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00004-of-00007.safetensors",
|
123 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00004-of-00007.safetensors",
|
124 |
+
"model.layers.17.self_attn.q_proj.bias": "model-00004-of-00007.safetensors",
|
125 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00004-of-00007.safetensors",
|
126 |
+
"model.layers.17.self_attn.v_proj.bias": "model-00004-of-00007.safetensors",
|
127 |
+
"model.layers.17.self_attn.v_proj.weight": "model-00004-of-00007.safetensors",
|
128 |
+
"model.layers.18.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
129 |
+
"model.layers.18.mlp.down_proj.weight": "model-00005-of-00007.safetensors",
|
130 |
+
"model.layers.18.mlp.gate_proj.weight": "model-00004-of-00007.safetensors",
|
131 |
+
"model.layers.18.mlp.up_proj.weight": "model-00004-of-00007.safetensors",
|
132 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
133 |
+
"model.layers.18.self_attn.k_proj.bias": "model-00004-of-00007.safetensors",
|
134 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00004-of-00007.safetensors",
|
135 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00004-of-00007.safetensors",
|
136 |
+
"model.layers.18.self_attn.q_proj.bias": "model-00004-of-00007.safetensors",
|
137 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00004-of-00007.safetensors",
|
138 |
+
"model.layers.18.self_attn.v_proj.bias": "model-00004-of-00007.safetensors",
|
139 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00004-of-00007.safetensors",
|
140 |
+
"model.layers.19.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
141 |
+
"model.layers.19.mlp.down_proj.weight": "model-00005-of-00007.safetensors",
|
142 |
+
"model.layers.19.mlp.gate_proj.weight": "model-00005-of-00007.safetensors",
|
143 |
+
"model.layers.19.mlp.up_proj.weight": "model-00005-of-00007.safetensors",
|
144 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
145 |
+
"model.layers.19.self_attn.k_proj.bias": "model-00005-of-00007.safetensors",
|
146 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00005-of-00007.safetensors",
|
147 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00005-of-00007.safetensors",
|
148 |
+
"model.layers.19.self_attn.q_proj.bias": "model-00005-of-00007.safetensors",
|
149 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00005-of-00007.safetensors",
|
150 |
+
"model.layers.19.self_attn.v_proj.bias": "model-00005-of-00007.safetensors",
|
151 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00005-of-00007.safetensors",
|
152 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00007.safetensors",
|
153 |
+
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00007.safetensors",
|
154 |
+
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00007.safetensors",
|
155 |
+
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00007.safetensors",
|
156 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00007.safetensors",
|
157 |
+
"model.layers.2.self_attn.k_proj.bias": "model-00001-of-00007.safetensors",
|
158 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00007.safetensors",
|
159 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00007.safetensors",
|
160 |
+
"model.layers.2.self_attn.q_proj.bias": "model-00001-of-00007.safetensors",
|
161 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00007.safetensors",
|
162 |
+
"model.layers.2.self_attn.v_proj.bias": "model-00001-of-00007.safetensors",
|
163 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00007.safetensors",
|
164 |
+
"model.layers.20.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
165 |
+
"model.layers.20.mlp.down_proj.weight": "model-00005-of-00007.safetensors",
|
166 |
+
"model.layers.20.mlp.gate_proj.weight": "model-00005-of-00007.safetensors",
|
167 |
+
"model.layers.20.mlp.up_proj.weight": "model-00005-of-00007.safetensors",
|
168 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
169 |
+
"model.layers.20.self_attn.k_proj.bias": "model-00005-of-00007.safetensors",
|
170 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00005-of-00007.safetensors",
|
171 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00005-of-00007.safetensors",
|
172 |
+
"model.layers.20.self_attn.q_proj.bias": "model-00005-of-00007.safetensors",
|
173 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00005-of-00007.safetensors",
|
174 |
+
"model.layers.20.self_attn.v_proj.bias": "model-00005-of-00007.safetensors",
|
175 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00005-of-00007.safetensors",
|
176 |
+
"model.layers.21.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
177 |
+
"model.layers.21.mlp.down_proj.weight": "model-00005-of-00007.safetensors",
|
178 |
+
"model.layers.21.mlp.gate_proj.weight": "model-00005-of-00007.safetensors",
|
179 |
+
"model.layers.21.mlp.up_proj.weight": "model-00005-of-00007.safetensors",
|
180 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
181 |
+
"model.layers.21.self_attn.k_proj.bias": "model-00005-of-00007.safetensors",
|
182 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00005-of-00007.safetensors",
|
183 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00005-of-00007.safetensors",
|
184 |
+
"model.layers.21.self_attn.q_proj.bias": "model-00005-of-00007.safetensors",
|
185 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00005-of-00007.safetensors",
|
186 |
+
"model.layers.21.self_attn.v_proj.bias": "model-00005-of-00007.safetensors",
|
187 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00005-of-00007.safetensors",
|
188 |
+
"model.layers.22.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
189 |
+
"model.layers.22.mlp.down_proj.weight": "model-00005-of-00007.safetensors",
|
190 |
+
"model.layers.22.mlp.gate_proj.weight": "model-00005-of-00007.safetensors",
|
191 |
+
"model.layers.22.mlp.up_proj.weight": "model-00005-of-00007.safetensors",
|
192 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
193 |
+
"model.layers.22.self_attn.k_proj.bias": "model-00005-of-00007.safetensors",
|
194 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00005-of-00007.safetensors",
|
195 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00005-of-00007.safetensors",
|
196 |
+
"model.layers.22.self_attn.q_proj.bias": "model-00005-of-00007.safetensors",
|
197 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00005-of-00007.safetensors",
|
198 |
+
"model.layers.22.self_attn.v_proj.bias": "model-00005-of-00007.safetensors",
|
199 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00005-of-00007.safetensors",
|
200 |
+
"model.layers.23.input_layernorm.weight": "model-00005-of-00007.safetensors",
|
201 |
+
"model.layers.23.mlp.down_proj.weight": "model-00005-of-00007.safetensors",
|
202 |
+
"model.layers.23.mlp.gate_proj.weight": "model-00005-of-00007.safetensors",
|
203 |
+
"model.layers.23.mlp.up_proj.weight": "model-00005-of-00007.safetensors",
|
204 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00005-of-00007.safetensors",
|
205 |
+
"model.layers.23.self_attn.k_proj.bias": "model-00005-of-00007.safetensors",
|
206 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00005-of-00007.safetensors",
|
207 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00005-of-00007.safetensors",
|
208 |
+
"model.layers.23.self_attn.q_proj.bias": "model-00005-of-00007.safetensors",
|
209 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00005-of-00007.safetensors",
|
210 |
+
"model.layers.23.self_attn.v_proj.bias": "model-00005-of-00007.safetensors",
|
211 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00005-of-00007.safetensors",
|
212 |
+
"model.layers.24.input_layernorm.weight": "model-00006-of-00007.safetensors",
|
213 |
+
"model.layers.24.mlp.down_proj.weight": "model-00006-of-00007.safetensors",
|
214 |
+
"model.layers.24.mlp.gate_proj.weight": "model-00006-of-00007.safetensors",
|
215 |
+
"model.layers.24.mlp.up_proj.weight": "model-00006-of-00007.safetensors",
|
216 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
217 |
+
"model.layers.24.self_attn.k_proj.bias": "model-00005-of-00007.safetensors",
|
218 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00005-of-00007.safetensors",
|
219 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00006-of-00007.safetensors",
|
220 |
+
"model.layers.24.self_attn.q_proj.bias": "model-00005-of-00007.safetensors",
|
221 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00005-of-00007.safetensors",
|
222 |
+
"model.layers.24.self_attn.v_proj.bias": "model-00005-of-00007.safetensors",
|
223 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00005-of-00007.safetensors",
|
224 |
+
"model.layers.25.input_layernorm.weight": "model-00006-of-00007.safetensors",
|
225 |
+
"model.layers.25.mlp.down_proj.weight": "model-00006-of-00007.safetensors",
|
226 |
+
"model.layers.25.mlp.gate_proj.weight": "model-00006-of-00007.safetensors",
|
227 |
+
"model.layers.25.mlp.up_proj.weight": "model-00006-of-00007.safetensors",
|
228 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
229 |
+
"model.layers.25.self_attn.k_proj.bias": "model-00006-of-00007.safetensors",
|
230 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00006-of-00007.safetensors",
|
231 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00006-of-00007.safetensors",
|
232 |
+
"model.layers.25.self_attn.q_proj.bias": "model-00006-of-00007.safetensors",
|
233 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00006-of-00007.safetensors",
|
234 |
+
"model.layers.25.self_attn.v_proj.bias": "model-00006-of-00007.safetensors",
|
235 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00006-of-00007.safetensors",
|
236 |
+
"model.layers.26.input_layernorm.weight": "model-00006-of-00007.safetensors",
|
237 |
+
"model.layers.26.mlp.down_proj.weight": "model-00006-of-00007.safetensors",
|
238 |
+
"model.layers.26.mlp.gate_proj.weight": "model-00006-of-00007.safetensors",
|
239 |
+
"model.layers.26.mlp.up_proj.weight": "model-00006-of-00007.safetensors",
|
240 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
241 |
+
"model.layers.26.self_attn.k_proj.bias": "model-00006-of-00007.safetensors",
|
242 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00006-of-00007.safetensors",
|
243 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00006-of-00007.safetensors",
|
244 |
+
"model.layers.26.self_attn.q_proj.bias": "model-00006-of-00007.safetensors",
|
245 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00006-of-00007.safetensors",
|
246 |
+
"model.layers.26.self_attn.v_proj.bias": "model-00006-of-00007.safetensors",
|
247 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00006-of-00007.safetensors",
|
248 |
+
"model.layers.27.input_layernorm.weight": "model-00006-of-00007.safetensors",
|
249 |
+
"model.layers.27.mlp.down_proj.weight": "model-00006-of-00007.safetensors",
|
250 |
+
"model.layers.27.mlp.gate_proj.weight": "model-00006-of-00007.safetensors",
|
251 |
+
"model.layers.27.mlp.up_proj.weight": "model-00006-of-00007.safetensors",
|
252 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00006-of-00007.safetensors",
|
253 |
+
"model.layers.27.self_attn.k_proj.bias": "model-00006-of-00007.safetensors",
|
254 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00006-of-00007.safetensors",
|
255 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00006-of-00007.safetensors",
|
256 |
+
"model.layers.27.self_attn.q_proj.bias": "model-00006-of-00007.safetensors",
|
257 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00006-of-00007.safetensors",
|
258 |
+
"model.layers.27.self_attn.v_proj.bias": "model-00006-of-00007.safetensors",
|
259 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00006-of-00007.safetensors",
|
260 |
+
"model.layers.3.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
261 |
+
"model.layers.3.mlp.down_proj.weight": "model-00002-of-00007.safetensors",
|
262 |
+
"model.layers.3.mlp.gate_proj.weight": "model-00002-of-00007.safetensors",
|
263 |
+
"model.layers.3.mlp.up_proj.weight": "model-00002-of-00007.safetensors",
|
264 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
265 |
+
"model.layers.3.self_attn.k_proj.bias": "model-00002-of-00007.safetensors",
|
266 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00002-of-00007.safetensors",
|
267 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00002-of-00007.safetensors",
|
268 |
+
"model.layers.3.self_attn.q_proj.bias": "model-00002-of-00007.safetensors",
|
269 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00002-of-00007.safetensors",
|
270 |
+
"model.layers.3.self_attn.v_proj.bias": "model-00002-of-00007.safetensors",
|
271 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00002-of-00007.safetensors",
|
272 |
+
"model.layers.4.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
273 |
+
"model.layers.4.mlp.down_proj.weight": "model-00002-of-00007.safetensors",
|
274 |
+
"model.layers.4.mlp.gate_proj.weight": "model-00002-of-00007.safetensors",
|
275 |
+
"model.layers.4.mlp.up_proj.weight": "model-00002-of-00007.safetensors",
|
276 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
277 |
+
"model.layers.4.self_attn.k_proj.bias": "model-00002-of-00007.safetensors",
|
278 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00002-of-00007.safetensors",
|
279 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00002-of-00007.safetensors",
|
280 |
+
"model.layers.4.self_attn.q_proj.bias": "model-00002-of-00007.safetensors",
|
281 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00002-of-00007.safetensors",
|
282 |
+
"model.layers.4.self_attn.v_proj.bias": "model-00002-of-00007.safetensors",
|
283 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00002-of-00007.safetensors",
|
284 |
+
"model.layers.5.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
285 |
+
"model.layers.5.mlp.down_proj.weight": "model-00002-of-00007.safetensors",
|
286 |
+
"model.layers.5.mlp.gate_proj.weight": "model-00002-of-00007.safetensors",
|
287 |
+
"model.layers.5.mlp.up_proj.weight": "model-00002-of-00007.safetensors",
|
288 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
289 |
+
"model.layers.5.self_attn.k_proj.bias": "model-00002-of-00007.safetensors",
|
290 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00002-of-00007.safetensors",
|
291 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00002-of-00007.safetensors",
|
292 |
+
"model.layers.5.self_attn.q_proj.bias": "model-00002-of-00007.safetensors",
|
293 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00002-of-00007.safetensors",
|
294 |
+
"model.layers.5.self_attn.v_proj.bias": "model-00002-of-00007.safetensors",
|
295 |
+
"model.layers.5.self_attn.v_proj.weight": "model-00002-of-00007.safetensors",
|
296 |
+
"model.layers.6.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
297 |
+
"model.layers.6.mlp.down_proj.weight": "model-00002-of-00007.safetensors",
|
298 |
+
"model.layers.6.mlp.gate_proj.weight": "model-00002-of-00007.safetensors",
|
299 |
+
"model.layers.6.mlp.up_proj.weight": "model-00002-of-00007.safetensors",
|
300 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
301 |
+
"model.layers.6.self_attn.k_proj.bias": "model-00002-of-00007.safetensors",
|
302 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00002-of-00007.safetensors",
|
303 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00002-of-00007.safetensors",
|
304 |
+
"model.layers.6.self_attn.q_proj.bias": "model-00002-of-00007.safetensors",
|
305 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00002-of-00007.safetensors",
|
306 |
+
"model.layers.6.self_attn.v_proj.bias": "model-00002-of-00007.safetensors",
|
307 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00002-of-00007.safetensors",
|
308 |
+
"model.layers.7.input_layernorm.weight": "model-00002-of-00007.safetensors",
|
309 |
+
"model.layers.7.mlp.down_proj.weight": "model-00002-of-00007.safetensors",
|
310 |
+
"model.layers.7.mlp.gate_proj.weight": "model-00002-of-00007.safetensors",
|
311 |
+
"model.layers.7.mlp.up_proj.weight": "model-00002-of-00007.safetensors",
|
312 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00002-of-00007.safetensors",
|
313 |
+
"model.layers.7.self_attn.k_proj.bias": "model-00002-of-00007.safetensors",
|
314 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00002-of-00007.safetensors",
|
315 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00002-of-00007.safetensors",
|
316 |
+
"model.layers.7.self_attn.q_proj.bias": "model-00002-of-00007.safetensors",
|
317 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00002-of-00007.safetensors",
|
318 |
+
"model.layers.7.self_attn.v_proj.bias": "model-00002-of-00007.safetensors",
|
319 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00002-of-00007.safetensors",
|
320 |
+
"model.layers.8.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
321 |
+
"model.layers.8.mlp.down_proj.weight": "model-00003-of-00007.safetensors",
|
322 |
+
"model.layers.8.mlp.gate_proj.weight": "model-00003-of-00007.safetensors",
|
323 |
+
"model.layers.8.mlp.up_proj.weight": "model-00003-of-00007.safetensors",
|
324 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
325 |
+
"model.layers.8.self_attn.k_proj.bias": "model-00002-of-00007.safetensors",
|
326 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00002-of-00007.safetensors",
|
327 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00002-of-00007.safetensors",
|
328 |
+
"model.layers.8.self_attn.q_proj.bias": "model-00002-of-00007.safetensors",
|
329 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00002-of-00007.safetensors",
|
330 |
+
"model.layers.8.self_attn.v_proj.bias": "model-00002-of-00007.safetensors",
|
331 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00002-of-00007.safetensors",
|
332 |
+
"model.layers.9.input_layernorm.weight": "model-00003-of-00007.safetensors",
|
333 |
+
"model.layers.9.mlp.down_proj.weight": "model-00003-of-00007.safetensors",
|
334 |
+
"model.layers.9.mlp.gate_proj.weight": "model-00003-of-00007.safetensors",
|
335 |
+
"model.layers.9.mlp.up_proj.weight": "model-00003-of-00007.safetensors",
|
336 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00003-of-00007.safetensors",
|
337 |
+
"model.layers.9.self_attn.k_proj.bias": "model-00003-of-00007.safetensors",
|
338 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00003-of-00007.safetensors",
|
339 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00003-of-00007.safetensors",
|
340 |
+
"model.layers.9.self_attn.q_proj.bias": "model-00003-of-00007.safetensors",
|
341 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00003-of-00007.safetensors",
|
342 |
+
"model.layers.9.self_attn.v_proj.bias": "model-00003-of-00007.safetensors",
|
343 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00003-of-00007.safetensors",
|
344 |
+
"model.norm.weight": "model-00006-of-00007.safetensors"
|
345 |
+
}
|
346 |
+
}
|
qwen2_5_llm/test.txt
ADDED
File without changes
|
qwen2_5_llm/tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
qwen2_5_llm/tokenizer_config.json
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"151657": {
|
117 |
+
"content": "<tool_call>",
|
118 |
+
"lstrip": false,
|
119 |
+
"normalized": false,
|
120 |
+
"rstrip": false,
|
121 |
+
"single_word": false,
|
122 |
+
"special": false
|
123 |
+
},
|
124 |
+
"151658": {
|
125 |
+
"content": "</tool_call>",
|
126 |
+
"lstrip": false,
|
127 |
+
"normalized": false,
|
128 |
+
"rstrip": false,
|
129 |
+
"single_word": false,
|
130 |
+
"special": false
|
131 |
+
},
|
132 |
+
"151659": {
|
133 |
+
"content": "<|fim_prefix|>",
|
134 |
+
"lstrip": false,
|
135 |
+
"normalized": false,
|
136 |
+
"rstrip": false,
|
137 |
+
"single_word": false,
|
138 |
+
"special": false
|
139 |
+
},
|
140 |
+
"151660": {
|
141 |
+
"content": "<|fim_middle|>",
|
142 |
+
"lstrip": false,
|
143 |
+
"normalized": false,
|
144 |
+
"rstrip": false,
|
145 |
+
"single_word": false,
|
146 |
+
"special": false
|
147 |
+
},
|
148 |
+
"151661": {
|
149 |
+
"content": "<|fim_suffix|>",
|
150 |
+
"lstrip": false,
|
151 |
+
"normalized": false,
|
152 |
+
"rstrip": false,
|
153 |
+
"single_word": false,
|
154 |
+
"special": false
|
155 |
+
},
|
156 |
+
"151662": {
|
157 |
+
"content": "<|fim_pad|>",
|
158 |
+
"lstrip": false,
|
159 |
+
"normalized": false,
|
160 |
+
"rstrip": false,
|
161 |
+
"single_word": false,
|
162 |
+
"special": false
|
163 |
+
},
|
164 |
+
"151663": {
|
165 |
+
"content": "<|repo_name|>",
|
166 |
+
"lstrip": false,
|
167 |
+
"normalized": false,
|
168 |
+
"rstrip": false,
|
169 |
+
"single_word": false,
|
170 |
+
"special": false
|
171 |
+
},
|
172 |
+
"151664": {
|
173 |
+
"content": "<|file_sep|>",
|
174 |
+
"lstrip": false,
|
175 |
+
"normalized": false,
|
176 |
+
"rstrip": false,
|
177 |
+
"single_word": false,
|
178 |
+
"special": false
|
179 |
+
}
|
180 |
+
},
|
181 |
+
"additional_special_tokens": [
|
182 |
+
"<|im_start|>",
|
183 |
+
"<|im_end|>",
|
184 |
+
"<|object_ref_start|>",
|
185 |
+
"<|object_ref_end|>",
|
186 |
+
"<|box_start|>",
|
187 |
+
"<|box_end|>",
|
188 |
+
"<|quad_start|>",
|
189 |
+
"<|quad_end|>",
|
190 |
+
"<|vision_start|>",
|
191 |
+
"<|vision_end|>",
|
192 |
+
"<|vision_pad|>",
|
193 |
+
"<|image_pad|>",
|
194 |
+
"<|video_pad|>"
|
195 |
+
],
|
196 |
+
"bos_token": null,
|
197 |
+
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
|
198 |
+
"clean_up_tokenization_spaces": false,
|
199 |
+
"eos_token": "<|im_end|>",
|
200 |
+
"errors": "replace",
|
201 |
+
"model_max_length": 131072,
|
202 |
+
"pad_token": "<|endoftext|>",
|
203 |
+
"split_special_tokens": false,
|
204 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
205 |
+
"unk_token": null,
|
206 |
+
"add_bos_token": false
|
207 |
+
}
|
qwen2_5_llm/vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
qwen2_5_vit/config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/video_hy2/modelzoo/Qwen2-5-ViT-600m",
|
3 |
+
"architectures": [
|
4 |
+
"Qwen2_5_VisionTransformer"
|
5 |
+
],
|
6 |
+
"auto_map": {
|
7 |
+
"AutoConfig": "configuration_qwen2_5_vit.Qwen2_5_VLVisionConfig",
|
8 |
+
"AutoModel": "qwen2_5_vit.Qwen2_5_VisionTransformer"
|
9 |
+
},
|
10 |
+
"depth": 32,
|
11 |
+
"fullatt_block_indexes": [
|
12 |
+
7,
|
13 |
+
15,
|
14 |
+
23,
|
15 |
+
31
|
16 |
+
],
|
17 |
+
"hidden_act": "silu",
|
18 |
+
"hidden_size": 1280,
|
19 |
+
"in_channels": 3,
|
20 |
+
"in_chans": 3,
|
21 |
+
"intermediate_size": 3456,
|
22 |
+
"model_type": "qwen2_5_vit",
|
23 |
+
"num_heads": 16,
|
24 |
+
"out_hidden_size": 8192,
|
25 |
+
"patch_size": 14,
|
26 |
+
"spatial_merge_size": 2,
|
27 |
+
"spatial_patch_size": 14,
|
28 |
+
"temporal_patch_size": 2,
|
29 |
+
"tokens_per_second": 2,
|
30 |
+
"torch_dtype": "float32",
|
31 |
+
"transformers_version": "4.46.3",
|
32 |
+
"window_size": 112
|
33 |
+
}
|
qwen2_5_vit/configuration_qwen2_5_vit.py
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2024 The Qwen team, Alibaba Group, ANT Group and the HuggingFace Inc. team. All rights reserved.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
"""Qwen2_5_VL model configuration"""
|
16 |
+
|
17 |
+
import os
|
18 |
+
from typing import Union
|
19 |
+
|
20 |
+
from transformers.configuration_utils import PretrainedConfig
|
21 |
+
from transformers.utils import logging
|
22 |
+
|
23 |
+
logger = logging.get_logger(__name__)
|
24 |
+
|
25 |
+
# copy from qwen2_5_vl
|
26 |
+
class Qwen2_5_VLVisionConfig(PretrainedConfig):
|
27 |
+
model_type = "qwen2_5_vit"
|
28 |
+
|
29 |
+
def __init__(
|
30 |
+
self,
|
31 |
+
depth=32,
|
32 |
+
hidden_size=3584,
|
33 |
+
hidden_act="silu",
|
34 |
+
intermediate_size=3420,
|
35 |
+
num_heads=16,
|
36 |
+
in_channels=3,
|
37 |
+
patch_size=14,
|
38 |
+
spatial_merge_size=2,
|
39 |
+
temporal_patch_size=2,
|
40 |
+
tokens_per_second=4,
|
41 |
+
window_size=112,
|
42 |
+
out_hidden_size=3584,
|
43 |
+
fullatt_block_indexes=[7, 15, 23, 31],
|
44 |
+
_attn_implementation="flash_attention_2",
|
45 |
+
**kwargs,
|
46 |
+
):
|
47 |
+
super().__init__(**kwargs)
|
48 |
+
self.depth = depth
|
49 |
+
self.hidden_size = hidden_size
|
50 |
+
self.hidden_act = hidden_act
|
51 |
+
self.intermediate_size = intermediate_size
|
52 |
+
self.num_heads = num_heads
|
53 |
+
self.in_channels = in_channels
|
54 |
+
self.patch_size = patch_size
|
55 |
+
self.spatial_merge_size = spatial_merge_size
|
56 |
+
self.temporal_patch_size = temporal_patch_size
|
57 |
+
self.tokens_per_second = tokens_per_second
|
58 |
+
self.window_size = window_size
|
59 |
+
self.fullatt_block_indexes = fullatt_block_indexes
|
60 |
+
self.out_hidden_size = out_hidden_size
|
61 |
+
self._attn_implementation = _attn_implementation
|
62 |
+
|
63 |
+
@classmethod
|
64 |
+
def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig":
|
65 |
+
cls._set_token_in_kwargs(kwargs)
|
66 |
+
|
67 |
+
config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
|
68 |
+
|
69 |
+
if 'vision_config' in config_dict:
|
70 |
+
config_dict = config_dict['vision_config']
|
71 |
+
|
72 |
+
if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type:
|
73 |
+
logger.warning(
|
74 |
+
f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
|
75 |
+
f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."
|
76 |
+
)
|
77 |
+
|
78 |
+
return cls.from_dict(config_dict, **kwargs)
|
qwen2_5_vit/model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b3b4a8c243d5f7ed313caaf365975b46f9f93fb5ba732ef6c34c006a8f7d97e
|
3 |
+
size 2818333744
|
qwen2_5_vit/preprocessor_config.json
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"min_pixels": 3136,
|
3 |
+
"max_pixels": 12845056,
|
4 |
+
"patch_size": 14,
|
5 |
+
"temporal_patch_size": 2,
|
6 |
+
"merge_size": 2,
|
7 |
+
"image_mean": [
|
8 |
+
0.48145466,
|
9 |
+
0.4578275,
|
10 |
+
0.40821073
|
11 |
+
],
|
12 |
+
"image_std": [
|
13 |
+
0.26862954,
|
14 |
+
0.26130258,
|
15 |
+
0.27577711
|
16 |
+
],
|
17 |
+
"image_processor_type": "Qwen2_5_VLImageProcessor",
|
18 |
+
"processor_class": "Qwen2_5_VLProcessor"
|
19 |
+
}
|
qwen2_5_vit/qwen2_5_vit.py
ADDED
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2025 The Qwen Team and The HuggingFace Inc. team. All rights reserved.
|
3 |
+
#
|
4 |
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
5 |
+
# and OPT implementations in this library. It has been modified from its
|
6 |
+
# original forms to accommodate minor architectural differences compared
|
7 |
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
8 |
+
#
|
9 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
10 |
+
# you may not use this file except in compliance with the License.
|
11 |
+
# You may obtain a copy of the License at
|
12 |
+
#
|
13 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
14 |
+
#
|
15 |
+
# Unless required by applicable law or agreed to in writing, software
|
16 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
17 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18 |
+
# See the License for the specific language governing permissions and
|
19 |
+
# limitations under the License.
|
20 |
+
"""PyTorch Qwen2_5_ViT model."""
|
21 |
+
|
22 |
+
import math
|
23 |
+
from dataclasses import dataclass
|
24 |
+
from typing import List, Optional, Tuple, Union
|
25 |
+
|
26 |
+
import torch
|
27 |
+
import torch.nn as nn
|
28 |
+
import torch.nn.functional as F
|
29 |
+
from torch.nn import CrossEntropyLoss
|
30 |
+
|
31 |
+
from transformers.activations import ACT2FN
|
32 |
+
from transformers.cache_utils import Cache, DynamicCache, SlidingWindowCache, StaticCache
|
33 |
+
from transformers.generation import GenerationMixin
|
34 |
+
from transformers.modeling_attn_mask_utils import AttentionMaskConverter
|
35 |
+
from transformers.modeling_outputs import BaseModelOutputWithPast, ModelOutput
|
36 |
+
from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS
|
37 |
+
from transformers.modeling_utils import PreTrainedModel
|
38 |
+
from transformers.utils import (
|
39 |
+
add_start_docstrings,
|
40 |
+
add_start_docstrings_to_model_forward,
|
41 |
+
is_flash_attn_2_available,
|
42 |
+
is_flash_attn_greater_or_equal_2_10,
|
43 |
+
is_torchdynamo_compiling,
|
44 |
+
logging,
|
45 |
+
replace_return_docstrings,
|
46 |
+
)
|
47 |
+
from .configuration_qwen2_5_vit import Qwen2_5_VLVisionConfig
|
48 |
+
|
49 |
+
if is_flash_attn_2_available():
|
50 |
+
from flash_attn import flash_attn_varlen_func
|
51 |
+
from flash_attn.layers.rotary import apply_rotary_emb
|
52 |
+
|
53 |
+
else:
|
54 |
+
flash_attn_varlen_func = None
|
55 |
+
apply_rotary_emb = None
|
56 |
+
|
57 |
+
if is_flash_attn_2_available():
|
58 |
+
from transformers.modeling_flash_attention_utils import _flash_attention_forward
|
59 |
+
else:
|
60 |
+
flash_attn_varlen_func = None
|
61 |
+
|
62 |
+
logger = logging.get_logger(__name__)
|
63 |
+
|
64 |
+
class Qwen2_5_VLMLP(nn.Module):
|
65 |
+
def __init__(self, config, bias: bool = False):
|
66 |
+
super().__init__()
|
67 |
+
self.hidden_size = config.hidden_size
|
68 |
+
self.intermediate_size = config.intermediate_size
|
69 |
+
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=bias)
|
70 |
+
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=bias)
|
71 |
+
self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=bias)
|
72 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
73 |
+
|
74 |
+
def forward(self, hidden_state):
|
75 |
+
return self.down_proj(self.act_fn(self.gate_proj(hidden_state)) * self.up_proj(hidden_state))
|
76 |
+
|
77 |
+
class Qwen2_5_VisionPatchEmbed(nn.Module):
|
78 |
+
def __init__(
|
79 |
+
self,
|
80 |
+
patch_size: int = 14,
|
81 |
+
temporal_patch_size: int = 2,
|
82 |
+
in_channels: int = 3,
|
83 |
+
embed_dim: int = 1152,
|
84 |
+
) -> None:
|
85 |
+
super().__init__()
|
86 |
+
self.patch_size = patch_size
|
87 |
+
self.temporal_patch_size = temporal_patch_size
|
88 |
+
self.in_channels = in_channels
|
89 |
+
self.embed_dim = embed_dim
|
90 |
+
|
91 |
+
kernel_size = [temporal_patch_size, patch_size, patch_size]
|
92 |
+
self.proj = nn.Conv3d(in_channels, embed_dim, kernel_size=kernel_size, stride=kernel_size, bias=False)
|
93 |
+
|
94 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
95 |
+
target_dtype = self.proj.weight.dtype
|
96 |
+
hidden_states = hidden_states.view(
|
97 |
+
-1, self.in_channels, self.temporal_patch_size, self.patch_size, self.patch_size
|
98 |
+
)
|
99 |
+
hidden_states = self.proj(hidden_states.to(dtype=target_dtype)).view(-1, self.embed_dim)
|
100 |
+
return hidden_states
|
101 |
+
|
102 |
+
class Qwen2_5_VisionRotaryEmbedding(nn.Module):
|
103 |
+
def __init__(self, dim: int, theta: float = 10000.0) -> None:
|
104 |
+
super().__init__()
|
105 |
+
inv_freq = 1.0 / (theta ** (torch.arange(0, dim, 2, dtype=torch.float) / dim))
|
106 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
107 |
+
|
108 |
+
def forward(self, seqlen: int) -> torch.Tensor:
|
109 |
+
seq = torch.arange(seqlen, device=self.inv_freq.device, dtype=self.inv_freq.dtype)
|
110 |
+
freqs = torch.outer(seq, self.inv_freq)
|
111 |
+
return freqs
|
112 |
+
|
113 |
+
class Qwen2RMSNorm(nn.Module):
|
114 |
+
def __init__(self, hidden_size, eps=1e-6):
|
115 |
+
"""
|
116 |
+
Qwen2RMSNorm is equivalent to T5LayerNorm
|
117 |
+
"""
|
118 |
+
super().__init__()
|
119 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
120 |
+
self.variance_epsilon = eps
|
121 |
+
|
122 |
+
def forward(self, hidden_states):
|
123 |
+
input_dtype = hidden_states.dtype
|
124 |
+
hidden_states = hidden_states.to(torch.float32)
|
125 |
+
variance = hidden_states.pow(2).mean(-1, keepdim=True)
|
126 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
127 |
+
return self.weight * hidden_states.to(input_dtype)
|
128 |
+
|
129 |
+
def extra_repr(self):
|
130 |
+
return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
|
131 |
+
|
132 |
+
class Qwen2_5_VLPatchMerger(nn.Module):
|
133 |
+
def __init__(self, dim: int, context_dim: int, spatial_merge_size: int = 2) -> None:
|
134 |
+
super().__init__()
|
135 |
+
self.hidden_size = context_dim * (spatial_merge_size ** 2)
|
136 |
+
self.ln_q = Qwen2RMSNorm(context_dim, eps=1e-6)
|
137 |
+
self.mlp = nn.Sequential(
|
138 |
+
nn.Linear(self.hidden_size, self.hidden_size),
|
139 |
+
nn.GELU(),
|
140 |
+
nn.Linear(self.hidden_size, dim),
|
141 |
+
)
|
142 |
+
|
143 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
144 |
+
x = self.mlp(self.ln_q(x).view(-1, self.hidden_size))
|
145 |
+
return x
|
146 |
+
|
147 |
+
def apply_rotary_pos_emb_flashatt(tensor: torch.Tensor, freqs: torch.Tensor) -> torch.Tensor:
|
148 |
+
tensor_ = tensor.float()
|
149 |
+
cos = freqs.cos().float()
|
150 |
+
sin = freqs.sin().float()
|
151 |
+
output = apply_rotary_emb(tensor_, cos, sin).type_as(tensor)
|
152 |
+
return output
|
153 |
+
|
154 |
+
class Qwen2_5_VLVisionFlashAttention2(nn.Module):
|
155 |
+
def __init__(self, dim: int, num_heads: int = 16) -> None:
|
156 |
+
super().__init__()
|
157 |
+
self.num_heads = num_heads
|
158 |
+
self.qkv = nn.Linear(dim, dim * 3, bias=True)
|
159 |
+
self.proj = nn.Linear(dim, dim)
|
160 |
+
|
161 |
+
def forward(
|
162 |
+
self,
|
163 |
+
hidden_states: torch.Tensor,
|
164 |
+
cu_seqlens: torch.Tensor,
|
165 |
+
rotary_pos_emb: torch.Tensor = None,
|
166 |
+
) -> torch.Tensor:
|
167 |
+
seq_length = hidden_states.shape[0]
|
168 |
+
q, k, v = self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
|
169 |
+
q = apply_rotary_pos_emb_flashatt(q.unsqueeze(0), rotary_pos_emb).squeeze(0)
|
170 |
+
k = apply_rotary_pos_emb_flashatt(k.unsqueeze(0), rotary_pos_emb).squeeze(0)
|
171 |
+
|
172 |
+
max_seqlen = (cu_seqlens[1:] - cu_seqlens[:-1]).max().item()
|
173 |
+
attn_output = flash_attn_varlen_func(q, k, v, cu_seqlens, cu_seqlens, max_seqlen, max_seqlen).reshape(
|
174 |
+
seq_length, -1
|
175 |
+
)
|
176 |
+
attn_output = self.proj(attn_output)
|
177 |
+
return attn_output
|
178 |
+
|
179 |
+
def rotate_half(x):
|
180 |
+
"""Rotates half the hidden dims of the input."""
|
181 |
+
x1 = x[..., : x.shape[-1] // 2]
|
182 |
+
x2 = x[..., x.shape[-1] // 2:]
|
183 |
+
return torch.cat((-x2, x1), dim=-1)
|
184 |
+
|
185 |
+
def apply_rotary_pos_emb_vision(tensor: torch.Tensor, freqs: torch.Tensor) -> torch.Tensor:
|
186 |
+
orig_dtype = tensor.dtype
|
187 |
+
tensor = tensor.float()
|
188 |
+
cos = freqs.cos()
|
189 |
+
sin = freqs.sin()
|
190 |
+
cos = cos.unsqueeze(1).repeat(1, 1, 2).unsqueeze(0).float()
|
191 |
+
sin = sin.unsqueeze(1).repeat(1, 1, 2).unsqueeze(0).float()
|
192 |
+
output = (tensor * cos) + (rotate_half(tensor) * sin)
|
193 |
+
output = output.to(orig_dtype)
|
194 |
+
return output
|
195 |
+
|
196 |
+
class Qwen2_5_VLVisionAttention(nn.Module):
|
197 |
+
def __init__(self, dim: int, num_heads: int = 16) -> None:
|
198 |
+
super().__init__()
|
199 |
+
self.num_heads = num_heads
|
200 |
+
self.head_dim = dim // num_heads
|
201 |
+
self.qkv = nn.Linear(dim, dim * 3, bias=True)
|
202 |
+
self.proj = nn.Linear(dim, dim)
|
203 |
+
|
204 |
+
def forward(
|
205 |
+
self, hidden_states: torch.Tensor, cu_seqlens: torch.Tensor, rotary_pos_emb: torch.Tensor = None
|
206 |
+
) -> torch.Tensor:
|
207 |
+
seq_length = hidden_states.shape[0]
|
208 |
+
q, k, v = self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
|
209 |
+
q = apply_rotary_pos_emb_vision(q.unsqueeze(0), rotary_pos_emb).squeeze(0)
|
210 |
+
k = apply_rotary_pos_emb_vision(k.unsqueeze(0), rotary_pos_emb).squeeze(0)
|
211 |
+
|
212 |
+
attention_mask = torch.full(
|
213 |
+
[1, seq_length, seq_length], torch.finfo(q.dtype).min, device=q.device, dtype=q.dtype
|
214 |
+
)
|
215 |
+
for i in range(1, len(cu_seqlens)):
|
216 |
+
attention_mask[..., cu_seqlens[i - 1]: cu_seqlens[i], cu_seqlens[i - 1]: cu_seqlens[i]] = 0
|
217 |
+
|
218 |
+
q = q.transpose(0, 1)
|
219 |
+
k = k.transpose(0, 1)
|
220 |
+
v = v.transpose(0, 1)
|
221 |
+
attn_weights = torch.matmul(q, k.transpose(1, 2)) / math.sqrt(self.head_dim)
|
222 |
+
attn_weights = attn_weights + attention_mask
|
223 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(q.dtype)
|
224 |
+
attn_output = torch.matmul(attn_weights, v)
|
225 |
+
attn_output = attn_output.transpose(0, 1)
|
226 |
+
attn_output = attn_output.reshape(seq_length, -1)
|
227 |
+
attn_output = self.proj(attn_output)
|
228 |
+
return attn_output
|
229 |
+
|
230 |
+
class Qwen2_5_VLVisionSdpaAttention(nn.Module):
|
231 |
+
def __init__(self, dim: int, num_heads: int = 16) -> None:
|
232 |
+
super().__init__()
|
233 |
+
self.num_heads = num_heads
|
234 |
+
self.qkv = nn.Linear(dim, dim * 3, bias=True)
|
235 |
+
self.proj = nn.Linear(dim, dim)
|
236 |
+
|
237 |
+
def forward(
|
238 |
+
self, hidden_states: torch.Tensor, cu_seqlens: torch.Tensor, rotary_pos_emb: torch.Tensor = None
|
239 |
+
) -> torch.Tensor:
|
240 |
+
seq_length = hidden_states.shape[0]
|
241 |
+
q, k, v = self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
|
242 |
+
q = apply_rotary_pos_emb_vision(q.unsqueeze(0), rotary_pos_emb).squeeze(0)
|
243 |
+
k = apply_rotary_pos_emb_vision(k.unsqueeze(0), rotary_pos_emb).squeeze(0)
|
244 |
+
|
245 |
+
attention_mask = torch.zeros([1, seq_length, seq_length], device=q.device, dtype=torch.bool)
|
246 |
+
for i in range(1, len(cu_seqlens)):
|
247 |
+
attention_mask[..., cu_seqlens[i - 1]: cu_seqlens[i], cu_seqlens[i - 1]: cu_seqlens[i]] = True
|
248 |
+
q = q.transpose(0, 1)
|
249 |
+
k = k.transpose(0, 1)
|
250 |
+
v = v.transpose(0, 1)
|
251 |
+
attn_output = F.scaled_dot_product_attention(q, k, v, attention_mask, dropout_p=0.0)
|
252 |
+
attn_output = attn_output.transpose(0, 1)
|
253 |
+
attn_output = attn_output.reshape(seq_length, -1)
|
254 |
+
attn_output = self.proj(attn_output)
|
255 |
+
return attn_output
|
256 |
+
|
257 |
+
QWEN2_5_VL_VISION_ATTENTION_CLASSES = {
|
258 |
+
"eager": Qwen2_5_VLVisionAttention,
|
259 |
+
"flash_attention_2": Qwen2_5_VLVisionFlashAttention2,
|
260 |
+
"sdpa": Qwen2_5_VLVisionSdpaAttention,
|
261 |
+
}
|
262 |
+
|
263 |
+
class Qwen2_5_VLVisionBlock(nn.Module):
|
264 |
+
def __init__(self, config, attn_implementation: str = "sdpa") -> None:
|
265 |
+
super().__init__()
|
266 |
+
self.norm1 = Qwen2RMSNorm(config.hidden_size, eps=1e-6)
|
267 |
+
self.norm2 = Qwen2RMSNorm(config.hidden_size, eps=1e-6)
|
268 |
+
self.attn = QWEN2_5_VL_VISION_ATTENTION_CLASSES[attn_implementation](
|
269 |
+
config.hidden_size, num_heads=config.num_heads
|
270 |
+
)
|
271 |
+
self.mlp = Qwen2_5_VLMLP(config, bias=True)
|
272 |
+
|
273 |
+
def forward(self, hidden_states, cu_seqlens, rotary_pos_emb) -> torch.Tensor:
|
274 |
+
hidden_states = hidden_states + self.attn(
|
275 |
+
self.norm1(hidden_states),
|
276 |
+
cu_seqlens=cu_seqlens,
|
277 |
+
rotary_pos_emb=rotary_pos_emb,
|
278 |
+
)
|
279 |
+
hidden_states = hidden_states + self.mlp(self.norm2(hidden_states))
|
280 |
+
return hidden_states
|
281 |
+
|
282 |
+
class Qwen2_5_VisionTransformer(PreTrainedModel):
|
283 |
+
config_class = Qwen2_5_VLVisionConfig
|
284 |
+
_no_split_modules = ["Qwen2_5_VLVisionBlock"]
|
285 |
+
_supports_flash_attn_2 = True
|
286 |
+
_supports_sdpa = True
|
287 |
+
|
288 |
+
def __init__(self, config, *inputs, **kwargs) -> None:
|
289 |
+
super().__init__(config, *inputs, **kwargs)
|
290 |
+
self.spatial_merge_size = config.spatial_merge_size
|
291 |
+
self.patch_size = config.patch_size
|
292 |
+
self.fullatt_block_indexes = config.fullatt_block_indexes
|
293 |
+
self.window_size = config.window_size
|
294 |
+
self.spatial_merge_unit = self.spatial_merge_size * self.spatial_merge_size
|
295 |
+
|
296 |
+
self.patch_embed = Qwen2_5_VisionPatchEmbed(
|
297 |
+
patch_size=config.patch_size,
|
298 |
+
temporal_patch_size=config.temporal_patch_size,
|
299 |
+
in_channels=config.in_channels,
|
300 |
+
embed_dim=config.hidden_size,
|
301 |
+
)
|
302 |
+
|
303 |
+
head_dim = config.hidden_size // config.num_heads
|
304 |
+
self.rotary_pos_emb = Qwen2_5_VisionRotaryEmbedding(head_dim // 2)
|
305 |
+
|
306 |
+
self.blocks = nn.ModuleList(
|
307 |
+
[Qwen2_5_VLVisionBlock(config, config._attn_implementation) for _ in range(config.depth)]
|
308 |
+
)
|
309 |
+
self.merger = Qwen2_5_VLPatchMerger(
|
310 |
+
dim=config.out_hidden_size,
|
311 |
+
context_dim=config.hidden_size,
|
312 |
+
spatial_merge_size=config.spatial_merge_size,
|
313 |
+
)
|
314 |
+
self.gradient_checkpointing = False
|
315 |
+
|
316 |
+
def rot_pos_emb(self, grid_thw):
|
317 |
+
pos_ids = []
|
318 |
+
for t, h, w in grid_thw:
|
319 |
+
hpos_ids = torch.arange(h).unsqueeze(1).expand(-1, w)
|
320 |
+
hpos_ids = hpos_ids.reshape(
|
321 |
+
h // self.spatial_merge_size,
|
322 |
+
self.spatial_merge_size,
|
323 |
+
w // self.spatial_merge_size,
|
324 |
+
self.spatial_merge_size,
|
325 |
+
)
|
326 |
+
hpos_ids = hpos_ids.permute(0, 2, 1, 3)
|
327 |
+
hpos_ids = hpos_ids.flatten()
|
328 |
+
|
329 |
+
wpos_ids = torch.arange(w).unsqueeze(0).expand(h, -1)
|
330 |
+
wpos_ids = wpos_ids.reshape(
|
331 |
+
h // self.spatial_merge_size,
|
332 |
+
self.spatial_merge_size,
|
333 |
+
w // self.spatial_merge_size,
|
334 |
+
self.spatial_merge_size,
|
335 |
+
)
|
336 |
+
wpos_ids = wpos_ids.permute(0, 2, 1, 3)
|
337 |
+
wpos_ids = wpos_ids.flatten()
|
338 |
+
pos_ids.append(torch.stack([hpos_ids, wpos_ids], dim=-1).repeat(t, 1))
|
339 |
+
pos_ids = torch.cat(pos_ids, dim=0)
|
340 |
+
max_grid_size = grid_thw[:, 1:].max()
|
341 |
+
rotary_pos_emb_full = self.rotary_pos_emb(max_grid_size)
|
342 |
+
rotary_pos_emb = rotary_pos_emb_full[pos_ids].flatten(1)
|
343 |
+
return rotary_pos_emb
|
344 |
+
|
345 |
+
def get_window_index(self, grid_thw):
|
346 |
+
window_index: list = []
|
347 |
+
cu_window_seqlens: list = [0]
|
348 |
+
window_index_id = 0
|
349 |
+
vit_merger_window_size = self.window_size // self.spatial_merge_size // self.patch_size
|
350 |
+
|
351 |
+
for grid_t, grid_h, grid_w in grid_thw:
|
352 |
+
llm_grid_h, llm_grid_w = (
|
353 |
+
grid_h // self.spatial_merge_size,
|
354 |
+
grid_w // self.spatial_merge_size,
|
355 |
+
)
|
356 |
+
index = torch.arange(grid_t * llm_grid_h * llm_grid_w).reshape(grid_t, llm_grid_h, llm_grid_w)
|
357 |
+
pad_h = vit_merger_window_size - llm_grid_h % vit_merger_window_size
|
358 |
+
pad_w = vit_merger_window_size - llm_grid_w % vit_merger_window_size
|
359 |
+
num_windows_h = (llm_grid_h + pad_h) // vit_merger_window_size
|
360 |
+
num_windows_w = (llm_grid_w + pad_w) // vit_merger_window_size
|
361 |
+
index_padded = F.pad(index, (0, pad_w, 0, pad_h), "constant", -100)
|
362 |
+
index_padded = index_padded.reshape(
|
363 |
+
grid_t,
|
364 |
+
num_windows_h,
|
365 |
+
vit_merger_window_size,
|
366 |
+
num_windows_w,
|
367 |
+
vit_merger_window_size,
|
368 |
+
)
|
369 |
+
index_padded = index_padded.permute(0, 1, 3, 2, 4).reshape(
|
370 |
+
grid_t,
|
371 |
+
num_windows_h * num_windows_w,
|
372 |
+
vit_merger_window_size,
|
373 |
+
vit_merger_window_size,
|
374 |
+
)
|
375 |
+
seqlens = (index_padded != -100).sum([2, 3]).reshape(-1)
|
376 |
+
index_padded = index_padded.reshape(-1)
|
377 |
+
index_new = index_padded[index_padded != -100]
|
378 |
+
window_index.append(index_new + window_index_id)
|
379 |
+
cu_seqlens_tmp = seqlens.cumsum(0) * self.spatial_merge_unit + cu_window_seqlens[-1]
|
380 |
+
cu_window_seqlens.extend(cu_seqlens_tmp.tolist())
|
381 |
+
window_index_id += (grid_t * llm_grid_h * llm_grid_w).item()
|
382 |
+
window_index = torch.cat(window_index, dim=0)
|
383 |
+
|
384 |
+
return window_index, cu_window_seqlens
|
385 |
+
|
386 |
+
def forward(self, hidden_states: torch.Tensor, grid_thw: torch.Tensor) -> torch.Tensor:
|
387 |
+
"""
|
388 |
+
Args:
|
389 |
+
hidden_states (`torch.Tensor` of shape `(batch_size, seq_len, hidden_size)`):
|
390 |
+
The final hidden states of the model.
|
391 |
+
grid_thw (`torch.Tensor` of shape `(num_images_or_videos, 3)`):
|
392 |
+
The temporal, height and width of feature shape of each image in LLM.
|
393 |
+
|
394 |
+
Returns:
|
395 |
+
`torch.Tensor`: hidden_states.
|
396 |
+
"""
|
397 |
+
hidden_states = self.patch_embed(hidden_states)
|
398 |
+
rotary_pos_emb = self.rot_pos_emb(grid_thw)
|
399 |
+
window_index, cu_window_seqlens = self.get_window_index(grid_thw)
|
400 |
+
cu_window_seqlens = torch.tensor(
|
401 |
+
cu_window_seqlens,
|
402 |
+
device=hidden_states.device,
|
403 |
+
dtype=grid_thw.dtype if torch.jit.is_tracing() else torch.int32,
|
404 |
+
)
|
405 |
+
cu_window_seqlens = torch.unique_consecutive(cu_window_seqlens)
|
406 |
+
|
407 |
+
seq_len, _ = hidden_states.size()
|
408 |
+
hidden_states = hidden_states.reshape(seq_len // self.spatial_merge_unit, self.spatial_merge_unit, -1)
|
409 |
+
hidden_states = hidden_states[window_index, :, :]
|
410 |
+
hidden_states = hidden_states.reshape(seq_len, -1)
|
411 |
+
rotary_pos_emb = rotary_pos_emb.reshape(seq_len // self.spatial_merge_unit, self.spatial_merge_unit, -1)
|
412 |
+
rotary_pos_emb = rotary_pos_emb[window_index, :, :]
|
413 |
+
rotary_pos_emb = rotary_pos_emb.reshape(seq_len, -1)
|
414 |
+
|
415 |
+
cu_seqlens = torch.repeat_interleave(grid_thw[:, 1] * grid_thw[:, 2], grid_thw[:, 0]).cumsum(
|
416 |
+
dim=0,
|
417 |
+
# Select dtype based on the following factors:
|
418 |
+
# - FA2 requires that cu_seqlens_q must have dtype int32
|
419 |
+
# - torch.onnx.export requires that cu_seqlens_q must have same dtype as grid_thw
|
420 |
+
# See https://github.com/huggingface/transformers/pull/34852 for more information
|
421 |
+
dtype=grid_thw.dtype if torch.jit.is_tracing() else torch.int32,
|
422 |
+
)
|
423 |
+
cu_seqlens = F.pad(cu_seqlens, (1, 0), value=0)
|
424 |
+
|
425 |
+
for layer_num, blk in enumerate(self.blocks):
|
426 |
+
if layer_num in self.fullatt_block_indexes:
|
427 |
+
cu_seqlens_now = cu_seqlens
|
428 |
+
else:
|
429 |
+
cu_seqlens_now = cu_window_seqlens
|
430 |
+
if self.gradient_checkpointing and self.training:
|
431 |
+
hidden_states = self._gradient_checkpointing_func(
|
432 |
+
blk.__call__, hidden_states, cu_seqlens_now, rotary_pos_emb
|
433 |
+
)
|
434 |
+
else:
|
435 |
+
hidden_states = blk(
|
436 |
+
hidden_states,
|
437 |
+
cu_seqlens=cu_seqlens_now,
|
438 |
+
rotary_pos_emb=rotary_pos_emb,
|
439 |
+
)
|
440 |
+
|
441 |
+
hidden_states = self.merger(hidden_states)
|
442 |
+
reverse_indices = torch.argsort(window_index)
|
443 |
+
hidden_states = hidden_states[reverse_indices, :]
|
444 |
+
|
445 |
+
return hidden_states
|
scheduler/scheduler_config.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "DPMSolverMultistepScheduler",
|
3 |
+
"_diffusers_version": "0.33.0.dev0",
|
4 |
+
"algorithm_type": "dpmsolver++",
|
5 |
+
"beta_end": 0.02,
|
6 |
+
"beta_schedule": "linear",
|
7 |
+
"beta_start": 0.0001,
|
8 |
+
"dynamic_thresholding_ratio": 0.995,
|
9 |
+
"euler_at_final": false,
|
10 |
+
"final_sigmas_type": "zero",
|
11 |
+
"flow_shift": 3.0,
|
12 |
+
"lambda_min_clipped": -Infinity,
|
13 |
+
"lower_order_final": true,
|
14 |
+
"num_train_timesteps": 1000,
|
15 |
+
"prediction_type": "flow_prediction",
|
16 |
+
"rescale_betas_zero_snr": false,
|
17 |
+
"sample_max_value": 1.0,
|
18 |
+
"solver_order": 2,
|
19 |
+
"solver_type": "midpoint",
|
20 |
+
"steps_offset": 0,
|
21 |
+
"thresholding": false,
|
22 |
+
"timestep_spacing": "linspace",
|
23 |
+
"trained_betas": null,
|
24 |
+
"use_beta_sigmas": false,
|
25 |
+
"use_exponential_sigmas": false,
|
26 |
+
"use_flow_sigmas": true,
|
27 |
+
"use_karras_sigmas": false,
|
28 |
+
"use_lu_lambdas": false,
|
29 |
+
"variance_type": null
|
30 |
+
}
|
transformer/config.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "SanaTransformer2DModel",
|
3 |
+
"_diffusers_version": "0.33.0.dev0",
|
4 |
+
"attention_bias": false,
|
5 |
+
"attention_head_dim": 32,
|
6 |
+
"caption_channels": 2304,
|
7 |
+
"cross_attention_dim": 2240,
|
8 |
+
"cross_attention_head_dim": 112,
|
9 |
+
"dropout": 0.0,
|
10 |
+
"guidance_embeds": false,
|
11 |
+
"in_channels": 32,
|
12 |
+
"interpolation_scale": null,
|
13 |
+
"mlp_ratio": 2.5,
|
14 |
+
"norm_elementwise_affine": false,
|
15 |
+
"norm_eps": 1e-06,
|
16 |
+
"num_attention_heads": 70,
|
17 |
+
"num_cross_attention_heads": 20,
|
18 |
+
"num_layers": 20,
|
19 |
+
"out_channels": 32,
|
20 |
+
"patch_size": 1,
|
21 |
+
"qk_norm": "rms_norm_across_heads",
|
22 |
+
"sample_size": 16
|
23 |
+
}
|
transformer/diffusion_pytorch_model.fp16.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:33b4b92a49883a7f4c6767486e0afaf301b539d1977e0b5b2d42f49a4d4bd03f
|
3 |
+
size 3209338544
|
transformer/diffusion_pytorch_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:53053fe1b5f29b5a5a612717fee5b77dac5b3594989c7deae17c7cad45d4fd52
|
3 |
+
size 6418622592
|
vae/config.json
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_class_name": "AutoencoderDC",
|
3 |
+
"_diffusers_version": "0.33.0.dev0",
|
4 |
+
"_name_or_path": "mit-han-lab/dc-ae-f32c32-sana-1.1-diffusers",
|
5 |
+
"attention_head_dim": 32,
|
6 |
+
"decoder_act_fns": "silu",
|
7 |
+
"decoder_block_out_channels": [
|
8 |
+
128,
|
9 |
+
256,
|
10 |
+
512,
|
11 |
+
512,
|
12 |
+
1024,
|
13 |
+
1024
|
14 |
+
],
|
15 |
+
"decoder_block_types": [
|
16 |
+
"ResBlock",
|
17 |
+
"ResBlock",
|
18 |
+
"ResBlock",
|
19 |
+
"EfficientViTBlock",
|
20 |
+
"EfficientViTBlock",
|
21 |
+
"EfficientViTBlock"
|
22 |
+
],
|
23 |
+
"decoder_layers_per_block": [
|
24 |
+
3,
|
25 |
+
3,
|
26 |
+
3,
|
27 |
+
3,
|
28 |
+
3,
|
29 |
+
3
|
30 |
+
],
|
31 |
+
"decoder_norm_types": "rms_norm",
|
32 |
+
"decoder_qkv_multiscales": [
|
33 |
+
[],
|
34 |
+
[],
|
35 |
+
[],
|
36 |
+
[
|
37 |
+
5
|
38 |
+
],
|
39 |
+
[
|
40 |
+
5
|
41 |
+
],
|
42 |
+
[
|
43 |
+
5
|
44 |
+
]
|
45 |
+
],
|
46 |
+
"downsample_block_type": "Conv",
|
47 |
+
"encoder_block_out_channels": [
|
48 |
+
128,
|
49 |
+
256,
|
50 |
+
512,
|
51 |
+
512,
|
52 |
+
1024,
|
53 |
+
1024
|
54 |
+
],
|
55 |
+
"encoder_block_types": [
|
56 |
+
"ResBlock",
|
57 |
+
"ResBlock",
|
58 |
+
"ResBlock",
|
59 |
+
"EfficientViTBlock",
|
60 |
+
"EfficientViTBlock",
|
61 |
+
"EfficientViTBlock"
|
62 |
+
],
|
63 |
+
"encoder_layers_per_block": [
|
64 |
+
2,
|
65 |
+
2,
|
66 |
+
2,
|
67 |
+
3,
|
68 |
+
3,
|
69 |
+
3
|
70 |
+
],
|
71 |
+
"encoder_qkv_multiscales": [
|
72 |
+
[],
|
73 |
+
[],
|
74 |
+
[],
|
75 |
+
[
|
76 |
+
5
|
77 |
+
],
|
78 |
+
[
|
79 |
+
5
|
80 |
+
],
|
81 |
+
[
|
82 |
+
5
|
83 |
+
]
|
84 |
+
],
|
85 |
+
"in_channels": 3,
|
86 |
+
"latent_channels": 32,
|
87 |
+
"scaling_factor": 0.41407,
|
88 |
+
"upsample_block_type": "interpolate"
|
89 |
+
}
|
vae/diffusion_pytorch_model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dfd991d1b54ffabf22745c5885589d8f2a7bc59930d95d92bd741c4fc64454bb
|
3 |
+
size 1249044836
|