suryatmodulus Phospheneser commited on
Commit
f80d57f
·
0 Parent(s):

Duplicate from OpenMOSS-Team/MOSS-Image-Base

Browse files

Co-authored-by: Xu Zhe <Phospheneser@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
2
+ *.bin filter=lfs diff=lfs merge=lfs -text
3
+ tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
4
+ assets/hero.png filter=lfs diff=lfs merge=lfs -text
5
+ assets/showcase/layout-bboxes.webp filter=lfs diff=lfs merge=lfs -text
6
+ assets/showcase/text-rendering.webp filter=lfs diff=lfs merge=lfs -text
7
+ assets/teaser.webp filter=lfs diff=lfs merge=lfs -text
8
+ assets/comparison/base.webp filter=lfs diff=lfs merge=lfs -text
9
+ assets/comparison/sft.webp filter=lfs diff=lfs merge=lfs -text
10
+ assets/showcase/overview.webp filter=lfs diff=lfs merge=lfs -text
11
+ assets/showcase/overview2.webp filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ __pycache__/
2
+ .cache/
3
+ *.tmp
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - zh
6
+ pipeline_tag: text-to-image
7
+ tags:
8
+ - moss-image
9
+ - diffusers
10
+ - text-to-image
11
+ ---
12
+ # MOSS-Image-Base
13
+
14
+ <div align="center">
15
+ <p>
16
+ <a href="https://github.com/OpenMOSS/MOSS-Image">
17
+ <img class="dark:hidden mx-auto" src="assets/lockup-light.svg" alt="MOSS-Image" width="520">
18
+ <img class="hidden dark:block mx-auto" src="assets/lockup-dark.svg" alt="MOSS-Image" width="520">
19
+ </a>
20
+ </p>
21
+ <p>
22
+ <a href="https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base"><img alt="Hugging Face · MOSS-Image-Base" src="https://img.shields.io/badge/🤗%20Hugging%20Face-MOSS--Image--Base-ffc107?style=flat-square"></a>
23
+ &nbsp;
24
+ <a href="https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT"><img alt="Hugging Face · MOSS-Image-SFT" src="https://img.shields.io/badge/🤗%20Hugging%20Face-MOSS--Image--SFT-ffc107?style=flat-square"></a>
25
+ &nbsp;
26
+ <a href="https://modelscope.cn/models/openmoss/MOSS-Image-Base"><img alt="ModelScope · MOSS-Image-Base" src="assets/modelscope-base-badge.svg"></a>
27
+ &nbsp;
28
+ <a href="https://modelscope.cn/models/openmoss/MOSS-Image-SFT"><img alt="ModelScope · MOSS-Image-SFT" src="assets/modelscope-sft-badge.svg"></a>
29
+ &nbsp;
30
+ <a href="https://github.com/OpenMOSS/MOSS-Image"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-Code-181717?style=flat-square&amp;logo=github&amp;logoColor=white"></a>
31
+ &nbsp;
32
+ <a href="https://huggingface.co/spaces/OpenMOSS-Team/MOSS-Image"><img alt="Hugging Face Spaces · Demo" src="https://img.shields.io/badge/🤗%20Spaces-Demo-4f46e5?style=flat-square"></a>
33
+ &nbsp;
34
+ <a href="https://openmoss.github.io/MOSS-Image/"><img alt="Homepage" src="https://img.shields.io/badge/🌐%20Project-Homepage-2563eb?style=flat-square"></a>
35
+ &nbsp;
36
+ <a href="https://github.com/OpenMOSS/MOSS-Image/blob/main/paper/MOSS_Image_Technical_Report.pdf"><img alt="Technical Report" src="https://img.shields.io/badge/📄%20Paper-Technical_Report-b31b1b?style=flat-square"></a>
37
+ &nbsp;
38
+ <a href="https://x.com/Open_MOSS"><img alt="Follow OpenMOSS on X" src="https://img.shields.io/badge/Follow-OpenMOSS-000000?style=flat-square&amp;logo=x&amp;logoColor=white"></a>
39
+ &nbsp;
40
+ <a href="https://qm.qq.com/q/hphM7VhaDu"><img alt="MOSS-Image QQ 交流群:755535143" src="https://img.shields.io/badge/QQ-755535143-12B7F5?style=flat-square&amp;logo=qq&amp;logoColor=white"></a>
41
+ &nbsp;
42
+ <a href="https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=7a3m2007-815f-409b-9c3d-a4129f5c058e"><img alt="MOSS-Builders Feishu Community" src="assets/feishu-builders-badge.svg"></a>
43
+ &nbsp;
44
+ <a href="https://discord.gg/nXFWEyvbb"><img alt="MOSS-Image Discord Community" src="https://img.shields.io/badge/Discord-Community-5865F2?style=flat-square&amp;logo=discord&amp;logoColor=white"></a>
45
+ </p>
46
+ <p>
47
+ <a href="https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE.md">User guide</a> &nbsp; · &nbsp;
48
+ <a href="https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE_ZH.md">中文用户指南</a> &nbsp; · &nbsp;
49
+ <a href="https://github.com/OpenMOSS/MOSS-Image/blob/main/comfyui/README.md">ComfyUI</a>
50
+ </p>
51
+ </div>
52
+
53
+ ![MOSS-Image-Base and MOSS-Image-SFT](assets/teaser.webp)
54
+
55
+ MOSS-Image-Base is the base text-to-image model in the **MOSS-Image** family
56
+ from OpenMOSS. It supports natural-language prompts, tag sequences, and JSON
57
+ layouts for controlling text placement and object arrangement.
58
+
59
+ ## Base vs. SFT
60
+
61
+ In this example, SFT produces clearer text grouping and a more organized whiteboard layout.
62
+
63
+ | MOSS-Image-Base | MOSS-Image-SFT |
64
+ | --- | --- |
65
+ | ![MOSS-Image-Base](assets/comparison/base.webp) | ![MOSS-Image-SFT](assets/comparison/sft.webp) |
66
+
67
+ ## Quick start
68
+
69
+ Use Python 3.10 or later and an NVIDIA GPU with CUDA support. Install a PyTorch
70
+ 2.9 or later build compatible with your CUDA environment, then install:
71
+
72
+ ```bash
73
+ pip install "diffusers>=0.38" "transformers>=5.3" "accelerate>=1.10" "safetensors>=0.6" "Pillow>=10"
74
+ ```
75
+
76
+ ```python
77
+ import torch
78
+ from diffusers import DiffusionPipeline
79
+
80
+ pipe = DiffusionPipeline.from_pretrained(
81
+ "OpenMOSS-Team/MOSS-Image-Base",
82
+ custom_pipeline="pipeline_moss_image",
83
+ trust_remote_code=True,
84
+ torch_dtype={"default": torch.bfloat16, "vae": torch.float32},
85
+ )
86
+ pipe.scheduler = type(pipe.scheduler).from_config(pipe.scheduler.config)
87
+ pipe.to("cuda")
88
+
89
+ prompt = '''A wide view of a refrigerator beside a kitchen counter with a fruit bowl. A small sticky note on the refrigerator door is handwritten in Chinese:
90
+ "记得买牛奶和鸡蛋!
91
+ 牛奶两盒,鸡蛋一打。
92
+ 顺便带一袋面包。"'''
93
+
94
+ image = pipe(
95
+ prompt,
96
+ height=1024,
97
+ width=1024,
98
+ num_inference_steps=50,
99
+ guidance_scale=3.0,
100
+ uncond_skip_layers=[22],
101
+ generator=torch.Generator("cpu").manual_seed(42),
102
+ ).images[0]
103
+ image.save("refrigerator_note.png")
104
+ ```
105
+
106
+ The model and custom pipeline code are downloaded and cached automatically. You
107
+ can also pass a complete local model directory to `from_pretrained`.
108
+ The transformer and text encoder use bfloat16; the VAE and initial noise use
109
+ float32. The bundled VAE uses the FLUX.2 small decoder.
110
+
111
+ For the Gradio interface, CPU offload, and compilation options, follow the
112
+ [project quick start](https://github.com/OpenMOSS/MOSS-Image#quick-start).
113
+ For ComfyUI, search for **MOSS-Image** in **ComfyUI Manager** to install the
114
+ native plugin. Integration into the official ComfyUI repository is in progress.
115
+ See the [installation and usage guide](https://github.com/OpenMOSS/MOSS-Image/blob/main/comfyui/README.md)
116
+ and [example workflow](https://github.com/OpenMOSS/MOSS-Image/blob/main/comfyui/moss-image/example_workflows/moss-image.json).
117
+
118
+ ## Sampling settings
119
+
120
+ | Setting | Default |
121
+ | --- | --- |
122
+ | Sampler | Flow-matching Euler |
123
+ | Steps | 50 |
124
+ | CFG | 3 |
125
+ | Shift | 5 |
126
+ | Layer skipping | Negative branch, layer index 22 (zero-based) |
127
+ | Negative prompt | Empty |
128
+
129
+ The default guidance uses two transformer forwards per step. Pass
130
+ `uncond_skip_layers=[]` to disable negative-branch skipping, or set
131
+ `negative_prompt` to provide a negative prompt. Python API image dimensions must
132
+ be positive multiples of 16.
133
+
134
+ See the [user guide](https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE.md)
135
+ for resolution, sampling, prompt, and LoRA training recommendations.
136
+
137
+ ## Prompt enhancer skill
138
+
139
+ The [MOSS-Image Prompt Enhancer](https://github.com/OpenMOSS/MOSS-Image/blob/main/skills/moss-image-prompt-enhancer/SKILL.md) turns
140
+ image ideas into detailed captions or spatial Layout prompts. It is designed for
141
+ GPT-6-family agents with local file and Python tools. The bundled script converts
142
+ pixel-coordinate drafts into compact JSON with integer centered coordinates;
143
+ it does not call an image-generation service.
144
+
145
+ Install the [skill folder](https://github.com/OpenMOSS/MOSS-Image/tree/main/skills/moss-image-prompt-enhancer) in your agent's skills
146
+ directory, then invoke `$moss-image-prompt-enhancer` with your image idea, desired
147
+ caption or Layout output, and any canvas dimensions. Paste the compiled result
148
+ into MOSS-Image's positive prompt; for Layout, use the same generation dimensions.
149
+
150
+ ## Layout-to-image generation
151
+
152
+ Pass a JSON layout as the prompt to describe the scene, rendered text, objects,
153
+ and their positions. Layouts use `summary.caption` and `items`, with
154
+ `bbox_format: "yxyx"` and `bbox_coord_space: "abs_centralized"`.
155
+
156
+ With the Python API, serialize the layout using
157
+ `json.dumps(layout, ensure_ascii=False)` and pass it to `pipe`. In Gradio, paste
158
+ the JSON into the Prompt field and set the matching image dimensions.
159
+ See the [layout format and example](https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE.md#layout-prompts-experimental).
160
+
161
+ Layouts can also support controlled editing and user-friendly layout tools.
162
+ Edit text, element descriptions, and bounding boxes to adjust image content and
163
+ composition in a structured way.
164
+
165
+ ![Layout control](assets/showcase/layout-bboxes.webp)
166
+
167
+ ## Showcase
168
+
169
+ ![Examples overview](assets/showcase/overview.webp)
170
+
171
+ ![Examples overview 2](assets/showcase/overview2.webp)
172
+
173
+ ## Citation
174
+
175
+ ```bibtex
176
+ @misc{mossimage2026,
177
+ title = {MOSS-Image},
178
+ author = {{OpenMOSS Team}},
179
+ year = {2026},
180
+ howpublished = {\url{https://github.com/OpenMOSS/MOSS-Image}}
181
+ }
182
+ ```
183
+
184
+ ## License and acknowledgements
185
+
186
+ The model weights and bundled inference code are released under the
187
+ [Apache License, Version 2.0](LICENSE).
188
+
189
+ We thank the Diffusers, Qwen, and FLUX teams.
assets/comparison/base.webp ADDED

Git LFS Details

  • SHA256: dd0eccae7f9c591b65c8161bb2d8515a3fdfe124d4be015f660ffa96c5c7a8b8
  • Pointer size: 131 Bytes
  • Size of remote file: 102 kB
assets/comparison/sft.webp ADDED

Git LFS Details

  • SHA256: de1ba44f48d49e792b16aac26f2d260beefbcb9fbfa72f3ace363ff8a9917f71
  • Pointer size: 131 Bytes
  • Size of remote file: 153 kB
assets/feishu-builders-badge.svg ADDED
assets/lockup-dark.svg ADDED
assets/lockup-light.svg ADDED
assets/modelscope-base-badge.svg ADDED
assets/modelscope-sft-badge.svg ADDED
assets/showcase/layout-bboxes.webp ADDED

Git LFS Details

  • SHA256: 0cd091fbd9145b9dc640e1d70dc10e6776b661bb1f443bdefadc9a24f78214d1
  • Pointer size: 131 Bytes
  • Size of remote file: 851 kB
assets/showcase/overview.webp ADDED

Git LFS Details

  • SHA256: ae5039bc1ea15b1be43662aabb90539332815230bbc7f56d9481ce53f79131f1
  • Pointer size: 132 Bytes
  • Size of remote file: 1.13 MB
assets/showcase/overview2.webp ADDED

Git LFS Details

  • SHA256: a51172680bcddd6fad2edf0bc6bd0c26e509aa52ac9e3b57f95e914bd6d223f0
  • Pointer size: 132 Bytes
  • Size of remote file: 4.63 MB
assets/showcase/text-rendering.webp ADDED

Git LFS Details

  • SHA256: e3dac88a40868bf4a51b27d74b09cbddd30260f1ce118c6d6ba60ad5b97ea83e
  • Pointer size: 132 Bytes
  • Size of remote file: 1.86 MB
assets/teaser.webp ADDED

Git LFS Details

  • SHA256: 47d1ae8ebf4f7dc0db2c85dc7f71f182cd2205b19932211e831e1cb24b17efc1
  • Pointer size: 131 Bytes
  • Size of remote file: 438 kB
model_index.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "MOSSImagePipeline",
3
+ "_diffusers_version": "0.38.0",
4
+ "scheduler": [
5
+ "pipeline_moss_image",
6
+ "MOSSImageScheduler"
7
+ ],
8
+ "text_encoder": [
9
+ "transformers",
10
+ "Qwen3_5Model"
11
+ ],
12
+ "tokenizer": [
13
+ "transformers",
14
+ "Qwen2Tokenizer"
15
+ ],
16
+ "transformer": [
17
+ "pipeline_moss_image",
18
+ "MOSSImageTransformer"
19
+ ],
20
+ "vae": [
21
+ "diffusers",
22
+ "AutoencoderKLFlux2"
23
+ ]
24
+ }
pipeline_moss_image.py ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """MOSSImage modeling and text-to-image pipeline (no Motor/TorchTitan imports).
2
+
3
+ Dependencies: torch>=2.9, diffusers>=0.38, transformers>=5.3, safetensors,
4
+ accelerate, Pillow. Copy this file anywhere and import it normally.
5
+
6
+ import torch
7
+ # Import MOSSImagePipeline from this file for component-level loading.
8
+ pipe = MOSSImagePipeline.from_components_pretrained(
9
+ transformer_path="exported_transformer", # save_pretrained directory
10
+ text_encoder_path="Qwen/Qwen3.5-9B",
11
+ vae_path="black-forest-labs/FLUX.2-klein-4B",
12
+ ).to("cuda")
13
+ pipe("A cat", generator=torch.Generator("cuda").manual_seed(42)).images[0].save("cat.png")
14
+
15
+ Default guidance uses CFG 3 and skips block 22 only in the negative branch
16
+ (zero-based main DiT block indices; two forwards per sampling step):
17
+ pipe("A cat", guidance_scale=3.0, uncond_skip_layers=[22])
18
+ pipe("A cat", uncond_skip_layers=[]) # disable negative-branch skipping
19
+ Optional additional positive-branch SLG adds a third forward:
20
+ pipe("A cat", slg_layers=[24], slg_scale=3.0)
21
+ The additional SLG layer/scale above illustrates the API, not a quality-tuned setting.
22
+
23
+ For a consolidated training state dict, create MOSSImageTransformer and
24
+ call load_training_state_dict(state), then save_pretrained("exported_transformer").
25
+ Select raw or EMA weights explicitly before calling it; distributed checkpoint
26
+ shards/optimizer states are not model state dicts. Defaults match the finalized dense MOSSImage model,
27
+ not MoE, CFG-distilled, video, or reference-image variants. Prompt strings are
28
+ already-rendered captions (dataset-specific quality/domain tags are not added).
29
+
30
+ First-release defaults: bf16 DiT/text-encoder weights, fp32 RoPE frequencies
31
+ and phase/sin/cos calculation, then RoPE cast to the video activation dtype.
32
+ Initial Gaussian noise is sampled directly in fp32, including with bf16 weights.
33
+ CFG and Euler latent updates use fp32; VAE decoding defaults to fp32. Scheduler
34
+ shift defaults to 5.0. Exact numerical parity with the original fp32-master
35
+ inference pipeline is not a release requirement.
36
+ """
37
+ from __future__ import annotations
38
+
39
+ import math
40
+ from pathlib import Path
41
+
42
+ import torch
43
+ from torch import nn
44
+ from torch.nn import functional as F
45
+ from diffusers import AutoencoderKLFlux2, DiffusionPipeline, FlowMatchEulerDiscreteScheduler
46
+ from diffusers.schedulers.scheduling_utils import SchedulerMixin # Required by custom-component discovery.
47
+ from diffusers.configuration_utils import ConfigMixin, register_to_config
48
+ from diffusers.image_processor import VaeImageProcessor
49
+ from diffusers.models.modeling_utils import ModelMixin
50
+ from diffusers.models.modeling_outputs import Transformer2DModelOutput
51
+ from diffusers.pipelines.pipeline_utils import ImagePipelineOutput
52
+ from diffusers.utils.torch_utils import randn_tensor
53
+ from transformers import AutoModel, AutoTokenizer
54
+
55
+
56
+ class _RMSNorm(nn.Module):
57
+ def __init__(self, dim):
58
+ super().__init__()
59
+ self.weight = nn.Parameter(torch.ones(dim))
60
+
61
+ def forward(self, x):
62
+ y = x.float() * torch.rsqrt(x.float().square().mean(-1, keepdim=True) + 1e-6)
63
+ return y.to(x.dtype) * self.weight
64
+
65
+
66
+ def _situ(hidden, gate):
67
+ return (4.0 * torch.tanh(gate / 4.0) * torch.sigmoid(gate)) * (25.0 * torch.tanh(hidden / 25.0))
68
+
69
+
70
+ def _validate_skip_layers(layers, depth, name='skip_layers'):
71
+ layers = () if layers is None else tuple(layers)
72
+ if any(type(index) is not int or not 0 <= index < depth for index in layers):
73
+ raise ValueError(f'{name} must contain integer block indices in [0, {depth}).')
74
+ return frozenset(layers)
75
+
76
+
77
+ def _rotate(x, rope):
78
+ sin, cos = rope.chunk(2, -1)
79
+ sin = torch.cat((sin, sin), -1).unsqueeze(-2)
80
+ cos = torch.cat((cos, cos), -1).unsqueeze(-2)
81
+ a, b = x.chunk(2, -1)
82
+ return x * cos + torch.cat((-b, a), -1) * sin
83
+
84
+
85
+ def _attention(q, k, v, rope, heads):
86
+ shape = (*q.shape[:2], heads, q.shape[-1] // heads)
87
+ q = _rotate(q.reshape(shape), rope).transpose(1, 2)
88
+ k = _rotate(k.reshape(shape), rope).transpose(1, 2)
89
+ v = v.reshape(shape).transpose(1, 2)
90
+ return F.scaled_dot_product_attention(q.to(v.dtype), k.to(v.dtype), v).transpose(1, 2).flatten(2)
91
+
92
+
93
+ class _TextBlock(nn.Module):
94
+ def __init__(self, dim, ffn_dim, heads):
95
+ super().__init__()
96
+ self.heads = heads
97
+ self.norm1, self.norm2 = _RMSNorm(dim), _RMSNorm(dim)
98
+ self.q_norm, self.k_norm = _RMSNorm(dim // heads), _RMSNorm(dim // heads)
99
+ self.qkv = nn.Linear(dim, 3 * dim)
100
+ self.proj = nn.Linear(dim, dim)
101
+ self.ffn_gate, self.ffn_up = nn.Linear(dim, ffn_dim), nn.Linear(dim, ffn_dim)
102
+ self.ffn_down = nn.Linear(ffn_dim, dim)
103
+
104
+ def forward(self, x, rope):
105
+ q, k, v = self.qkv(self.norm1(x)).chunk(3, -1)
106
+ q = self.q_norm(q.unflatten(-1, (self.heads, -1))).flatten(2)
107
+ k = self.k_norm(k.unflatten(-1, (self.heads, -1))).flatten(2)
108
+ x = x + self.proj(_attention(q, k, v, rope, self.heads))
109
+ y = self.norm2(x)
110
+ return x + self.ffn_down(_situ(self.ffn_up(y), self.ffn_gate(y)))
111
+
112
+
113
+ class _TextProjection(nn.Module):
114
+ def __init__(self, text_dim, dim, ffn_dim, heads):
115
+ super().__init__()
116
+ self.proj = nn.Linear(text_dim, dim)
117
+ self.blocks = nn.ModuleList([_TextBlock(dim, ffn_dim, heads) for _ in range(2)])
118
+
119
+ def forward(self, x, rope):
120
+ x = self.proj(x.to(self.proj.weight.dtype))
121
+ for block in self.blocks:
122
+ x = block(x, rope)
123
+ return x
124
+
125
+
126
+ class _Block(nn.Module):
127
+ def __init__(self, dim, ffn_dim, heads):
128
+ super().__init__()
129
+ self.heads = heads
130
+ self.norm1, self.norm2 = _RMSNorm(dim), _RMSNorm(dim)
131
+ self.q_norm, self.k_norm = _RMSNorm(dim // heads), _RMSNorm(dim // heads)
132
+ self.proj = nn.ModuleDict({
133
+ name: nn.Linear(dim, dim, bias=False) for name in ('q', 'k', 'v', 'o')
134
+ })
135
+ self.proj['ffn_up_gate'] = nn.Linear(dim, 2 * ffn_dim, bias=False)
136
+ self.proj['ffn_down'] = nn.Linear(ffn_dim, dim, bias=False)
137
+
138
+ def forward(self, x, rope, modulation):
139
+ shift_a, scale_a, gate_a, shift_f, scale_f, gate_f = modulation.unbind(1)
140
+ y = self.norm1(x) * (1 + scale_a[:, None]) + shift_a[:, None]
141
+ dtype = self.proj['q'].weight.dtype
142
+ y = y.to(dtype)
143
+ q = self.q_norm(self.proj['q'](y).unflatten(-1, (self.heads, -1))).flatten(2)
144
+ k = self.k_norm(self.proj['k'](y).unflatten(-1, (self.heads, -1))).flatten(2)
145
+ x = x + self.proj['o'](_attention(q, k, self.proj['v'](y), rope, self.heads)) * gate_a[:, None]
146
+ y = self.norm2(x) * (1 + scale_f[:, None]) + shift_f[:, None]
147
+ hidden, gate = self.proj['ffn_up_gate'](y.to(dtype)).chunk(2, -1)
148
+ return x + self.proj['ffn_down'](_situ(hidden, gate)) * gate_f[:, None]
149
+
150
+
151
+ class _RoPE(nn.Module):
152
+ def __init__(self, head_dim, base):
153
+ super().__init__()
154
+ self.num_bands = head_dim // 8
155
+ self.base = base
156
+ self.register_buffer('bands', self._default_bands(torch.device('cpu')))
157
+
158
+ def _default_bands(self, device):
159
+ # Match training's CPU fp32 construction, including under meta init.
160
+ exponent = torch.arange(self.num_bands, device='cpu', dtype=torch.float32) / self.num_bands
161
+ return (1 / (self.base ** exponent)).to(device)
162
+
163
+ def _apply(self, fn, recurse=True):
164
+ super()._apply(fn, recurse=recurse)
165
+ # .float() cannot recover frequencies already rounded by .to(bf16).
166
+ self.bands = self._default_bands(self.bands.device)
167
+ return self
168
+
169
+ def _load_from_state_dict(self, *args, **kwargs):
170
+ super()._load_from_state_dict(*args, **kwargs)
171
+ # Frequencies are derived constants; retain the key for checkpoint compatibility.
172
+ self.bands = self._default_bands(self.bands.device)
173
+
174
+ def forward(self, height, width, text_length, device):
175
+ # Diffusers/Accelerate can install tensors directly, bypassing load hooks.
176
+ if self.bands.dtype != torch.float32:
177
+ self.bands = self._default_bands(device)
178
+ # Coordinates: (r, f, h, w); sequence order is image followed by text.
179
+ h, w = torch.meshgrid(torch.arange(height, device=device), torch.arange(width, device=device), indexing='ij')
180
+ image = torch.stack((torch.zeros_like(h), torch.full_like(h, text_length), h, w), -1).flatten(0, 1).float()
181
+ image[:, 2] -= (height - 1) / 2
182
+ image[:, 3] -= (width - 1) / 2
183
+ text = torch.zeros(text_length, 4, device=device, dtype=torch.float32)
184
+ text[:, 1] = torch.arange(text_length, device=device)
185
+ phase = torch.cat((image, text), 0).unsqueeze(-1) * self.bands
186
+ return torch.cat((phase.sin(), phase.cos()), -2).flatten(-2).unsqueeze(0)
187
+
188
+
189
+ class MOSSImageTransformer(ModelMixin, ConfigMixin):
190
+ """MOSSImage DiT with training-compatible state-dict names and SDPA attention.
191
+
192
+ Each sample is evaluated at its true text length, including text refinement;
193
+ padded tokens cannot influence either text or joint attention.
194
+ """
195
+ @register_to_config
196
+ def __init__(self, dim=3072, ffn_dim=8192, num_heads=24, num_layers=42,
197
+ text_dim=4096, freq_dim=256, latent_channels=128, rope_base=10000.0):
198
+ super().__init__()
199
+ if dim % num_heads or (dim // num_heads) % 8 or freq_dim % 2:
200
+ raise ValueError('Require dim divisible by heads, head_dim divisible by 8, and even freq_dim.')
201
+ self.video_embedder = nn.Linear(latent_channels, dim)
202
+ self.text_embedder = _TextProjection(text_dim, dim, ffn_dim, num_heads)
203
+ self.rope = _RoPE(dim // num_heads, rope_base)
204
+ self.time_embedding = nn.Sequential(nn.Linear(freq_dim, dim), nn.SiLU(), nn.Linear(dim, dim))
205
+ self.shared_block_modulation = nn.Linear(dim, 6 * dim)
206
+ self.layers = nn.ModuleList([_Block(dim, ffn_dim, num_heads) for _ in range(num_layers)])
207
+ self.final_norm_video = _RMSNorm(dim)
208
+ self.final_linear_video = nn.Linear(dim, latent_channels, bias=False)
209
+ self.video_head_modulation = nn.Linear(dim, 2 * dim)
210
+
211
+ def load_training_state_dict(self, state_dict, *, prefix=''):
212
+ """Load a consolidated raw/EMA model mapping, strictly; no silent key drops."""
213
+ if prefix:
214
+ if any(not key.startswith(prefix) for key in state_dict):
215
+ raise ValueError('All keys must start with the explicit prefix.')
216
+ state_dict = {key[len(prefix):]: value for key, value in state_dict.items()}
217
+ return self.load_state_dict(state_dict, strict=True)
218
+
219
+ def forward(self, hidden_states, timestep, encoder_hidden_states,
220
+ encoder_attention_mask=None, return_dict=True, skip_layers=None):
221
+ skip_layers = _validate_skip_layers(skip_layers, len(self.layers))
222
+ if hidden_states.ndim != 4 or hidden_states.shape[1] != self.config.latent_channels:
223
+ raise ValueError('hidden_states must be [B, latent_channels, H, W].')
224
+ batch, _, height, width = hidden_states.shape
225
+ if encoder_hidden_states.ndim != 3 or encoder_hidden_states.shape[0] != batch:
226
+ raise ValueError('encoder_hidden_states must be [B, S, text_dim].')
227
+ mask = encoder_attention_mask
228
+ if mask is None:
229
+ mask = torch.ones(encoder_hidden_states.shape[:2], dtype=torch.bool, device=hidden_states.device)
230
+ if mask.shape != encoder_hidden_states.shape[:2] or not torch.all((mask == 0) | (mask == 1)):
231
+ raise ValueError('encoder_attention_mask must be a binary [B, S] mask.')
232
+ times = torch.as_tensor(timestep, device=hidden_states.device, dtype=torch.float32).reshape(-1)
233
+ times = times.expand(batch)
234
+ # Training computes the sinusoid in float64 and feeds float32 into its MLP.
235
+ half = self.config.freq_dim // 2
236
+ freq = 10000 ** (-torch.arange(half, device=times.device, dtype=torch.float64) / half)
237
+ phase = times.double()[:, None] * freq
238
+ embedding = torch.cat((phase.cos(), phase.sin()), -1).float()
239
+ time = self.time_embedding(embedding.to(self.time_embedding[0].weight.dtype)).float()
240
+ mod = self.shared_block_modulation(time.to(self.shared_block_modulation.weight.dtype)).view(batch, 6, -1)
241
+ head = self.video_head_modulation(time.to(self.video_head_modulation.weight.dtype)).view(batch, 2, -1)
242
+ outputs = []
243
+ for index in range(batch):
244
+ context = encoder_hidden_states[index:index + 1, mask[index].bool()]
245
+ if context.shape[1] == 0:
246
+ raise ValueError('Each sample needs at least one valid text token.')
247
+ video = hidden_states[index:index + 1].flatten(2).transpose(1, 2)
248
+ video = self.video_embedder(video.to(self.video_embedder.weight.dtype).contiguous())
249
+ # Match the reference activation dtype under fp32 weights + autocast.
250
+ rope = self.rope(height, width, context.shape[1], hidden_states.device).to(video.dtype)
251
+ text = self.text_embedder(context, rope[:, height * width:])
252
+ x = torch.cat((video, text), 1)
253
+ for layer_index, layer in enumerate(self.layers):
254
+ if layer_index not in skip_layers:
255
+ x = layer(x, rope, mod[index:index + 1])
256
+ x = self.final_norm_video(x[:, :height * width].to(self.final_norm_video.weight.dtype))
257
+ x = x * (1 + head[index:index + 1, 1, None]) + head[index:index + 1, 0, None]
258
+ x = self.final_linear_video(x.to(self.final_linear_video.weight.dtype))
259
+ outputs.append(x.transpose(1, 2).reshape(1, -1, height, width))
260
+ sample = torch.cat(outputs)
261
+ return Transformer2DModelOutput(sample=sample) if return_dict else (sample,)
262
+
263
+
264
+ class MOSSImageScheduler(FlowMatchEulerDiscreteScheduler):
265
+ """Euler integration using the training project's V2, nearest-grid schedule."""
266
+ @register_to_config
267
+ def __init__(self, num_train_timesteps=1000, shift=5.0, training_shift=1.0):
268
+ super().__init__(num_train_timesteps=num_train_timesteps, shift=1.0)
269
+ self.register_to_config(shift=shift, training_shift=training_shift)
270
+
271
+ def set_timesteps(self, num_inference_steps=50, device=None):
272
+ if num_inference_steps < 1 or self.config.shift <= 0 or self.config.training_shift <= 0:
273
+ raise ValueError('Steps and shifts must be positive.')
274
+ total = self.config.num_train_timesteps
275
+ def grid(count, shift):
276
+ lower = shift / (total + shift - 1)
277
+ values = torch.linspace(1, lower, count)
278
+ return shift * values / (1 + (shift - 1) * values)
279
+ sigmas = grid(num_inference_steps, self.config.shift)
280
+ training = grid(total, self.config.training_shift).flip(0)
281
+ upper = torch.searchsorted(training, sigmas).clamp(max=total - 1)
282
+ lower = (upper - 1).clamp(min=0)
283
+ nearest = torch.where((sigmas - training[lower]).abs() <= (training[upper] - sigmas).abs(), lower, upper)
284
+ sigmas = torch.unique_consecutive(training[nearest])
285
+ # Our sigmas have already been shifted and snapped. Avoid a second shift.
286
+ self._shift = 1.0
287
+ super().set_timesteps(device=device, sigmas=sigmas.tolist())
288
+
289
+
290
+ class MOSSImagePipeline(DiffusionPipeline):
291
+ model_cpu_offload_seq = 'text_encoder->transformer->vae'
292
+ _optional_components = ['text_encoder', 'tokenizer', 'vae']
293
+
294
+ def __init__(self, transformer: MOSSImageTransformer,
295
+ scheduler: MOSSImageScheduler, text_encoder=None, tokenizer=None, vae=None):
296
+ super().__init__()
297
+ self.register_modules(transformer=transformer, scheduler=scheduler,
298
+ text_encoder=text_encoder, tokenizer=tokenizer, vae=vae)
299
+ self.image_processor = VaeImageProcessor(vae_scale_factor=16)
300
+
301
+ @classmethod
302
+ def from_components_pretrained(cls, transformer_path, text_encoder_path, vae_path,
303
+ torch_dtype=torch.bfloat16, vae_dtype=torch.float32,
304
+ local_files_only=False):
305
+ common = dict(local_files_only=local_files_only)
306
+ transformer = MOSSImageTransformer.from_pretrained(transformer_path, torch_dtype=torch_dtype, **common)
307
+ tokenizer = AutoTokenizer.from_pretrained(text_encoder_path, **common)
308
+ text_encoder = AutoModel.from_pretrained(text_encoder_path, dtype=torch_dtype, **common).eval()
309
+ subfolder = None if (Path(vae_path) / 'config.json').is_file() else 'vae'
310
+ vae = AutoencoderKLFlux2.from_pretrained(vae_path, subfolder=subfolder, torch_dtype=vae_dtype, **common).eval()
311
+ return cls(transformer.eval(), MOSSImageScheduler(), text_encoder, tokenizer, vae)
312
+
313
+ @torch.no_grad()
314
+ def encode_prompt(self, prompt, max_sequence_length=4096):
315
+ if self.text_encoder is None or self.tokenizer is None:
316
+ raise ValueError('Text encoder/tokenizer required for string prompts.')
317
+ prompts = [prompt] if isinstance(prompt, str) else list(prompt)
318
+ if not prompts or not all(isinstance(p, str) for p in prompts):
319
+ raise ValueError('prompt must be a string or a nonempty list of strings.')
320
+ rows = []
321
+ # Unpadded individual forwards also avoid padding effects in Qwen GDN.
322
+ for value in prompts:
323
+ formatted = self.tokenizer.apply_chat_template(
324
+ [{'role': 'user', 'content': value}], tokenize=False,
325
+ add_generation_prompt=True, enable_thinking=True)
326
+ inputs = self.tokenizer(formatted, return_tensors='pt', truncation=True,
327
+ max_length=max_sequence_length).to(self._execution_device)
328
+ output = self.text_encoder(**inputs, use_cache=False, return_dict=True)
329
+ rows.append(output.last_hidden_state[0])
330
+ length = max(row.shape[0] for row in rows)
331
+ embeds = rows[0].new_zeros(len(rows), length, rows[0].shape[-1])
332
+ mask = torch.zeros(len(rows), length, device=embeds.device, dtype=torch.bool)
333
+ for index, row in enumerate(rows):
334
+ embeds[index, :row.shape[0]] = row
335
+ mask[index, :row.shape[0]] = True
336
+ return embeds, mask
337
+
338
+ @torch.no_grad()
339
+ def __call__(self, prompt=None, *, height=1024, width=1024, num_inference_steps=50,
340
+ guidance_scale=3.0, negative_prompt='', num_images_per_prompt=1,
341
+ generator=None, latents=None, prompt_embeds=None, prompt_attention_mask=None,
342
+ negative_prompt_embeds=None, negative_prompt_attention_mask=None,
343
+ max_sequence_length=4096, output_type='pil', return_dict=True,
344
+ uncond_skip_layers=(22,), slg_layers=None, slg_scale=0.0,
345
+ slg_start=0.0, slg_stop=1.0):
346
+ """Generate images with optional full-block skipping (zero-based indices).
347
+
348
+ uncond_skip_layers defaults to (22,) and replaces CFG's negative-prompt
349
+ prediction with a skipped-block prediction, retaining two forwards per
350
+ step. Pass None or an empty sequence to disable skipping. slg_layers
351
+ adds a skipped positive-prompt forward and the fp32 correction
352
+ slg_scale * (cond - cond_skip) to CFG. With guidance_scale=1, active
353
+ SLG uses cond_skip + slg_scale * (cond - cond_skip), matching Diffusers'
354
+ default SkipLayerGuidance formulation, with two forwards and no negative
355
+ branch. Both options can combine. slg_scale=1 then gives normal cond.
356
+ Both uncond skipping and SLG are active where
357
+ slg_start <= step_index / num_steps < slg_stop;
358
+ the interval follows denoising order, from initial noise to final image.
359
+ Outside it, inference uses normal CFG without skipping.
360
+ slg_scale=0 or empty slg_layers disables the additional forward.
361
+ """
362
+ uncond_skip_layers = _validate_skip_layers(
363
+ uncond_skip_layers, len(self.transformer.layers), 'uncond_skip_layers')
364
+ slg_layers = _validate_skip_layers(slg_layers, len(self.transformer.layers), 'slg_layers')
365
+ if not math.isfinite(slg_scale) or slg_scale < 0:
366
+ raise ValueError('slg_scale must be finite and nonnegative.')
367
+ if not 0 <= slg_start <= slg_stop <= 1:
368
+ raise ValueError('Require 0 <= slg_start <= slg_stop <= 1.')
369
+ if height <= 0 or width <= 0 or height % 16 or width % 16:
370
+ raise ValueError('height and width must be positive multiples of 16.')
371
+ if output_type not in {'pil', 'np', 'pt', 'latent'}:
372
+ raise ValueError('output_type must be pil, np, pt or latent.')
373
+ if num_images_per_prompt < 1 or not math.isfinite(guidance_scale) or guidance_scale < 0:
374
+ raise ValueError('Invalid image count or guidance scale.')
375
+ if not 1 <= max_sequence_length <= 4096:
376
+ raise ValueError('max_sequence_length must be between 1 and 4096.')
377
+ if (prompt is None) == (prompt_embeds is None):
378
+ raise ValueError('Provide exactly one of prompt and prompt_embeds.')
379
+ device = self._execution_device
380
+ if prompt_embeds is None:
381
+ prompt_embeds, prompt_attention_mask = self.encode_prompt(prompt, max_sequence_length)
382
+ batch = prompt_embeds.shape[0]
383
+ def prepare(embeds, mask):
384
+ if embeds.ndim != 3 or embeds.shape[0] != batch:
385
+ raise ValueError('Prompt embeddings must be [B, S, C] with matching batch size.')
386
+ if mask is None:
387
+ mask = torch.ones(embeds.shape[:2], dtype=torch.bool, device=embeds.device)
388
+ return (embeds.to(device).repeat_interleave(num_images_per_prompt, 0),
389
+ mask.to(device).repeat_interleave(num_images_per_prompt, 0))
390
+ positive, positive_mask = prepare(prompt_embeds, prompt_attention_mask)
391
+ do_cfg = guidance_scale != 1.0
392
+ if do_cfg:
393
+ if negative_prompt_embeds is None:
394
+ negatives = [negative_prompt] * batch if isinstance(negative_prompt, str) else negative_prompt
395
+ if len(negatives) != batch:
396
+ raise ValueError('negative_prompt must match prompt batch size.')
397
+ negative_prompt_embeds, negative_prompt_attention_mask = self.encode_prompt(negatives, max_sequence_length)
398
+ negative, negative_mask = prepare(negative_prompt_embeds, negative_prompt_attention_mask)
399
+ shape = (batch * num_images_per_prompt, self.transformer.config.latent_channels, height // 16, width // 16)
400
+ if latents is None:
401
+ # Sample in fp32: promoting bf16 noise afterward cannot restore its precision.
402
+ latents = randn_tensor(shape, generator=generator, device=device, dtype=torch.float32)
403
+ elif tuple(latents.shape) != shape:
404
+ raise ValueError(f'latents must have shape {shape}.')
405
+ else:
406
+ latents = latents.to(device=device, dtype=torch.float32)
407
+ self.scheduler.set_timesteps(num_inference_steps, device=device)
408
+ num_steps = len(self.scheduler.timesteps)
409
+ for step_index, timestep in enumerate(self.progress_bar(self.scheduler.timesteps)):
410
+ skip_active = slg_start <= step_index / num_steps < slg_stop
411
+ # CFG must combine fp32 predictions, even when the DiT runs in bf16.
412
+ # Converting only the combined velocity would preserve rounding errors.
413
+ prediction = self.transformer(latents, timestep, positive, positive_mask).sample.float()
414
+ conditional = prediction
415
+ if do_cfg:
416
+ skip_kwargs = {'skip_layers': uncond_skip_layers} if uncond_skip_layers and skip_active else {}
417
+ uncond = self.transformer(latents, timestep, negative, negative_mask, **skip_kwargs).sample.float()
418
+ prediction = uncond + guidance_scale * (prediction - uncond)
419
+ if slg_layers and slg_scale > 0 and skip_active:
420
+ skipped = self.transformer(
421
+ latents, timestep, positive, positive_mask, skip_layers=slg_layers).sample.float()
422
+ if not do_cfg:
423
+ prediction = skipped
424
+ prediction = prediction + slg_scale * (conditional - skipped)
425
+ latents = self.scheduler.step(prediction, timestep, latents, return_dict=False)[0]
426
+ if output_type == 'latent':
427
+ images = latents
428
+ else:
429
+ if self.vae is None:
430
+ raise ValueError('A FLUX.2 VAE is required for decoded output.')
431
+ z = latents.to(dtype=self.vae.dtype)
432
+ bn = self.vae.bn
433
+ eps = self.vae.config.batch_norm_eps
434
+ z = z * (bn.running_var + eps).sqrt().to(z).view(1, -1, 1, 1) + bn.running_mean.to(z).view(1, -1, 1, 1)
435
+ b, c, h, w = z.shape
436
+ z = z.reshape(b, c // 4, 2, 2, h, w).permute(0, 1, 4, 2, 5, 3).reshape(b, c // 4, 2 * h, 2 * w)
437
+ images = self.vae.decode(z, return_dict=False)[0].clamp(-1, 1)
438
+ images = self.image_processor.postprocess(images, output_type=output_type)
439
+ self.maybe_free_model_hooks()
440
+ return ImagePipelineOutput(images=images) if return_dict else (images,)
scheduler/pipeline_moss_image.py ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """MOSSImage modeling and text-to-image pipeline (no Motor/TorchTitan imports).
2
+
3
+ Dependencies: torch>=2.9, diffusers>=0.38, transformers>=5.3, safetensors,
4
+ accelerate, Pillow. Copy this file anywhere and import it normally.
5
+
6
+ import torch
7
+ # Import MOSSImagePipeline from this file for component-level loading.
8
+ pipe = MOSSImagePipeline.from_components_pretrained(
9
+ transformer_path="exported_transformer", # save_pretrained directory
10
+ text_encoder_path="Qwen/Qwen3.5-9B",
11
+ vae_path="black-forest-labs/FLUX.2-klein-4B",
12
+ ).to("cuda")
13
+ pipe("A cat", generator=torch.Generator("cuda").manual_seed(42)).images[0].save("cat.png")
14
+
15
+ Default guidance uses CFG 3 and skips block 22 only in the negative branch
16
+ (zero-based main DiT block indices; two forwards per sampling step):
17
+ pipe("A cat", guidance_scale=3.0, uncond_skip_layers=[22])
18
+ pipe("A cat", uncond_skip_layers=[]) # disable negative-branch skipping
19
+ Optional additional positive-branch SLG adds a third forward:
20
+ pipe("A cat", slg_layers=[24], slg_scale=3.0)
21
+ The additional SLG layer/scale above illustrates the API, not a quality-tuned setting.
22
+
23
+ For a consolidated training state dict, create MOSSImageTransformer and
24
+ call load_training_state_dict(state), then save_pretrained("exported_transformer").
25
+ Select raw or EMA weights explicitly before calling it; distributed checkpoint
26
+ shards/optimizer states are not model state dicts. Defaults match the finalized dense MOSSImage model,
27
+ not MoE, CFG-distilled, video, or reference-image variants. Prompt strings are
28
+ already-rendered captions (dataset-specific quality/domain tags are not added).
29
+
30
+ First-release defaults: bf16 DiT/text-encoder weights, fp32 RoPE frequencies
31
+ and phase/sin/cos calculation, then RoPE cast to the video activation dtype.
32
+ Initial Gaussian noise is sampled directly in fp32, including with bf16 weights.
33
+ CFG and Euler latent updates use fp32; VAE decoding defaults to fp32. Scheduler
34
+ shift defaults to 5.0. Exact numerical parity with the original fp32-master
35
+ inference pipeline is not a release requirement.
36
+ """
37
+ from __future__ import annotations
38
+
39
+ import math
40
+ from pathlib import Path
41
+
42
+ import torch
43
+ from torch import nn
44
+ from torch.nn import functional as F
45
+ from diffusers import AutoencoderKLFlux2, DiffusionPipeline, FlowMatchEulerDiscreteScheduler
46
+ from diffusers.schedulers.scheduling_utils import SchedulerMixin # Required by custom-component discovery.
47
+ from diffusers.configuration_utils import ConfigMixin, register_to_config
48
+ from diffusers.image_processor import VaeImageProcessor
49
+ from diffusers.models.modeling_utils import ModelMixin
50
+ from diffusers.models.modeling_outputs import Transformer2DModelOutput
51
+ from diffusers.pipelines.pipeline_utils import ImagePipelineOutput
52
+ from diffusers.utils.torch_utils import randn_tensor
53
+ from transformers import AutoModel, AutoTokenizer
54
+
55
+
56
+ class _RMSNorm(nn.Module):
57
+ def __init__(self, dim):
58
+ super().__init__()
59
+ self.weight = nn.Parameter(torch.ones(dim))
60
+
61
+ def forward(self, x):
62
+ y = x.float() * torch.rsqrt(x.float().square().mean(-1, keepdim=True) + 1e-6)
63
+ return y.to(x.dtype) * self.weight
64
+
65
+
66
+ def _situ(hidden, gate):
67
+ return (4.0 * torch.tanh(gate / 4.0) * torch.sigmoid(gate)) * (25.0 * torch.tanh(hidden / 25.0))
68
+
69
+
70
+ def _validate_skip_layers(layers, depth, name='skip_layers'):
71
+ layers = () if layers is None else tuple(layers)
72
+ if any(type(index) is not int or not 0 <= index < depth for index in layers):
73
+ raise ValueError(f'{name} must contain integer block indices in [0, {depth}).')
74
+ return frozenset(layers)
75
+
76
+
77
+ def _rotate(x, rope):
78
+ sin, cos = rope.chunk(2, -1)
79
+ sin = torch.cat((sin, sin), -1).unsqueeze(-2)
80
+ cos = torch.cat((cos, cos), -1).unsqueeze(-2)
81
+ a, b = x.chunk(2, -1)
82
+ return x * cos + torch.cat((-b, a), -1) * sin
83
+
84
+
85
+ def _attention(q, k, v, rope, heads):
86
+ shape = (*q.shape[:2], heads, q.shape[-1] // heads)
87
+ q = _rotate(q.reshape(shape), rope).transpose(1, 2)
88
+ k = _rotate(k.reshape(shape), rope).transpose(1, 2)
89
+ v = v.reshape(shape).transpose(1, 2)
90
+ return F.scaled_dot_product_attention(q.to(v.dtype), k.to(v.dtype), v).transpose(1, 2).flatten(2)
91
+
92
+
93
+ class _TextBlock(nn.Module):
94
+ def __init__(self, dim, ffn_dim, heads):
95
+ super().__init__()
96
+ self.heads = heads
97
+ self.norm1, self.norm2 = _RMSNorm(dim), _RMSNorm(dim)
98
+ self.q_norm, self.k_norm = _RMSNorm(dim // heads), _RMSNorm(dim // heads)
99
+ self.qkv = nn.Linear(dim, 3 * dim)
100
+ self.proj = nn.Linear(dim, dim)
101
+ self.ffn_gate, self.ffn_up = nn.Linear(dim, ffn_dim), nn.Linear(dim, ffn_dim)
102
+ self.ffn_down = nn.Linear(ffn_dim, dim)
103
+
104
+ def forward(self, x, rope):
105
+ q, k, v = self.qkv(self.norm1(x)).chunk(3, -1)
106
+ q = self.q_norm(q.unflatten(-1, (self.heads, -1))).flatten(2)
107
+ k = self.k_norm(k.unflatten(-1, (self.heads, -1))).flatten(2)
108
+ x = x + self.proj(_attention(q, k, v, rope, self.heads))
109
+ y = self.norm2(x)
110
+ return x + self.ffn_down(_situ(self.ffn_up(y), self.ffn_gate(y)))
111
+
112
+
113
+ class _TextProjection(nn.Module):
114
+ def __init__(self, text_dim, dim, ffn_dim, heads):
115
+ super().__init__()
116
+ self.proj = nn.Linear(text_dim, dim)
117
+ self.blocks = nn.ModuleList([_TextBlock(dim, ffn_dim, heads) for _ in range(2)])
118
+
119
+ def forward(self, x, rope):
120
+ x = self.proj(x.to(self.proj.weight.dtype))
121
+ for block in self.blocks:
122
+ x = block(x, rope)
123
+ return x
124
+
125
+
126
+ class _Block(nn.Module):
127
+ def __init__(self, dim, ffn_dim, heads):
128
+ super().__init__()
129
+ self.heads = heads
130
+ self.norm1, self.norm2 = _RMSNorm(dim), _RMSNorm(dim)
131
+ self.q_norm, self.k_norm = _RMSNorm(dim // heads), _RMSNorm(dim // heads)
132
+ self.proj = nn.ModuleDict({
133
+ name: nn.Linear(dim, dim, bias=False) for name in ('q', 'k', 'v', 'o')
134
+ })
135
+ self.proj['ffn_up_gate'] = nn.Linear(dim, 2 * ffn_dim, bias=False)
136
+ self.proj['ffn_down'] = nn.Linear(ffn_dim, dim, bias=False)
137
+
138
+ def forward(self, x, rope, modulation):
139
+ shift_a, scale_a, gate_a, shift_f, scale_f, gate_f = modulation.unbind(1)
140
+ y = self.norm1(x) * (1 + scale_a[:, None]) + shift_a[:, None]
141
+ dtype = self.proj['q'].weight.dtype
142
+ y = y.to(dtype)
143
+ q = self.q_norm(self.proj['q'](y).unflatten(-1, (self.heads, -1))).flatten(2)
144
+ k = self.k_norm(self.proj['k'](y).unflatten(-1, (self.heads, -1))).flatten(2)
145
+ x = x + self.proj['o'](_attention(q, k, self.proj['v'](y), rope, self.heads)) * gate_a[:, None]
146
+ y = self.norm2(x) * (1 + scale_f[:, None]) + shift_f[:, None]
147
+ hidden, gate = self.proj['ffn_up_gate'](y.to(dtype)).chunk(2, -1)
148
+ return x + self.proj['ffn_down'](_situ(hidden, gate)) * gate_f[:, None]
149
+
150
+
151
+ class _RoPE(nn.Module):
152
+ def __init__(self, head_dim, base):
153
+ super().__init__()
154
+ self.num_bands = head_dim // 8
155
+ self.base = base
156
+ self.register_buffer('bands', self._default_bands(torch.device('cpu')))
157
+
158
+ def _default_bands(self, device):
159
+ # Match training's CPU fp32 construction, including under meta init.
160
+ exponent = torch.arange(self.num_bands, device='cpu', dtype=torch.float32) / self.num_bands
161
+ return (1 / (self.base ** exponent)).to(device)
162
+
163
+ def _apply(self, fn, recurse=True):
164
+ super()._apply(fn, recurse=recurse)
165
+ # .float() cannot recover frequencies already rounded by .to(bf16).
166
+ self.bands = self._default_bands(self.bands.device)
167
+ return self
168
+
169
+ def _load_from_state_dict(self, *args, **kwargs):
170
+ super()._load_from_state_dict(*args, **kwargs)
171
+ # Frequencies are derived constants; retain the key for checkpoint compatibility.
172
+ self.bands = self._default_bands(self.bands.device)
173
+
174
+ def forward(self, height, width, text_length, device):
175
+ # Diffusers/Accelerate can install tensors directly, bypassing load hooks.
176
+ if self.bands.dtype != torch.float32:
177
+ self.bands = self._default_bands(device)
178
+ # Coordinates: (r, f, h, w); sequence order is image followed by text.
179
+ h, w = torch.meshgrid(torch.arange(height, device=device), torch.arange(width, device=device), indexing='ij')
180
+ image = torch.stack((torch.zeros_like(h), torch.full_like(h, text_length), h, w), -1).flatten(0, 1).float()
181
+ image[:, 2] -= (height - 1) / 2
182
+ image[:, 3] -= (width - 1) / 2
183
+ text = torch.zeros(text_length, 4, device=device, dtype=torch.float32)
184
+ text[:, 1] = torch.arange(text_length, device=device)
185
+ phase = torch.cat((image, text), 0).unsqueeze(-1) * self.bands
186
+ return torch.cat((phase.sin(), phase.cos()), -2).flatten(-2).unsqueeze(0)
187
+
188
+
189
+ class MOSSImageTransformer(ModelMixin, ConfigMixin):
190
+ """MOSSImage DiT with training-compatible state-dict names and SDPA attention.
191
+
192
+ Each sample is evaluated at its true text length, including text refinement;
193
+ padded tokens cannot influence either text or joint attention.
194
+ """
195
+ @register_to_config
196
+ def __init__(self, dim=3072, ffn_dim=8192, num_heads=24, num_layers=42,
197
+ text_dim=4096, freq_dim=256, latent_channels=128, rope_base=10000.0):
198
+ super().__init__()
199
+ if dim % num_heads or (dim // num_heads) % 8 or freq_dim % 2:
200
+ raise ValueError('Require dim divisible by heads, head_dim divisible by 8, and even freq_dim.')
201
+ self.video_embedder = nn.Linear(latent_channels, dim)
202
+ self.text_embedder = _TextProjection(text_dim, dim, ffn_dim, num_heads)
203
+ self.rope = _RoPE(dim // num_heads, rope_base)
204
+ self.time_embedding = nn.Sequential(nn.Linear(freq_dim, dim), nn.SiLU(), nn.Linear(dim, dim))
205
+ self.shared_block_modulation = nn.Linear(dim, 6 * dim)
206
+ self.layers = nn.ModuleList([_Block(dim, ffn_dim, num_heads) for _ in range(num_layers)])
207
+ self.final_norm_video = _RMSNorm(dim)
208
+ self.final_linear_video = nn.Linear(dim, latent_channels, bias=False)
209
+ self.video_head_modulation = nn.Linear(dim, 2 * dim)
210
+
211
+ def load_training_state_dict(self, state_dict, *, prefix=''):
212
+ """Load a consolidated raw/EMA model mapping, strictly; no silent key drops."""
213
+ if prefix:
214
+ if any(not key.startswith(prefix) for key in state_dict):
215
+ raise ValueError('All keys must start with the explicit prefix.')
216
+ state_dict = {key[len(prefix):]: value for key, value in state_dict.items()}
217
+ return self.load_state_dict(state_dict, strict=True)
218
+
219
+ def forward(self, hidden_states, timestep, encoder_hidden_states,
220
+ encoder_attention_mask=None, return_dict=True, skip_layers=None):
221
+ skip_layers = _validate_skip_layers(skip_layers, len(self.layers))
222
+ if hidden_states.ndim != 4 or hidden_states.shape[1] != self.config.latent_channels:
223
+ raise ValueError('hidden_states must be [B, latent_channels, H, W].')
224
+ batch, _, height, width = hidden_states.shape
225
+ if encoder_hidden_states.ndim != 3 or encoder_hidden_states.shape[0] != batch:
226
+ raise ValueError('encoder_hidden_states must be [B, S, text_dim].')
227
+ mask = encoder_attention_mask
228
+ if mask is None:
229
+ mask = torch.ones(encoder_hidden_states.shape[:2], dtype=torch.bool, device=hidden_states.device)
230
+ if mask.shape != encoder_hidden_states.shape[:2] or not torch.all((mask == 0) | (mask == 1)):
231
+ raise ValueError('encoder_attention_mask must be a binary [B, S] mask.')
232
+ times = torch.as_tensor(timestep, device=hidden_states.device, dtype=torch.float32).reshape(-1)
233
+ times = times.expand(batch)
234
+ # Training computes the sinusoid in float64 and feeds float32 into its MLP.
235
+ half = self.config.freq_dim // 2
236
+ freq = 10000 ** (-torch.arange(half, device=times.device, dtype=torch.float64) / half)
237
+ phase = times.double()[:, None] * freq
238
+ embedding = torch.cat((phase.cos(), phase.sin()), -1).float()
239
+ time = self.time_embedding(embedding.to(self.time_embedding[0].weight.dtype)).float()
240
+ mod = self.shared_block_modulation(time.to(self.shared_block_modulation.weight.dtype)).view(batch, 6, -1)
241
+ head = self.video_head_modulation(time.to(self.video_head_modulation.weight.dtype)).view(batch, 2, -1)
242
+ outputs = []
243
+ for index in range(batch):
244
+ context = encoder_hidden_states[index:index + 1, mask[index].bool()]
245
+ if context.shape[1] == 0:
246
+ raise ValueError('Each sample needs at least one valid text token.')
247
+ video = hidden_states[index:index + 1].flatten(2).transpose(1, 2)
248
+ video = self.video_embedder(video.to(self.video_embedder.weight.dtype).contiguous())
249
+ # Match the reference activation dtype under fp32 weights + autocast.
250
+ rope = self.rope(height, width, context.shape[1], hidden_states.device).to(video.dtype)
251
+ text = self.text_embedder(context, rope[:, height * width:])
252
+ x = torch.cat((video, text), 1)
253
+ for layer_index, layer in enumerate(self.layers):
254
+ if layer_index not in skip_layers:
255
+ x = layer(x, rope, mod[index:index + 1])
256
+ x = self.final_norm_video(x[:, :height * width].to(self.final_norm_video.weight.dtype))
257
+ x = x * (1 + head[index:index + 1, 1, None]) + head[index:index + 1, 0, None]
258
+ x = self.final_linear_video(x.to(self.final_linear_video.weight.dtype))
259
+ outputs.append(x.transpose(1, 2).reshape(1, -1, height, width))
260
+ sample = torch.cat(outputs)
261
+ return Transformer2DModelOutput(sample=sample) if return_dict else (sample,)
262
+
263
+
264
+ class MOSSImageScheduler(FlowMatchEulerDiscreteScheduler):
265
+ """Euler integration using the training project's V2, nearest-grid schedule."""
266
+ @register_to_config
267
+ def __init__(self, num_train_timesteps=1000, shift=5.0, training_shift=1.0):
268
+ super().__init__(num_train_timesteps=num_train_timesteps, shift=1.0)
269
+ self.register_to_config(shift=shift, training_shift=training_shift)
270
+
271
+ def set_timesteps(self, num_inference_steps=50, device=None):
272
+ if num_inference_steps < 1 or self.config.shift <= 0 or self.config.training_shift <= 0:
273
+ raise ValueError('Steps and shifts must be positive.')
274
+ total = self.config.num_train_timesteps
275
+ def grid(count, shift):
276
+ lower = shift / (total + shift - 1)
277
+ values = torch.linspace(1, lower, count)
278
+ return shift * values / (1 + (shift - 1) * values)
279
+ sigmas = grid(num_inference_steps, self.config.shift)
280
+ training = grid(total, self.config.training_shift).flip(0)
281
+ upper = torch.searchsorted(training, sigmas).clamp(max=total - 1)
282
+ lower = (upper - 1).clamp(min=0)
283
+ nearest = torch.where((sigmas - training[lower]).abs() <= (training[upper] - sigmas).abs(), lower, upper)
284
+ sigmas = torch.unique_consecutive(training[nearest])
285
+ # Our sigmas have already been shifted and snapped. Avoid a second shift.
286
+ self._shift = 1.0
287
+ super().set_timesteps(device=device, sigmas=sigmas.tolist())
288
+
289
+
290
+ class MOSSImagePipeline(DiffusionPipeline):
291
+ model_cpu_offload_seq = 'text_encoder->transformer->vae'
292
+ _optional_components = ['text_encoder', 'tokenizer', 'vae']
293
+
294
+ def __init__(self, transformer: MOSSImageTransformer,
295
+ scheduler: MOSSImageScheduler, text_encoder=None, tokenizer=None, vae=None):
296
+ super().__init__()
297
+ self.register_modules(transformer=transformer, scheduler=scheduler,
298
+ text_encoder=text_encoder, tokenizer=tokenizer, vae=vae)
299
+ self.image_processor = VaeImageProcessor(vae_scale_factor=16)
300
+
301
+ @classmethod
302
+ def from_components_pretrained(cls, transformer_path, text_encoder_path, vae_path,
303
+ torch_dtype=torch.bfloat16, vae_dtype=torch.float32,
304
+ local_files_only=False):
305
+ common = dict(local_files_only=local_files_only)
306
+ transformer = MOSSImageTransformer.from_pretrained(transformer_path, torch_dtype=torch_dtype, **common)
307
+ tokenizer = AutoTokenizer.from_pretrained(text_encoder_path, **common)
308
+ text_encoder = AutoModel.from_pretrained(text_encoder_path, dtype=torch_dtype, **common).eval()
309
+ subfolder = None if (Path(vae_path) / 'config.json').is_file() else 'vae'
310
+ vae = AutoencoderKLFlux2.from_pretrained(vae_path, subfolder=subfolder, torch_dtype=vae_dtype, **common).eval()
311
+ return cls(transformer.eval(), MOSSImageScheduler(), text_encoder, tokenizer, vae)
312
+
313
+ @torch.no_grad()
314
+ def encode_prompt(self, prompt, max_sequence_length=4096):
315
+ if self.text_encoder is None or self.tokenizer is None:
316
+ raise ValueError('Text encoder/tokenizer required for string prompts.')
317
+ prompts = [prompt] if isinstance(prompt, str) else list(prompt)
318
+ if not prompts or not all(isinstance(p, str) for p in prompts):
319
+ raise ValueError('prompt must be a string or a nonempty list of strings.')
320
+ rows = []
321
+ # Unpadded individual forwards also avoid padding effects in Qwen GDN.
322
+ for value in prompts:
323
+ formatted = self.tokenizer.apply_chat_template(
324
+ [{'role': 'user', 'content': value}], tokenize=False,
325
+ add_generation_prompt=True, enable_thinking=True)
326
+ inputs = self.tokenizer(formatted, return_tensors='pt', truncation=True,
327
+ max_length=max_sequence_length).to(self._execution_device)
328
+ output = self.text_encoder(**inputs, use_cache=False, return_dict=True)
329
+ rows.append(output.last_hidden_state[0])
330
+ length = max(row.shape[0] for row in rows)
331
+ embeds = rows[0].new_zeros(len(rows), length, rows[0].shape[-1])
332
+ mask = torch.zeros(len(rows), length, device=embeds.device, dtype=torch.bool)
333
+ for index, row in enumerate(rows):
334
+ embeds[index, :row.shape[0]] = row
335
+ mask[index, :row.shape[0]] = True
336
+ return embeds, mask
337
+
338
+ @torch.no_grad()
339
+ def __call__(self, prompt=None, *, height=1024, width=1024, num_inference_steps=50,
340
+ guidance_scale=3.0, negative_prompt='', num_images_per_prompt=1,
341
+ generator=None, latents=None, prompt_embeds=None, prompt_attention_mask=None,
342
+ negative_prompt_embeds=None, negative_prompt_attention_mask=None,
343
+ max_sequence_length=4096, output_type='pil', return_dict=True,
344
+ uncond_skip_layers=(22,), slg_layers=None, slg_scale=0.0,
345
+ slg_start=0.0, slg_stop=1.0):
346
+ """Generate images with optional full-block skipping (zero-based indices).
347
+
348
+ uncond_skip_layers defaults to (22,) and replaces CFG's negative-prompt
349
+ prediction with a skipped-block prediction, retaining two forwards per
350
+ step. Pass None or an empty sequence to disable skipping. slg_layers
351
+ adds a skipped positive-prompt forward and the fp32 correction
352
+ slg_scale * (cond - cond_skip) to CFG. With guidance_scale=1, active
353
+ SLG uses cond_skip + slg_scale * (cond - cond_skip), matching Diffusers'
354
+ default SkipLayerGuidance formulation, with two forwards and no negative
355
+ branch. Both options can combine. slg_scale=1 then gives normal cond.
356
+ Both uncond skipping and SLG are active where
357
+ slg_start <= step_index / num_steps < slg_stop;
358
+ the interval follows denoising order, from initial noise to final image.
359
+ Outside it, inference uses normal CFG without skipping.
360
+ slg_scale=0 or empty slg_layers disables the additional forward.
361
+ """
362
+ uncond_skip_layers = _validate_skip_layers(
363
+ uncond_skip_layers, len(self.transformer.layers), 'uncond_skip_layers')
364
+ slg_layers = _validate_skip_layers(slg_layers, len(self.transformer.layers), 'slg_layers')
365
+ if not math.isfinite(slg_scale) or slg_scale < 0:
366
+ raise ValueError('slg_scale must be finite and nonnegative.')
367
+ if not 0 <= slg_start <= slg_stop <= 1:
368
+ raise ValueError('Require 0 <= slg_start <= slg_stop <= 1.')
369
+ if height <= 0 or width <= 0 or height % 16 or width % 16:
370
+ raise ValueError('height and width must be positive multiples of 16.')
371
+ if output_type not in {'pil', 'np', 'pt', 'latent'}:
372
+ raise ValueError('output_type must be pil, np, pt or latent.')
373
+ if num_images_per_prompt < 1 or not math.isfinite(guidance_scale) or guidance_scale < 0:
374
+ raise ValueError('Invalid image count or guidance scale.')
375
+ if not 1 <= max_sequence_length <= 4096:
376
+ raise ValueError('max_sequence_length must be between 1 and 4096.')
377
+ if (prompt is None) == (prompt_embeds is None):
378
+ raise ValueError('Provide exactly one of prompt and prompt_embeds.')
379
+ device = self._execution_device
380
+ if prompt_embeds is None:
381
+ prompt_embeds, prompt_attention_mask = self.encode_prompt(prompt, max_sequence_length)
382
+ batch = prompt_embeds.shape[0]
383
+ def prepare(embeds, mask):
384
+ if embeds.ndim != 3 or embeds.shape[0] != batch:
385
+ raise ValueError('Prompt embeddings must be [B, S, C] with matching batch size.')
386
+ if mask is None:
387
+ mask = torch.ones(embeds.shape[:2], dtype=torch.bool, device=embeds.device)
388
+ return (embeds.to(device).repeat_interleave(num_images_per_prompt, 0),
389
+ mask.to(device).repeat_interleave(num_images_per_prompt, 0))
390
+ positive, positive_mask = prepare(prompt_embeds, prompt_attention_mask)
391
+ do_cfg = guidance_scale != 1.0
392
+ if do_cfg:
393
+ if negative_prompt_embeds is None:
394
+ negatives = [negative_prompt] * batch if isinstance(negative_prompt, str) else negative_prompt
395
+ if len(negatives) != batch:
396
+ raise ValueError('negative_prompt must match prompt batch size.')
397
+ negative_prompt_embeds, negative_prompt_attention_mask = self.encode_prompt(negatives, max_sequence_length)
398
+ negative, negative_mask = prepare(negative_prompt_embeds, negative_prompt_attention_mask)
399
+ shape = (batch * num_images_per_prompt, self.transformer.config.latent_channels, height // 16, width // 16)
400
+ if latents is None:
401
+ # Sample in fp32: promoting bf16 noise afterward cannot restore its precision.
402
+ latents = randn_tensor(shape, generator=generator, device=device, dtype=torch.float32)
403
+ elif tuple(latents.shape) != shape:
404
+ raise ValueError(f'latents must have shape {shape}.')
405
+ else:
406
+ latents = latents.to(device=device, dtype=torch.float32)
407
+ self.scheduler.set_timesteps(num_inference_steps, device=device)
408
+ num_steps = len(self.scheduler.timesteps)
409
+ for step_index, timestep in enumerate(self.progress_bar(self.scheduler.timesteps)):
410
+ skip_active = slg_start <= step_index / num_steps < slg_stop
411
+ # CFG must combine fp32 predictions, even when the DiT runs in bf16.
412
+ # Converting only the combined velocity would preserve rounding errors.
413
+ prediction = self.transformer(latents, timestep, positive, positive_mask).sample.float()
414
+ conditional = prediction
415
+ if do_cfg:
416
+ skip_kwargs = {'skip_layers': uncond_skip_layers} if uncond_skip_layers and skip_active else {}
417
+ uncond = self.transformer(latents, timestep, negative, negative_mask, **skip_kwargs).sample.float()
418
+ prediction = uncond + guidance_scale * (prediction - uncond)
419
+ if slg_layers and slg_scale > 0 and skip_active:
420
+ skipped = self.transformer(
421
+ latents, timestep, positive, positive_mask, skip_layers=slg_layers).sample.float()
422
+ if not do_cfg:
423
+ prediction = skipped
424
+ prediction = prediction + slg_scale * (conditional - skipped)
425
+ latents = self.scheduler.step(prediction, timestep, latents, return_dict=False)[0]
426
+ if output_type == 'latent':
427
+ images = latents
428
+ else:
429
+ if self.vae is None:
430
+ raise ValueError('A FLUX.2 VAE is required for decoded output.')
431
+ z = latents.to(dtype=self.vae.dtype)
432
+ bn = self.vae.bn
433
+ eps = self.vae.config.batch_norm_eps
434
+ z = z * (bn.running_var + eps).sqrt().to(z).view(1, -1, 1, 1) + bn.running_mean.to(z).view(1, -1, 1, 1)
435
+ b, c, h, w = z.shape
436
+ z = z.reshape(b, c // 4, 2, 2, h, w).permute(0, 1, 4, 2, 5, 3).reshape(b, c // 4, 2 * h, 2 * w)
437
+ images = self.vae.decode(z, return_dict=False)[0].clamp(-1, 1)
438
+ images = self.image_processor.postprocess(images, output_type=output_type)
439
+ self.maybe_free_model_hooks()
440
+ return ImagePipelineOutput(images=images) if return_dict else (images,)
scheduler/scheduler_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "MOSSImageScheduler",
3
+ "_diffusers_version": "0.38.0",
4
+ "base_image_seq_len": 256,
5
+ "base_shift": 0.5,
6
+ "invert_sigmas": false,
7
+ "max_image_seq_len": 4096,
8
+ "max_shift": 1.15,
9
+ "num_train_timesteps": 1000,
10
+ "shift": 5.0,
11
+ "shift_terminal": null,
12
+ "stochastic_sampling": false,
13
+ "time_shift_type": "exponential",
14
+ "training_shift": 1.0,
15
+ "use_beta_sigmas": false,
16
+ "use_dynamic_shifting": false,
17
+ "use_exponential_sigmas": false,
18
+ "use_karras_sigmas": false
19
+ }
text_encoder/config.json ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5Model"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "image_token_id": 248056,
7
+ "model_type": "qwen3_5",
8
+ "text_config": {
9
+ "attention_bias": false,
10
+ "attention_dropout": 0.0,
11
+ "attn_output_gate": true,
12
+ "bos_token_id": null,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": 248044,
15
+ "full_attention_interval": 4,
16
+ "head_dim": 256,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 4096,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 12288,
21
+ "layer_types": [
22
+ "linear_attention",
23
+ "linear_attention",
24
+ "linear_attention",
25
+ "full_attention",
26
+ "linear_attention",
27
+ "linear_attention",
28
+ "linear_attention",
29
+ "full_attention",
30
+ "linear_attention",
31
+ "linear_attention",
32
+ "linear_attention",
33
+ "full_attention",
34
+ "linear_attention",
35
+ "linear_attention",
36
+ "linear_attention",
37
+ "full_attention",
38
+ "linear_attention",
39
+ "linear_attention",
40
+ "linear_attention",
41
+ "full_attention",
42
+ "linear_attention",
43
+ "linear_attention",
44
+ "linear_attention",
45
+ "full_attention",
46
+ "linear_attention",
47
+ "linear_attention",
48
+ "linear_attention",
49
+ "full_attention",
50
+ "linear_attention",
51
+ "linear_attention",
52
+ "linear_attention",
53
+ "full_attention"
54
+ ],
55
+ "linear_conv_kernel_dim": 4,
56
+ "linear_key_head_dim": 128,
57
+ "linear_num_key_heads": 16,
58
+ "linear_num_value_heads": 32,
59
+ "linear_value_head_dim": 128,
60
+ "mamba_ssm_dtype": "float32",
61
+ "max_position_embeddings": 262144,
62
+ "mlp_only_layers": [],
63
+ "model_type": "qwen3_5_text",
64
+ "mtp_num_hidden_layers": 1,
65
+ "mtp_use_dedicated_embeddings": false,
66
+ "num_attention_heads": 16,
67
+ "num_hidden_layers": 32,
68
+ "num_key_value_heads": 4,
69
+ "pad_token_id": null,
70
+ "partial_rotary_factor": 0.25,
71
+ "rms_norm_eps": 1e-06,
72
+ "rope_parameters": {
73
+ "mrope_interleaved": true,
74
+ "mrope_section": [
75
+ 11,
76
+ 11,
77
+ 10
78
+ ],
79
+ "partial_rotary_factor": 0.25,
80
+ "rope_theta": 10000000,
81
+ "rope_type": "default"
82
+ },
83
+ "tie_word_embeddings": false,
84
+ "use_cache": true,
85
+ "vocab_size": 248320
86
+ },
87
+ "tie_word_embeddings": false,
88
+ "transformers_version": "5.12.1",
89
+ "video_token_id": 248057,
90
+ "vision_config": {
91
+ "deepstack_visual_indexes": [],
92
+ "depth": 27,
93
+ "dtype": "bfloat16",
94
+ "hidden_act": "gelu_pytorch_tanh",
95
+ "hidden_size": 1152,
96
+ "in_channels": 3,
97
+ "initializer_range": 0.02,
98
+ "intermediate_size": 4304,
99
+ "model_type": "qwen3_5_vision",
100
+ "num_heads": 16,
101
+ "num_position_embeddings": 2304,
102
+ "out_hidden_size": 4096,
103
+ "patch_size": 16,
104
+ "spatial_merge_size": 2,
105
+ "temporal_patch_size": 2
106
+ },
107
+ "vision_end_token_id": 248054,
108
+ "vision_start_token_id": 248053
109
+ }
text_encoder/model-00001-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abfaa3d3a8612508c85ee8f6da9c734b862f10298b903765c4ad384177c32b0b
3
+ size 4973910744
text_encoder/model-00002-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9112637fa6bf4d07bafd6ae268852b18d3d0c1242f4ee901c5579006e5bd4894
3
+ size 4988364288
text_encoder/model-00003-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:956f1ef51d0cfe610b0d22987c0b7821c36e3ce228abceccef523518bcf079dc
3
+ size 4954202112
text_encoder/model-00004-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e21d20e8adde88c3e0b65d4a0d251f143d98ee9d52db36b4348361091e4e208
3
+ size 1869001848
text_encoder/model.safetensors.index.json ADDED
@@ -0,0 +1,767 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_parameters": 8392695024,
4
+ "total_size": 16785390048
5
+ },
6
+ "weight_map": {
7
+ "language_model.embed_tokens.weight": "model-00001-of-00004.safetensors",
8
+ "language_model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors",
9
+ "language_model.layers.0.linear_attn.A_log": "model-00001-of-00004.safetensors",
10
+ "language_model.layers.0.linear_attn.conv1d.weight": "model-00001-of-00004.safetensors",
11
+ "language_model.layers.0.linear_attn.dt_bias": "model-00001-of-00004.safetensors",
12
+ "language_model.layers.0.linear_attn.in_proj_a.weight": "model-00001-of-00004.safetensors",
13
+ "language_model.layers.0.linear_attn.in_proj_b.weight": "model-00001-of-00004.safetensors",
14
+ "language_model.layers.0.linear_attn.in_proj_qkv.weight": "model-00001-of-00004.safetensors",
15
+ "language_model.layers.0.linear_attn.in_proj_z.weight": "model-00001-of-00004.safetensors",
16
+ "language_model.layers.0.linear_attn.norm.weight": "model-00001-of-00004.safetensors",
17
+ "language_model.layers.0.linear_attn.out_proj.weight": "model-00001-of-00004.safetensors",
18
+ "language_model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
19
+ "language_model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
20
+ "language_model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
21
+ "language_model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
22
+ "language_model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors",
23
+ "language_model.layers.1.linear_attn.A_log": "model-00001-of-00004.safetensors",
24
+ "language_model.layers.1.linear_attn.conv1d.weight": "model-00001-of-00004.safetensors",
25
+ "language_model.layers.1.linear_attn.dt_bias": "model-00001-of-00004.safetensors",
26
+ "language_model.layers.1.linear_attn.in_proj_a.weight": "model-00001-of-00004.safetensors",
27
+ "language_model.layers.1.linear_attn.in_proj_b.weight": "model-00001-of-00004.safetensors",
28
+ "language_model.layers.1.linear_attn.in_proj_qkv.weight": "model-00001-of-00004.safetensors",
29
+ "language_model.layers.1.linear_attn.in_proj_z.weight": "model-00001-of-00004.safetensors",
30
+ "language_model.layers.1.linear_attn.norm.weight": "model-00001-of-00004.safetensors",
31
+ "language_model.layers.1.linear_attn.out_proj.weight": "model-00001-of-00004.safetensors",
32
+ "language_model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
33
+ "language_model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
34
+ "language_model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
35
+ "language_model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
36
+ "language_model.layers.10.input_layernorm.weight": "model-00002-of-00004.safetensors",
37
+ "language_model.layers.10.linear_attn.A_log": "model-00002-of-00004.safetensors",
38
+ "language_model.layers.10.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
39
+ "language_model.layers.10.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
40
+ "language_model.layers.10.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
41
+ "language_model.layers.10.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
42
+ "language_model.layers.10.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
43
+ "language_model.layers.10.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
44
+ "language_model.layers.10.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
45
+ "language_model.layers.10.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
46
+ "language_model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
47
+ "language_model.layers.10.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
48
+ "language_model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
49
+ "language_model.layers.10.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
50
+ "language_model.layers.11.input_layernorm.weight": "model-00002-of-00004.safetensors",
51
+ "language_model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
52
+ "language_model.layers.11.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
53
+ "language_model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
54
+ "language_model.layers.11.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
55
+ "language_model.layers.11.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
56
+ "language_model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
57
+ "language_model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
58
+ "language_model.layers.11.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
59
+ "language_model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
60
+ "language_model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
61
+ "language_model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors",
62
+ "language_model.layers.12.linear_attn.A_log": "model-00002-of-00004.safetensors",
63
+ "language_model.layers.12.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
64
+ "language_model.layers.12.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
65
+ "language_model.layers.12.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
66
+ "language_model.layers.12.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
67
+ "language_model.layers.12.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
68
+ "language_model.layers.12.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
69
+ "language_model.layers.12.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
70
+ "language_model.layers.12.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
71
+ "language_model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
72
+ "language_model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
73
+ "language_model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
74
+ "language_model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
75
+ "language_model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors",
76
+ "language_model.layers.13.linear_attn.A_log": "model-00002-of-00004.safetensors",
77
+ "language_model.layers.13.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
78
+ "language_model.layers.13.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
79
+ "language_model.layers.13.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
80
+ "language_model.layers.13.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
81
+ "language_model.layers.13.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
82
+ "language_model.layers.13.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
83
+ "language_model.layers.13.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
84
+ "language_model.layers.13.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
85
+ "language_model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
86
+ "language_model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
87
+ "language_model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
88
+ "language_model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
89
+ "language_model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors",
90
+ "language_model.layers.14.linear_attn.A_log": "model-00002-of-00004.safetensors",
91
+ "language_model.layers.14.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
92
+ "language_model.layers.14.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
93
+ "language_model.layers.14.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
94
+ "language_model.layers.14.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
95
+ "language_model.layers.14.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
96
+ "language_model.layers.14.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
97
+ "language_model.layers.14.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
98
+ "language_model.layers.14.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
99
+ "language_model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
100
+ "language_model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
101
+ "language_model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
102
+ "language_model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
103
+ "language_model.layers.15.input_layernorm.weight": "model-00002-of-00004.safetensors",
104
+ "language_model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
105
+ "language_model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
106
+ "language_model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
107
+ "language_model.layers.15.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
108
+ "language_model.layers.15.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
109
+ "language_model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
110
+ "language_model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
111
+ "language_model.layers.15.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
112
+ "language_model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
113
+ "language_model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
114
+ "language_model.layers.16.input_layernorm.weight": "model-00002-of-00004.safetensors",
115
+ "language_model.layers.16.linear_attn.A_log": "model-00002-of-00004.safetensors",
116
+ "language_model.layers.16.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
117
+ "language_model.layers.16.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
118
+ "language_model.layers.16.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
119
+ "language_model.layers.16.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
120
+ "language_model.layers.16.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
121
+ "language_model.layers.16.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
122
+ "language_model.layers.16.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
123
+ "language_model.layers.16.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
124
+ "language_model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
125
+ "language_model.layers.16.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
126
+ "language_model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
127
+ "language_model.layers.16.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
128
+ "language_model.layers.17.input_layernorm.weight": "model-00002-of-00004.safetensors",
129
+ "language_model.layers.17.linear_attn.A_log": "model-00002-of-00004.safetensors",
130
+ "language_model.layers.17.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
131
+ "language_model.layers.17.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
132
+ "language_model.layers.17.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
133
+ "language_model.layers.17.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
134
+ "language_model.layers.17.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
135
+ "language_model.layers.17.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
136
+ "language_model.layers.17.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
137
+ "language_model.layers.17.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
138
+ "language_model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
139
+ "language_model.layers.17.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
140
+ "language_model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
141
+ "language_model.layers.17.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
142
+ "language_model.layers.18.input_layernorm.weight": "model-00002-of-00004.safetensors",
143
+ "language_model.layers.18.linear_attn.A_log": "model-00002-of-00004.safetensors",
144
+ "language_model.layers.18.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
145
+ "language_model.layers.18.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
146
+ "language_model.layers.18.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
147
+ "language_model.layers.18.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
148
+ "language_model.layers.18.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
149
+ "language_model.layers.18.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
150
+ "language_model.layers.18.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
151
+ "language_model.layers.18.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
152
+ "language_model.layers.18.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
153
+ "language_model.layers.18.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
154
+ "language_model.layers.18.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
155
+ "language_model.layers.18.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
156
+ "language_model.layers.19.input_layernorm.weight": "model-00003-of-00004.safetensors",
157
+ "language_model.layers.19.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
158
+ "language_model.layers.19.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
159
+ "language_model.layers.19.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
160
+ "language_model.layers.19.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
161
+ "language_model.layers.19.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
162
+ "language_model.layers.19.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
163
+ "language_model.layers.19.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
164
+ "language_model.layers.19.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
165
+ "language_model.layers.19.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
166
+ "language_model.layers.19.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
167
+ "language_model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors",
168
+ "language_model.layers.2.linear_attn.A_log": "model-00001-of-00004.safetensors",
169
+ "language_model.layers.2.linear_attn.conv1d.weight": "model-00001-of-00004.safetensors",
170
+ "language_model.layers.2.linear_attn.dt_bias": "model-00001-of-00004.safetensors",
171
+ "language_model.layers.2.linear_attn.in_proj_a.weight": "model-00001-of-00004.safetensors",
172
+ "language_model.layers.2.linear_attn.in_proj_b.weight": "model-00001-of-00004.safetensors",
173
+ "language_model.layers.2.linear_attn.in_proj_qkv.weight": "model-00001-of-00004.safetensors",
174
+ "language_model.layers.2.linear_attn.in_proj_z.weight": "model-00001-of-00004.safetensors",
175
+ "language_model.layers.2.linear_attn.norm.weight": "model-00001-of-00004.safetensors",
176
+ "language_model.layers.2.linear_attn.out_proj.weight": "model-00001-of-00004.safetensors",
177
+ "language_model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
178
+ "language_model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
179
+ "language_model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
180
+ "language_model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
181
+ "language_model.layers.20.input_layernorm.weight": "model-00003-of-00004.safetensors",
182
+ "language_model.layers.20.linear_attn.A_log": "model-00003-of-00004.safetensors",
183
+ "language_model.layers.20.linear_attn.conv1d.weight": "model-00003-of-00004.safetensors",
184
+ "language_model.layers.20.linear_attn.dt_bias": "model-00003-of-00004.safetensors",
185
+ "language_model.layers.20.linear_attn.in_proj_a.weight": "model-00003-of-00004.safetensors",
186
+ "language_model.layers.20.linear_attn.in_proj_b.weight": "model-00003-of-00004.safetensors",
187
+ "language_model.layers.20.linear_attn.in_proj_qkv.weight": "model-00003-of-00004.safetensors",
188
+ "language_model.layers.20.linear_attn.in_proj_z.weight": "model-00003-of-00004.safetensors",
189
+ "language_model.layers.20.linear_attn.norm.weight": "model-00003-of-00004.safetensors",
190
+ "language_model.layers.20.linear_attn.out_proj.weight": "model-00003-of-00004.safetensors",
191
+ "language_model.layers.20.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
192
+ "language_model.layers.20.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
193
+ "language_model.layers.20.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
194
+ "language_model.layers.20.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
195
+ "language_model.layers.21.input_layernorm.weight": "model-00003-of-00004.safetensors",
196
+ "language_model.layers.21.linear_attn.A_log": "model-00003-of-00004.safetensors",
197
+ "language_model.layers.21.linear_attn.conv1d.weight": "model-00003-of-00004.safetensors",
198
+ "language_model.layers.21.linear_attn.dt_bias": "model-00003-of-00004.safetensors",
199
+ "language_model.layers.21.linear_attn.in_proj_a.weight": "model-00003-of-00004.safetensors",
200
+ "language_model.layers.21.linear_attn.in_proj_b.weight": "model-00003-of-00004.safetensors",
201
+ "language_model.layers.21.linear_attn.in_proj_qkv.weight": "model-00003-of-00004.safetensors",
202
+ "language_model.layers.21.linear_attn.in_proj_z.weight": "model-00003-of-00004.safetensors",
203
+ "language_model.layers.21.linear_attn.norm.weight": "model-00003-of-00004.safetensors",
204
+ "language_model.layers.21.linear_attn.out_proj.weight": "model-00003-of-00004.safetensors",
205
+ "language_model.layers.21.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
206
+ "language_model.layers.21.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
207
+ "language_model.layers.21.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
208
+ "language_model.layers.21.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
209
+ "language_model.layers.22.input_layernorm.weight": "model-00003-of-00004.safetensors",
210
+ "language_model.layers.22.linear_attn.A_log": "model-00003-of-00004.safetensors",
211
+ "language_model.layers.22.linear_attn.conv1d.weight": "model-00003-of-00004.safetensors",
212
+ "language_model.layers.22.linear_attn.dt_bias": "model-00003-of-00004.safetensors",
213
+ "language_model.layers.22.linear_attn.in_proj_a.weight": "model-00003-of-00004.safetensors",
214
+ "language_model.layers.22.linear_attn.in_proj_b.weight": "model-00003-of-00004.safetensors",
215
+ "language_model.layers.22.linear_attn.in_proj_qkv.weight": "model-00003-of-00004.safetensors",
216
+ "language_model.layers.22.linear_attn.in_proj_z.weight": "model-00003-of-00004.safetensors",
217
+ "language_model.layers.22.linear_attn.norm.weight": "model-00003-of-00004.safetensors",
218
+ "language_model.layers.22.linear_attn.out_proj.weight": "model-00003-of-00004.safetensors",
219
+ "language_model.layers.22.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
220
+ "language_model.layers.22.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
221
+ "language_model.layers.22.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
222
+ "language_model.layers.22.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
223
+ "language_model.layers.23.input_layernorm.weight": "model-00003-of-00004.safetensors",
224
+ "language_model.layers.23.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
225
+ "language_model.layers.23.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
226
+ "language_model.layers.23.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
227
+ "language_model.layers.23.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
228
+ "language_model.layers.23.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
229
+ "language_model.layers.23.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
230
+ "language_model.layers.23.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
231
+ "language_model.layers.23.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
232
+ "language_model.layers.23.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
233
+ "language_model.layers.23.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
234
+ "language_model.layers.24.input_layernorm.weight": "model-00003-of-00004.safetensors",
235
+ "language_model.layers.24.linear_attn.A_log": "model-00003-of-00004.safetensors",
236
+ "language_model.layers.24.linear_attn.conv1d.weight": "model-00003-of-00004.safetensors",
237
+ "language_model.layers.24.linear_attn.dt_bias": "model-00003-of-00004.safetensors",
238
+ "language_model.layers.24.linear_attn.in_proj_a.weight": "model-00003-of-00004.safetensors",
239
+ "language_model.layers.24.linear_attn.in_proj_b.weight": "model-00003-of-00004.safetensors",
240
+ "language_model.layers.24.linear_attn.in_proj_qkv.weight": "model-00003-of-00004.safetensors",
241
+ "language_model.layers.24.linear_attn.in_proj_z.weight": "model-00003-of-00004.safetensors",
242
+ "language_model.layers.24.linear_attn.norm.weight": "model-00003-of-00004.safetensors",
243
+ "language_model.layers.24.linear_attn.out_proj.weight": "model-00003-of-00004.safetensors",
244
+ "language_model.layers.24.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
245
+ "language_model.layers.24.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
246
+ "language_model.layers.24.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
247
+ "language_model.layers.24.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
248
+ "language_model.layers.25.input_layernorm.weight": "model-00003-of-00004.safetensors",
249
+ "language_model.layers.25.linear_attn.A_log": "model-00003-of-00004.safetensors",
250
+ "language_model.layers.25.linear_attn.conv1d.weight": "model-00003-of-00004.safetensors",
251
+ "language_model.layers.25.linear_attn.dt_bias": "model-00003-of-00004.safetensors",
252
+ "language_model.layers.25.linear_attn.in_proj_a.weight": "model-00003-of-00004.safetensors",
253
+ "language_model.layers.25.linear_attn.in_proj_b.weight": "model-00003-of-00004.safetensors",
254
+ "language_model.layers.25.linear_attn.in_proj_qkv.weight": "model-00003-of-00004.safetensors",
255
+ "language_model.layers.25.linear_attn.in_proj_z.weight": "model-00003-of-00004.safetensors",
256
+ "language_model.layers.25.linear_attn.norm.weight": "model-00003-of-00004.safetensors",
257
+ "language_model.layers.25.linear_attn.out_proj.weight": "model-00003-of-00004.safetensors",
258
+ "language_model.layers.25.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
259
+ "language_model.layers.25.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
260
+ "language_model.layers.25.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
261
+ "language_model.layers.25.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
262
+ "language_model.layers.26.input_layernorm.weight": "model-00003-of-00004.safetensors",
263
+ "language_model.layers.26.linear_attn.A_log": "model-00003-of-00004.safetensors",
264
+ "language_model.layers.26.linear_attn.conv1d.weight": "model-00003-of-00004.safetensors",
265
+ "language_model.layers.26.linear_attn.dt_bias": "model-00003-of-00004.safetensors",
266
+ "language_model.layers.26.linear_attn.in_proj_a.weight": "model-00003-of-00004.safetensors",
267
+ "language_model.layers.26.linear_attn.in_proj_b.weight": "model-00003-of-00004.safetensors",
268
+ "language_model.layers.26.linear_attn.in_proj_qkv.weight": "model-00003-of-00004.safetensors",
269
+ "language_model.layers.26.linear_attn.in_proj_z.weight": "model-00003-of-00004.safetensors",
270
+ "language_model.layers.26.linear_attn.norm.weight": "model-00003-of-00004.safetensors",
271
+ "language_model.layers.26.linear_attn.out_proj.weight": "model-00003-of-00004.safetensors",
272
+ "language_model.layers.26.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
273
+ "language_model.layers.26.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
274
+ "language_model.layers.26.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
275
+ "language_model.layers.26.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
276
+ "language_model.layers.27.input_layernorm.weight": "model-00003-of-00004.safetensors",
277
+ "language_model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
278
+ "language_model.layers.27.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
279
+ "language_model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
280
+ "language_model.layers.27.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
281
+ "language_model.layers.27.self_attn.k_norm.weight": "model-00003-of-00004.safetensors",
282
+ "language_model.layers.27.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
283
+ "language_model.layers.27.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
284
+ "language_model.layers.27.self_attn.q_norm.weight": "model-00003-of-00004.safetensors",
285
+ "language_model.layers.27.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
286
+ "language_model.layers.27.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
287
+ "language_model.layers.28.input_layernorm.weight": "model-00003-of-00004.safetensors",
288
+ "language_model.layers.28.linear_attn.A_log": "model-00003-of-00004.safetensors",
289
+ "language_model.layers.28.linear_attn.conv1d.weight": "model-00003-of-00004.safetensors",
290
+ "language_model.layers.28.linear_attn.dt_bias": "model-00003-of-00004.safetensors",
291
+ "language_model.layers.28.linear_attn.in_proj_a.weight": "model-00003-of-00004.safetensors",
292
+ "language_model.layers.28.linear_attn.in_proj_b.weight": "model-00003-of-00004.safetensors",
293
+ "language_model.layers.28.linear_attn.in_proj_qkv.weight": "model-00003-of-00004.safetensors",
294
+ "language_model.layers.28.linear_attn.in_proj_z.weight": "model-00003-of-00004.safetensors",
295
+ "language_model.layers.28.linear_attn.norm.weight": "model-00003-of-00004.safetensors",
296
+ "language_model.layers.28.linear_attn.out_proj.weight": "model-00003-of-00004.safetensors",
297
+ "language_model.layers.28.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
298
+ "language_model.layers.28.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
299
+ "language_model.layers.28.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
300
+ "language_model.layers.28.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
301
+ "language_model.layers.29.input_layernorm.weight": "model-00003-of-00004.safetensors",
302
+ "language_model.layers.29.linear_attn.A_log": "model-00003-of-00004.safetensors",
303
+ "language_model.layers.29.linear_attn.conv1d.weight": "model-00003-of-00004.safetensors",
304
+ "language_model.layers.29.linear_attn.dt_bias": "model-00003-of-00004.safetensors",
305
+ "language_model.layers.29.linear_attn.in_proj_a.weight": "model-00003-of-00004.safetensors",
306
+ "language_model.layers.29.linear_attn.in_proj_b.weight": "model-00003-of-00004.safetensors",
307
+ "language_model.layers.29.linear_attn.in_proj_qkv.weight": "model-00003-of-00004.safetensors",
308
+ "language_model.layers.29.linear_attn.in_proj_z.weight": "model-00003-of-00004.safetensors",
309
+ "language_model.layers.29.linear_attn.norm.weight": "model-00003-of-00004.safetensors",
310
+ "language_model.layers.29.linear_attn.out_proj.weight": "model-00003-of-00004.safetensors",
311
+ "language_model.layers.29.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
312
+ "language_model.layers.29.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
313
+ "language_model.layers.29.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
314
+ "language_model.layers.29.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
315
+ "language_model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors",
316
+ "language_model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
317
+ "language_model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
318
+ "language_model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
319
+ "language_model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
320
+ "language_model.layers.3.self_attn.k_norm.weight": "model-00001-of-00004.safetensors",
321
+ "language_model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
322
+ "language_model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
323
+ "language_model.layers.3.self_attn.q_norm.weight": "model-00001-of-00004.safetensors",
324
+ "language_model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
325
+ "language_model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
326
+ "language_model.layers.30.input_layernorm.weight": "model-00004-of-00004.safetensors",
327
+ "language_model.layers.30.linear_attn.A_log": "model-00004-of-00004.safetensors",
328
+ "language_model.layers.30.linear_attn.conv1d.weight": "model-00004-of-00004.safetensors",
329
+ "language_model.layers.30.linear_attn.dt_bias": "model-00004-of-00004.safetensors",
330
+ "language_model.layers.30.linear_attn.in_proj_a.weight": "model-00004-of-00004.safetensors",
331
+ "language_model.layers.30.linear_attn.in_proj_b.weight": "model-00004-of-00004.safetensors",
332
+ "language_model.layers.30.linear_attn.in_proj_qkv.weight": "model-00004-of-00004.safetensors",
333
+ "language_model.layers.30.linear_attn.in_proj_z.weight": "model-00004-of-00004.safetensors",
334
+ "language_model.layers.30.linear_attn.norm.weight": "model-00004-of-00004.safetensors",
335
+ "language_model.layers.30.linear_attn.out_proj.weight": "model-00004-of-00004.safetensors",
336
+ "language_model.layers.30.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
337
+ "language_model.layers.30.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
338
+ "language_model.layers.30.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
339
+ "language_model.layers.30.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
340
+ "language_model.layers.31.input_layernorm.weight": "model-00004-of-00004.safetensors",
341
+ "language_model.layers.31.mlp.down_proj.weight": "model-00004-of-00004.safetensors",
342
+ "language_model.layers.31.mlp.gate_proj.weight": "model-00004-of-00004.safetensors",
343
+ "language_model.layers.31.mlp.up_proj.weight": "model-00004-of-00004.safetensors",
344
+ "language_model.layers.31.post_attention_layernorm.weight": "model-00004-of-00004.safetensors",
345
+ "language_model.layers.31.self_attn.k_norm.weight": "model-00004-of-00004.safetensors",
346
+ "language_model.layers.31.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
347
+ "language_model.layers.31.self_attn.o_proj.weight": "model-00004-of-00004.safetensors",
348
+ "language_model.layers.31.self_attn.q_norm.weight": "model-00004-of-00004.safetensors",
349
+ "language_model.layers.31.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
350
+ "language_model.layers.31.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
351
+ "language_model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors",
352
+ "language_model.layers.4.linear_attn.A_log": "model-00001-of-00004.safetensors",
353
+ "language_model.layers.4.linear_attn.conv1d.weight": "model-00001-of-00004.safetensors",
354
+ "language_model.layers.4.linear_attn.dt_bias": "model-00001-of-00004.safetensors",
355
+ "language_model.layers.4.linear_attn.in_proj_a.weight": "model-00001-of-00004.safetensors",
356
+ "language_model.layers.4.linear_attn.in_proj_b.weight": "model-00001-of-00004.safetensors",
357
+ "language_model.layers.4.linear_attn.in_proj_qkv.weight": "model-00001-of-00004.safetensors",
358
+ "language_model.layers.4.linear_attn.in_proj_z.weight": "model-00001-of-00004.safetensors",
359
+ "language_model.layers.4.linear_attn.norm.weight": "model-00001-of-00004.safetensors",
360
+ "language_model.layers.4.linear_attn.out_proj.weight": "model-00001-of-00004.safetensors",
361
+ "language_model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
362
+ "language_model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
363
+ "language_model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
364
+ "language_model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
365
+ "language_model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors",
366
+ "language_model.layers.5.linear_attn.A_log": "model-00001-of-00004.safetensors",
367
+ "language_model.layers.5.linear_attn.conv1d.weight": "model-00001-of-00004.safetensors",
368
+ "language_model.layers.5.linear_attn.dt_bias": "model-00001-of-00004.safetensors",
369
+ "language_model.layers.5.linear_attn.in_proj_a.weight": "model-00001-of-00004.safetensors",
370
+ "language_model.layers.5.linear_attn.in_proj_b.weight": "model-00001-of-00004.safetensors",
371
+ "language_model.layers.5.linear_attn.in_proj_qkv.weight": "model-00001-of-00004.safetensors",
372
+ "language_model.layers.5.linear_attn.in_proj_z.weight": "model-00001-of-00004.safetensors",
373
+ "language_model.layers.5.linear_attn.norm.weight": "model-00001-of-00004.safetensors",
374
+ "language_model.layers.5.linear_attn.out_proj.weight": "model-00001-of-00004.safetensors",
375
+ "language_model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
376
+ "language_model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
377
+ "language_model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
378
+ "language_model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
379
+ "language_model.layers.6.input_layernorm.weight": "model-00001-of-00004.safetensors",
380
+ "language_model.layers.6.linear_attn.A_log": "model-00001-of-00004.safetensors",
381
+ "language_model.layers.6.linear_attn.conv1d.weight": "model-00001-of-00004.safetensors",
382
+ "language_model.layers.6.linear_attn.dt_bias": "model-00001-of-00004.safetensors",
383
+ "language_model.layers.6.linear_attn.in_proj_a.weight": "model-00001-of-00004.safetensors",
384
+ "language_model.layers.6.linear_attn.in_proj_b.weight": "model-00001-of-00004.safetensors",
385
+ "language_model.layers.6.linear_attn.in_proj_qkv.weight": "model-00001-of-00004.safetensors",
386
+ "language_model.layers.6.linear_attn.in_proj_z.weight": "model-00001-of-00004.safetensors",
387
+ "language_model.layers.6.linear_attn.norm.weight": "model-00001-of-00004.safetensors",
388
+ "language_model.layers.6.linear_attn.out_proj.weight": "model-00001-of-00004.safetensors",
389
+ "language_model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
390
+ "language_model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
391
+ "language_model.layers.6.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
392
+ "language_model.layers.6.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
393
+ "language_model.layers.7.input_layernorm.weight": "model-00002-of-00004.safetensors",
394
+ "language_model.layers.7.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
395
+ "language_model.layers.7.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
396
+ "language_model.layers.7.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
397
+ "language_model.layers.7.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
398
+ "language_model.layers.7.self_attn.k_norm.weight": "model-00002-of-00004.safetensors",
399
+ "language_model.layers.7.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
400
+ "language_model.layers.7.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
401
+ "language_model.layers.7.self_attn.q_norm.weight": "model-00002-of-00004.safetensors",
402
+ "language_model.layers.7.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
403
+ "language_model.layers.7.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
404
+ "language_model.layers.8.input_layernorm.weight": "model-00002-of-00004.safetensors",
405
+ "language_model.layers.8.linear_attn.A_log": "model-00002-of-00004.safetensors",
406
+ "language_model.layers.8.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
407
+ "language_model.layers.8.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
408
+ "language_model.layers.8.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
409
+ "language_model.layers.8.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
410
+ "language_model.layers.8.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
411
+ "language_model.layers.8.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
412
+ "language_model.layers.8.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
413
+ "language_model.layers.8.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
414
+ "language_model.layers.8.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
415
+ "language_model.layers.8.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
416
+ "language_model.layers.8.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
417
+ "language_model.layers.8.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
418
+ "language_model.layers.9.input_layernorm.weight": "model-00002-of-00004.safetensors",
419
+ "language_model.layers.9.linear_attn.A_log": "model-00002-of-00004.safetensors",
420
+ "language_model.layers.9.linear_attn.conv1d.weight": "model-00002-of-00004.safetensors",
421
+ "language_model.layers.9.linear_attn.dt_bias": "model-00002-of-00004.safetensors",
422
+ "language_model.layers.9.linear_attn.in_proj_a.weight": "model-00002-of-00004.safetensors",
423
+ "language_model.layers.9.linear_attn.in_proj_b.weight": "model-00002-of-00004.safetensors",
424
+ "language_model.layers.9.linear_attn.in_proj_qkv.weight": "model-00002-of-00004.safetensors",
425
+ "language_model.layers.9.linear_attn.in_proj_z.weight": "model-00002-of-00004.safetensors",
426
+ "language_model.layers.9.linear_attn.norm.weight": "model-00002-of-00004.safetensors",
427
+ "language_model.layers.9.linear_attn.out_proj.weight": "model-00002-of-00004.safetensors",
428
+ "language_model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
429
+ "language_model.layers.9.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
430
+ "language_model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
431
+ "language_model.layers.9.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
432
+ "language_model.norm.weight": "model-00004-of-00004.safetensors",
433
+ "visual.blocks.0.attn.proj.bias": "model-00004-of-00004.safetensors",
434
+ "visual.blocks.0.attn.proj.weight": "model-00004-of-00004.safetensors",
435
+ "visual.blocks.0.attn.qkv.bias": "model-00004-of-00004.safetensors",
436
+ "visual.blocks.0.attn.qkv.weight": "model-00004-of-00004.safetensors",
437
+ "visual.blocks.0.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
438
+ "visual.blocks.0.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
439
+ "visual.blocks.0.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
440
+ "visual.blocks.0.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
441
+ "visual.blocks.0.norm1.bias": "model-00004-of-00004.safetensors",
442
+ "visual.blocks.0.norm1.weight": "model-00004-of-00004.safetensors",
443
+ "visual.blocks.0.norm2.bias": "model-00004-of-00004.safetensors",
444
+ "visual.blocks.0.norm2.weight": "model-00004-of-00004.safetensors",
445
+ "visual.blocks.1.attn.proj.bias": "model-00004-of-00004.safetensors",
446
+ "visual.blocks.1.attn.proj.weight": "model-00004-of-00004.safetensors",
447
+ "visual.blocks.1.attn.qkv.bias": "model-00004-of-00004.safetensors",
448
+ "visual.blocks.1.attn.qkv.weight": "model-00004-of-00004.safetensors",
449
+ "visual.blocks.1.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
450
+ "visual.blocks.1.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
451
+ "visual.blocks.1.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
452
+ "visual.blocks.1.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
453
+ "visual.blocks.1.norm1.bias": "model-00004-of-00004.safetensors",
454
+ "visual.blocks.1.norm1.weight": "model-00004-of-00004.safetensors",
455
+ "visual.blocks.1.norm2.bias": "model-00004-of-00004.safetensors",
456
+ "visual.blocks.1.norm2.weight": "model-00004-of-00004.safetensors",
457
+ "visual.blocks.10.attn.proj.bias": "model-00004-of-00004.safetensors",
458
+ "visual.blocks.10.attn.proj.weight": "model-00004-of-00004.safetensors",
459
+ "visual.blocks.10.attn.qkv.bias": "model-00004-of-00004.safetensors",
460
+ "visual.blocks.10.attn.qkv.weight": "model-00004-of-00004.safetensors",
461
+ "visual.blocks.10.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
462
+ "visual.blocks.10.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
463
+ "visual.blocks.10.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
464
+ "visual.blocks.10.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
465
+ "visual.blocks.10.norm1.bias": "model-00004-of-00004.safetensors",
466
+ "visual.blocks.10.norm1.weight": "model-00004-of-00004.safetensors",
467
+ "visual.blocks.10.norm2.bias": "model-00004-of-00004.safetensors",
468
+ "visual.blocks.10.norm2.weight": "model-00004-of-00004.safetensors",
469
+ "visual.blocks.11.attn.proj.bias": "model-00004-of-00004.safetensors",
470
+ "visual.blocks.11.attn.proj.weight": "model-00004-of-00004.safetensors",
471
+ "visual.blocks.11.attn.qkv.bias": "model-00004-of-00004.safetensors",
472
+ "visual.blocks.11.attn.qkv.weight": "model-00004-of-00004.safetensors",
473
+ "visual.blocks.11.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
474
+ "visual.blocks.11.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
475
+ "visual.blocks.11.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
476
+ "visual.blocks.11.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
477
+ "visual.blocks.11.norm1.bias": "model-00004-of-00004.safetensors",
478
+ "visual.blocks.11.norm1.weight": "model-00004-of-00004.safetensors",
479
+ "visual.blocks.11.norm2.bias": "model-00004-of-00004.safetensors",
480
+ "visual.blocks.11.norm2.weight": "model-00004-of-00004.safetensors",
481
+ "visual.blocks.12.attn.proj.bias": "model-00004-of-00004.safetensors",
482
+ "visual.blocks.12.attn.proj.weight": "model-00004-of-00004.safetensors",
483
+ "visual.blocks.12.attn.qkv.bias": "model-00004-of-00004.safetensors",
484
+ "visual.blocks.12.attn.qkv.weight": "model-00004-of-00004.safetensors",
485
+ "visual.blocks.12.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
486
+ "visual.blocks.12.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
487
+ "visual.blocks.12.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
488
+ "visual.blocks.12.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
489
+ "visual.blocks.12.norm1.bias": "model-00004-of-00004.safetensors",
490
+ "visual.blocks.12.norm1.weight": "model-00004-of-00004.safetensors",
491
+ "visual.blocks.12.norm2.bias": "model-00004-of-00004.safetensors",
492
+ "visual.blocks.12.norm2.weight": "model-00004-of-00004.safetensors",
493
+ "visual.blocks.13.attn.proj.bias": "model-00004-of-00004.safetensors",
494
+ "visual.blocks.13.attn.proj.weight": "model-00004-of-00004.safetensors",
495
+ "visual.blocks.13.attn.qkv.bias": "model-00004-of-00004.safetensors",
496
+ "visual.blocks.13.attn.qkv.weight": "model-00004-of-00004.safetensors",
497
+ "visual.blocks.13.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
498
+ "visual.blocks.13.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
499
+ "visual.blocks.13.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
500
+ "visual.blocks.13.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
501
+ "visual.blocks.13.norm1.bias": "model-00004-of-00004.safetensors",
502
+ "visual.blocks.13.norm1.weight": "model-00004-of-00004.safetensors",
503
+ "visual.blocks.13.norm2.bias": "model-00004-of-00004.safetensors",
504
+ "visual.blocks.13.norm2.weight": "model-00004-of-00004.safetensors",
505
+ "visual.blocks.14.attn.proj.bias": "model-00004-of-00004.safetensors",
506
+ "visual.blocks.14.attn.proj.weight": "model-00004-of-00004.safetensors",
507
+ "visual.blocks.14.attn.qkv.bias": "model-00004-of-00004.safetensors",
508
+ "visual.blocks.14.attn.qkv.weight": "model-00004-of-00004.safetensors",
509
+ "visual.blocks.14.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
510
+ "visual.blocks.14.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
511
+ "visual.blocks.14.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
512
+ "visual.blocks.14.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
513
+ "visual.blocks.14.norm1.bias": "model-00004-of-00004.safetensors",
514
+ "visual.blocks.14.norm1.weight": "model-00004-of-00004.safetensors",
515
+ "visual.blocks.14.norm2.bias": "model-00004-of-00004.safetensors",
516
+ "visual.blocks.14.norm2.weight": "model-00004-of-00004.safetensors",
517
+ "visual.blocks.15.attn.proj.bias": "model-00004-of-00004.safetensors",
518
+ "visual.blocks.15.attn.proj.weight": "model-00004-of-00004.safetensors",
519
+ "visual.blocks.15.attn.qkv.bias": "model-00004-of-00004.safetensors",
520
+ "visual.blocks.15.attn.qkv.weight": "model-00004-of-00004.safetensors",
521
+ "visual.blocks.15.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
522
+ "visual.blocks.15.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
523
+ "visual.blocks.15.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
524
+ "visual.blocks.15.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
525
+ "visual.blocks.15.norm1.bias": "model-00004-of-00004.safetensors",
526
+ "visual.blocks.15.norm1.weight": "model-00004-of-00004.safetensors",
527
+ "visual.blocks.15.norm2.bias": "model-00004-of-00004.safetensors",
528
+ "visual.blocks.15.norm2.weight": "model-00004-of-00004.safetensors",
529
+ "visual.blocks.16.attn.proj.bias": "model-00004-of-00004.safetensors",
530
+ "visual.blocks.16.attn.proj.weight": "model-00004-of-00004.safetensors",
531
+ "visual.blocks.16.attn.qkv.bias": "model-00004-of-00004.safetensors",
532
+ "visual.blocks.16.attn.qkv.weight": "model-00004-of-00004.safetensors",
533
+ "visual.blocks.16.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
534
+ "visual.blocks.16.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
535
+ "visual.blocks.16.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
536
+ "visual.blocks.16.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
537
+ "visual.blocks.16.norm1.bias": "model-00004-of-00004.safetensors",
538
+ "visual.blocks.16.norm1.weight": "model-00004-of-00004.safetensors",
539
+ "visual.blocks.16.norm2.bias": "model-00004-of-00004.safetensors",
540
+ "visual.blocks.16.norm2.weight": "model-00004-of-00004.safetensors",
541
+ "visual.blocks.17.attn.proj.bias": "model-00004-of-00004.safetensors",
542
+ "visual.blocks.17.attn.proj.weight": "model-00004-of-00004.safetensors",
543
+ "visual.blocks.17.attn.qkv.bias": "model-00004-of-00004.safetensors",
544
+ "visual.blocks.17.attn.qkv.weight": "model-00004-of-00004.safetensors",
545
+ "visual.blocks.17.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
546
+ "visual.blocks.17.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
547
+ "visual.blocks.17.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
548
+ "visual.blocks.17.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
549
+ "visual.blocks.17.norm1.bias": "model-00004-of-00004.safetensors",
550
+ "visual.blocks.17.norm1.weight": "model-00004-of-00004.safetensors",
551
+ "visual.blocks.17.norm2.bias": "model-00004-of-00004.safetensors",
552
+ "visual.blocks.17.norm2.weight": "model-00004-of-00004.safetensors",
553
+ "visual.blocks.18.attn.proj.bias": "model-00004-of-00004.safetensors",
554
+ "visual.blocks.18.attn.proj.weight": "model-00004-of-00004.safetensors",
555
+ "visual.blocks.18.attn.qkv.bias": "model-00004-of-00004.safetensors",
556
+ "visual.blocks.18.attn.qkv.weight": "model-00004-of-00004.safetensors",
557
+ "visual.blocks.18.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
558
+ "visual.blocks.18.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
559
+ "visual.blocks.18.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
560
+ "visual.blocks.18.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
561
+ "visual.blocks.18.norm1.bias": "model-00004-of-00004.safetensors",
562
+ "visual.blocks.18.norm1.weight": "model-00004-of-00004.safetensors",
563
+ "visual.blocks.18.norm2.bias": "model-00004-of-00004.safetensors",
564
+ "visual.blocks.18.norm2.weight": "model-00004-of-00004.safetensors",
565
+ "visual.blocks.19.attn.proj.bias": "model-00004-of-00004.safetensors",
566
+ "visual.blocks.19.attn.proj.weight": "model-00004-of-00004.safetensors",
567
+ "visual.blocks.19.attn.qkv.bias": "model-00004-of-00004.safetensors",
568
+ "visual.blocks.19.attn.qkv.weight": "model-00004-of-00004.safetensors",
569
+ "visual.blocks.19.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
570
+ "visual.blocks.19.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
571
+ "visual.blocks.19.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
572
+ "visual.blocks.19.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
573
+ "visual.blocks.19.norm1.bias": "model-00004-of-00004.safetensors",
574
+ "visual.blocks.19.norm1.weight": "model-00004-of-00004.safetensors",
575
+ "visual.blocks.19.norm2.bias": "model-00004-of-00004.safetensors",
576
+ "visual.blocks.19.norm2.weight": "model-00004-of-00004.safetensors",
577
+ "visual.blocks.2.attn.proj.bias": "model-00004-of-00004.safetensors",
578
+ "visual.blocks.2.attn.proj.weight": "model-00004-of-00004.safetensors",
579
+ "visual.blocks.2.attn.qkv.bias": "model-00004-of-00004.safetensors",
580
+ "visual.blocks.2.attn.qkv.weight": "model-00004-of-00004.safetensors",
581
+ "visual.blocks.2.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
582
+ "visual.blocks.2.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
583
+ "visual.blocks.2.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
584
+ "visual.blocks.2.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
585
+ "visual.blocks.2.norm1.bias": "model-00004-of-00004.safetensors",
586
+ "visual.blocks.2.norm1.weight": "model-00004-of-00004.safetensors",
587
+ "visual.blocks.2.norm2.bias": "model-00004-of-00004.safetensors",
588
+ "visual.blocks.2.norm2.weight": "model-00004-of-00004.safetensors",
589
+ "visual.blocks.20.attn.proj.bias": "model-00004-of-00004.safetensors",
590
+ "visual.blocks.20.attn.proj.weight": "model-00004-of-00004.safetensors",
591
+ "visual.blocks.20.attn.qkv.bias": "model-00004-of-00004.safetensors",
592
+ "visual.blocks.20.attn.qkv.weight": "model-00004-of-00004.safetensors",
593
+ "visual.blocks.20.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
594
+ "visual.blocks.20.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
595
+ "visual.blocks.20.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
596
+ "visual.blocks.20.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
597
+ "visual.blocks.20.norm1.bias": "model-00004-of-00004.safetensors",
598
+ "visual.blocks.20.norm1.weight": "model-00004-of-00004.safetensors",
599
+ "visual.blocks.20.norm2.bias": "model-00004-of-00004.safetensors",
600
+ "visual.blocks.20.norm2.weight": "model-00004-of-00004.safetensors",
601
+ "visual.blocks.21.attn.proj.bias": "model-00004-of-00004.safetensors",
602
+ "visual.blocks.21.attn.proj.weight": "model-00004-of-00004.safetensors",
603
+ "visual.blocks.21.attn.qkv.bias": "model-00004-of-00004.safetensors",
604
+ "visual.blocks.21.attn.qkv.weight": "model-00004-of-00004.safetensors",
605
+ "visual.blocks.21.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
606
+ "visual.blocks.21.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
607
+ "visual.blocks.21.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
608
+ "visual.blocks.21.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
609
+ "visual.blocks.21.norm1.bias": "model-00004-of-00004.safetensors",
610
+ "visual.blocks.21.norm1.weight": "model-00004-of-00004.safetensors",
611
+ "visual.blocks.21.norm2.bias": "model-00004-of-00004.safetensors",
612
+ "visual.blocks.21.norm2.weight": "model-00004-of-00004.safetensors",
613
+ "visual.blocks.22.attn.proj.bias": "model-00004-of-00004.safetensors",
614
+ "visual.blocks.22.attn.proj.weight": "model-00004-of-00004.safetensors",
615
+ "visual.blocks.22.attn.qkv.bias": "model-00004-of-00004.safetensors",
616
+ "visual.blocks.22.attn.qkv.weight": "model-00004-of-00004.safetensors",
617
+ "visual.blocks.22.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
618
+ "visual.blocks.22.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
619
+ "visual.blocks.22.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
620
+ "visual.blocks.22.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
621
+ "visual.blocks.22.norm1.bias": "model-00004-of-00004.safetensors",
622
+ "visual.blocks.22.norm1.weight": "model-00004-of-00004.safetensors",
623
+ "visual.blocks.22.norm2.bias": "model-00004-of-00004.safetensors",
624
+ "visual.blocks.22.norm2.weight": "model-00004-of-00004.safetensors",
625
+ "visual.blocks.23.attn.proj.bias": "model-00004-of-00004.safetensors",
626
+ "visual.blocks.23.attn.proj.weight": "model-00004-of-00004.safetensors",
627
+ "visual.blocks.23.attn.qkv.bias": "model-00004-of-00004.safetensors",
628
+ "visual.blocks.23.attn.qkv.weight": "model-00004-of-00004.safetensors",
629
+ "visual.blocks.23.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
630
+ "visual.blocks.23.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
631
+ "visual.blocks.23.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
632
+ "visual.blocks.23.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
633
+ "visual.blocks.23.norm1.bias": "model-00004-of-00004.safetensors",
634
+ "visual.blocks.23.norm1.weight": "model-00004-of-00004.safetensors",
635
+ "visual.blocks.23.norm2.bias": "model-00004-of-00004.safetensors",
636
+ "visual.blocks.23.norm2.weight": "model-00004-of-00004.safetensors",
637
+ "visual.blocks.24.attn.proj.bias": "model-00004-of-00004.safetensors",
638
+ "visual.blocks.24.attn.proj.weight": "model-00004-of-00004.safetensors",
639
+ "visual.blocks.24.attn.qkv.bias": "model-00004-of-00004.safetensors",
640
+ "visual.blocks.24.attn.qkv.weight": "model-00004-of-00004.safetensors",
641
+ "visual.blocks.24.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
642
+ "visual.blocks.24.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
643
+ "visual.blocks.24.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
644
+ "visual.blocks.24.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
645
+ "visual.blocks.24.norm1.bias": "model-00004-of-00004.safetensors",
646
+ "visual.blocks.24.norm1.weight": "model-00004-of-00004.safetensors",
647
+ "visual.blocks.24.norm2.bias": "model-00004-of-00004.safetensors",
648
+ "visual.blocks.24.norm2.weight": "model-00004-of-00004.safetensors",
649
+ "visual.blocks.25.attn.proj.bias": "model-00004-of-00004.safetensors",
650
+ "visual.blocks.25.attn.proj.weight": "model-00004-of-00004.safetensors",
651
+ "visual.blocks.25.attn.qkv.bias": "model-00004-of-00004.safetensors",
652
+ "visual.blocks.25.attn.qkv.weight": "model-00004-of-00004.safetensors",
653
+ "visual.blocks.25.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
654
+ "visual.blocks.25.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
655
+ "visual.blocks.25.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
656
+ "visual.blocks.25.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
657
+ "visual.blocks.25.norm1.bias": "model-00004-of-00004.safetensors",
658
+ "visual.blocks.25.norm1.weight": "model-00004-of-00004.safetensors",
659
+ "visual.blocks.25.norm2.bias": "model-00004-of-00004.safetensors",
660
+ "visual.blocks.25.norm2.weight": "model-00004-of-00004.safetensors",
661
+ "visual.blocks.26.attn.proj.bias": "model-00004-of-00004.safetensors",
662
+ "visual.blocks.26.attn.proj.weight": "model-00004-of-00004.safetensors",
663
+ "visual.blocks.26.attn.qkv.bias": "model-00004-of-00004.safetensors",
664
+ "visual.blocks.26.attn.qkv.weight": "model-00004-of-00004.safetensors",
665
+ "visual.blocks.26.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
666
+ "visual.blocks.26.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
667
+ "visual.blocks.26.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
668
+ "visual.blocks.26.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
669
+ "visual.blocks.26.norm1.bias": "model-00004-of-00004.safetensors",
670
+ "visual.blocks.26.norm1.weight": "model-00004-of-00004.safetensors",
671
+ "visual.blocks.26.norm2.bias": "model-00004-of-00004.safetensors",
672
+ "visual.blocks.26.norm2.weight": "model-00004-of-00004.safetensors",
673
+ "visual.blocks.3.attn.proj.bias": "model-00004-of-00004.safetensors",
674
+ "visual.blocks.3.attn.proj.weight": "model-00004-of-00004.safetensors",
675
+ "visual.blocks.3.attn.qkv.bias": "model-00004-of-00004.safetensors",
676
+ "visual.blocks.3.attn.qkv.weight": "model-00004-of-00004.safetensors",
677
+ "visual.blocks.3.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
678
+ "visual.blocks.3.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
679
+ "visual.blocks.3.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
680
+ "visual.blocks.3.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
681
+ "visual.blocks.3.norm1.bias": "model-00004-of-00004.safetensors",
682
+ "visual.blocks.3.norm1.weight": "model-00004-of-00004.safetensors",
683
+ "visual.blocks.3.norm2.bias": "model-00004-of-00004.safetensors",
684
+ "visual.blocks.3.norm2.weight": "model-00004-of-00004.safetensors",
685
+ "visual.blocks.4.attn.proj.bias": "model-00004-of-00004.safetensors",
686
+ "visual.blocks.4.attn.proj.weight": "model-00004-of-00004.safetensors",
687
+ "visual.blocks.4.attn.qkv.bias": "model-00004-of-00004.safetensors",
688
+ "visual.blocks.4.attn.qkv.weight": "model-00004-of-00004.safetensors",
689
+ "visual.blocks.4.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
690
+ "visual.blocks.4.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
691
+ "visual.blocks.4.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
692
+ "visual.blocks.4.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
693
+ "visual.blocks.4.norm1.bias": "model-00004-of-00004.safetensors",
694
+ "visual.blocks.4.norm1.weight": "model-00004-of-00004.safetensors",
695
+ "visual.blocks.4.norm2.bias": "model-00004-of-00004.safetensors",
696
+ "visual.blocks.4.norm2.weight": "model-00004-of-00004.safetensors",
697
+ "visual.blocks.5.attn.proj.bias": "model-00004-of-00004.safetensors",
698
+ "visual.blocks.5.attn.proj.weight": "model-00004-of-00004.safetensors",
699
+ "visual.blocks.5.attn.qkv.bias": "model-00004-of-00004.safetensors",
700
+ "visual.blocks.5.attn.qkv.weight": "model-00004-of-00004.safetensors",
701
+ "visual.blocks.5.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
702
+ "visual.blocks.5.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
703
+ "visual.blocks.5.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
704
+ "visual.blocks.5.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
705
+ "visual.blocks.5.norm1.bias": "model-00004-of-00004.safetensors",
706
+ "visual.blocks.5.norm1.weight": "model-00004-of-00004.safetensors",
707
+ "visual.blocks.5.norm2.bias": "model-00004-of-00004.safetensors",
708
+ "visual.blocks.5.norm2.weight": "model-00004-of-00004.safetensors",
709
+ "visual.blocks.6.attn.proj.bias": "model-00004-of-00004.safetensors",
710
+ "visual.blocks.6.attn.proj.weight": "model-00004-of-00004.safetensors",
711
+ "visual.blocks.6.attn.qkv.bias": "model-00004-of-00004.safetensors",
712
+ "visual.blocks.6.attn.qkv.weight": "model-00004-of-00004.safetensors",
713
+ "visual.blocks.6.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
714
+ "visual.blocks.6.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
715
+ "visual.blocks.6.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
716
+ "visual.blocks.6.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
717
+ "visual.blocks.6.norm1.bias": "model-00004-of-00004.safetensors",
718
+ "visual.blocks.6.norm1.weight": "model-00004-of-00004.safetensors",
719
+ "visual.blocks.6.norm2.bias": "model-00004-of-00004.safetensors",
720
+ "visual.blocks.6.norm2.weight": "model-00004-of-00004.safetensors",
721
+ "visual.blocks.7.attn.proj.bias": "model-00004-of-00004.safetensors",
722
+ "visual.blocks.7.attn.proj.weight": "model-00004-of-00004.safetensors",
723
+ "visual.blocks.7.attn.qkv.bias": "model-00004-of-00004.safetensors",
724
+ "visual.blocks.7.attn.qkv.weight": "model-00004-of-00004.safetensors",
725
+ "visual.blocks.7.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
726
+ "visual.blocks.7.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
727
+ "visual.blocks.7.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
728
+ "visual.blocks.7.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
729
+ "visual.blocks.7.norm1.bias": "model-00004-of-00004.safetensors",
730
+ "visual.blocks.7.norm1.weight": "model-00004-of-00004.safetensors",
731
+ "visual.blocks.7.norm2.bias": "model-00004-of-00004.safetensors",
732
+ "visual.blocks.7.norm2.weight": "model-00004-of-00004.safetensors",
733
+ "visual.blocks.8.attn.proj.bias": "model-00004-of-00004.safetensors",
734
+ "visual.blocks.8.attn.proj.weight": "model-00004-of-00004.safetensors",
735
+ "visual.blocks.8.attn.qkv.bias": "model-00004-of-00004.safetensors",
736
+ "visual.blocks.8.attn.qkv.weight": "model-00004-of-00004.safetensors",
737
+ "visual.blocks.8.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
738
+ "visual.blocks.8.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
739
+ "visual.blocks.8.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
740
+ "visual.blocks.8.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
741
+ "visual.blocks.8.norm1.bias": "model-00004-of-00004.safetensors",
742
+ "visual.blocks.8.norm1.weight": "model-00004-of-00004.safetensors",
743
+ "visual.blocks.8.norm2.bias": "model-00004-of-00004.safetensors",
744
+ "visual.blocks.8.norm2.weight": "model-00004-of-00004.safetensors",
745
+ "visual.blocks.9.attn.proj.bias": "model-00004-of-00004.safetensors",
746
+ "visual.blocks.9.attn.proj.weight": "model-00004-of-00004.safetensors",
747
+ "visual.blocks.9.attn.qkv.bias": "model-00004-of-00004.safetensors",
748
+ "visual.blocks.9.attn.qkv.weight": "model-00004-of-00004.safetensors",
749
+ "visual.blocks.9.mlp.linear_fc1.bias": "model-00004-of-00004.safetensors",
750
+ "visual.blocks.9.mlp.linear_fc1.weight": "model-00004-of-00004.safetensors",
751
+ "visual.blocks.9.mlp.linear_fc2.bias": "model-00004-of-00004.safetensors",
752
+ "visual.blocks.9.mlp.linear_fc2.weight": "model-00004-of-00004.safetensors",
753
+ "visual.blocks.9.norm1.bias": "model-00004-of-00004.safetensors",
754
+ "visual.blocks.9.norm1.weight": "model-00004-of-00004.safetensors",
755
+ "visual.blocks.9.norm2.bias": "model-00004-of-00004.safetensors",
756
+ "visual.blocks.9.norm2.weight": "model-00004-of-00004.safetensors",
757
+ "visual.merger.linear_fc1.bias": "model-00004-of-00004.safetensors",
758
+ "visual.merger.linear_fc1.weight": "model-00004-of-00004.safetensors",
759
+ "visual.merger.linear_fc2.bias": "model-00004-of-00004.safetensors",
760
+ "visual.merger.linear_fc2.weight": "model-00004-of-00004.safetensors",
761
+ "visual.merger.norm.bias": "model-00004-of-00004.safetensors",
762
+ "visual.merger.norm.weight": "model-00004-of-00004.safetensors",
763
+ "visual.patch_embed.proj.bias": "model-00004-of-00004.safetensors",
764
+ "visual.patch_embed.proj.weight": "model-00004-of-00004.safetensors",
765
+ "visual.pos_embed.weight": "model-00004-of-00004.safetensors"
766
+ }
767
+ }
tokenizer/chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523
3
+ size 19989325
tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": true,
13
+ "local_files_only": true,
14
+ "model_max_length": 262144,
15
+ "model_specific_special_tokens": {
16
+ "audio_bos_token": "<|audio_start|>",
17
+ "audio_eos_token": "<|audio_end|>",
18
+ "audio_token": "<|audio_pad|>",
19
+ "image_token": "<|image_pad|>",
20
+ "video_token": "<|video_pad|>",
21
+ "vision_bos_token": "<|vision_start|>",
22
+ "vision_eos_token": "<|vision_end|>"
23
+ },
24
+ "pad_token": "<|endoftext|>",
25
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
+ "split_special_tokens": false,
27
+ "tokenizer_class": "Qwen2Tokenizer",
28
+ "unk_token": null,
29
+ "video_token": "<|video_pad|>",
30
+ "vision_bos_token": "<|vision_start|>",
31
+ "vision_eos_token": "<|vision_end|>"
32
+ }
transformer/config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "MOSSImageTransformer",
3
+ "_diffusers_version": "0.38.0",
4
+ "dim": 3072,
5
+ "ffn_dim": 8192,
6
+ "freq_dim": 256,
7
+ "latent_channels": 128,
8
+ "num_heads": 24,
9
+ "num_layers": 42,
10
+ "rope_base": 10000.0,
11
+ "text_dim": 4096
12
+ }
transformer/diffusion_pytorch_model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae085fba123b6df67daf90aa9698fadee60c73e45bcaf3f3043d15f34e7a1804
3
+ size 4991978016
transformer/diffusion_pytorch_model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:806e876d80c7fba560663a3a95580e6c7033da3f9ea3c52765245ef0e1818f75
3
+ size 4983137016
transformer/diffusion_pytorch_model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f319b72c40324294007c270d78112425627b537fcd8769b3c00f9f070e506a9
3
+ size 189549184
transformer/diffusion_pytorch_model.safetensors.index.json ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 10164617280
4
+ },
5
+ "weight_map": {
6
+ "final_linear_video.weight": "diffusion_pytorch_model-00003-of-00003.safetensors",
7
+ "final_norm_video.weight": "diffusion_pytorch_model-00003-of-00003.safetensors",
8
+ "layers.0.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
9
+ "layers.0.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
10
+ "layers.0.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
11
+ "layers.0.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
12
+ "layers.0.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
13
+ "layers.0.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
14
+ "layers.0.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
15
+ "layers.0.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
16
+ "layers.0.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
17
+ "layers.0.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
18
+ "layers.1.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
19
+ "layers.1.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
20
+ "layers.1.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
21
+ "layers.1.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
22
+ "layers.1.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
23
+ "layers.1.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
24
+ "layers.1.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
25
+ "layers.1.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
26
+ "layers.1.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
27
+ "layers.1.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
28
+ "layers.10.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
29
+ "layers.10.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
30
+ "layers.10.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
31
+ "layers.10.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
32
+ "layers.10.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
33
+ "layers.10.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
34
+ "layers.10.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
35
+ "layers.10.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
36
+ "layers.10.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
37
+ "layers.10.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
38
+ "layers.11.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
39
+ "layers.11.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
40
+ "layers.11.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
41
+ "layers.11.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
42
+ "layers.11.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
43
+ "layers.11.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
44
+ "layers.11.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
45
+ "layers.11.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
46
+ "layers.11.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
47
+ "layers.11.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
48
+ "layers.12.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
49
+ "layers.12.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
50
+ "layers.12.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
51
+ "layers.12.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
52
+ "layers.12.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
53
+ "layers.12.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
54
+ "layers.12.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
55
+ "layers.12.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
56
+ "layers.12.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
57
+ "layers.12.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
58
+ "layers.13.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
59
+ "layers.13.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
60
+ "layers.13.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
61
+ "layers.13.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
62
+ "layers.13.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
63
+ "layers.13.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
64
+ "layers.13.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
65
+ "layers.13.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
66
+ "layers.13.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
67
+ "layers.13.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
68
+ "layers.14.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
69
+ "layers.14.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
70
+ "layers.14.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
71
+ "layers.14.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
72
+ "layers.14.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
73
+ "layers.14.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
74
+ "layers.14.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
75
+ "layers.14.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
76
+ "layers.14.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
77
+ "layers.14.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
78
+ "layers.15.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
79
+ "layers.15.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
80
+ "layers.15.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
81
+ "layers.15.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
82
+ "layers.15.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
83
+ "layers.15.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
84
+ "layers.15.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
85
+ "layers.15.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
86
+ "layers.15.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
87
+ "layers.15.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
88
+ "layers.16.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
89
+ "layers.16.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
90
+ "layers.16.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
91
+ "layers.16.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
92
+ "layers.16.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
93
+ "layers.16.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
94
+ "layers.16.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
95
+ "layers.16.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
96
+ "layers.16.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
97
+ "layers.16.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
98
+ "layers.17.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
99
+ "layers.17.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
100
+ "layers.17.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
101
+ "layers.17.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
102
+ "layers.17.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
103
+ "layers.17.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
104
+ "layers.17.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
105
+ "layers.17.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
106
+ "layers.17.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
107
+ "layers.17.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
108
+ "layers.18.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
109
+ "layers.18.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
110
+ "layers.18.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
111
+ "layers.18.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
112
+ "layers.18.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
113
+ "layers.18.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
114
+ "layers.18.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
115
+ "layers.18.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
116
+ "layers.18.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
117
+ "layers.18.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
118
+ "layers.19.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
119
+ "layers.19.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
120
+ "layers.19.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
121
+ "layers.19.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
122
+ "layers.19.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
123
+ "layers.19.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
124
+ "layers.19.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
125
+ "layers.19.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
126
+ "layers.19.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
127
+ "layers.19.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
128
+ "layers.2.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
129
+ "layers.2.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
130
+ "layers.2.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
131
+ "layers.2.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
132
+ "layers.2.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
133
+ "layers.2.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
134
+ "layers.2.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
135
+ "layers.2.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
136
+ "layers.2.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
137
+ "layers.2.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
138
+ "layers.20.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
139
+ "layers.20.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
140
+ "layers.20.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
141
+ "layers.20.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
142
+ "layers.20.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
143
+ "layers.20.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
144
+ "layers.20.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
145
+ "layers.20.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
146
+ "layers.20.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
147
+ "layers.20.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
148
+ "layers.21.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
149
+ "layers.21.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
150
+ "layers.21.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
151
+ "layers.21.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
152
+ "layers.21.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
153
+ "layers.21.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
154
+ "layers.21.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
155
+ "layers.21.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
156
+ "layers.21.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
157
+ "layers.21.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
158
+ "layers.22.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
159
+ "layers.22.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
160
+ "layers.22.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
161
+ "layers.22.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
162
+ "layers.22.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
163
+ "layers.22.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
164
+ "layers.22.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
165
+ "layers.22.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
166
+ "layers.22.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
167
+ "layers.22.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
168
+ "layers.23.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
169
+ "layers.23.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
170
+ "layers.23.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
171
+ "layers.23.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
172
+ "layers.23.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
173
+ "layers.23.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
174
+ "layers.23.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
175
+ "layers.23.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
176
+ "layers.23.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
177
+ "layers.23.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
178
+ "layers.24.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
179
+ "layers.24.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
180
+ "layers.24.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
181
+ "layers.24.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
182
+ "layers.24.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
183
+ "layers.24.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
184
+ "layers.24.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
185
+ "layers.24.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
186
+ "layers.24.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
187
+ "layers.24.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
188
+ "layers.25.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
189
+ "layers.25.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
190
+ "layers.25.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
191
+ "layers.25.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
192
+ "layers.25.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
193
+ "layers.25.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
194
+ "layers.25.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
195
+ "layers.25.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
196
+ "layers.25.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
197
+ "layers.25.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
198
+ "layers.26.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
199
+ "layers.26.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
200
+ "layers.26.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
201
+ "layers.26.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
202
+ "layers.26.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
203
+ "layers.26.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
204
+ "layers.26.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
205
+ "layers.26.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
206
+ "layers.26.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
207
+ "layers.26.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
208
+ "layers.27.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
209
+ "layers.27.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
210
+ "layers.27.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
211
+ "layers.27.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
212
+ "layers.27.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
213
+ "layers.27.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
214
+ "layers.27.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
215
+ "layers.27.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
216
+ "layers.27.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
217
+ "layers.27.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
218
+ "layers.28.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
219
+ "layers.28.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
220
+ "layers.28.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
221
+ "layers.28.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
222
+ "layers.28.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
223
+ "layers.28.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
224
+ "layers.28.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
225
+ "layers.28.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
226
+ "layers.28.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
227
+ "layers.28.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
228
+ "layers.29.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
229
+ "layers.29.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
230
+ "layers.29.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
231
+ "layers.29.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
232
+ "layers.29.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
233
+ "layers.29.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
234
+ "layers.29.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
235
+ "layers.29.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
236
+ "layers.29.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
237
+ "layers.29.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
238
+ "layers.3.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
239
+ "layers.3.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
240
+ "layers.3.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
241
+ "layers.3.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
242
+ "layers.3.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
243
+ "layers.3.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
244
+ "layers.3.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
245
+ "layers.3.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
246
+ "layers.3.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
247
+ "layers.3.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
248
+ "layers.30.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
249
+ "layers.30.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
250
+ "layers.30.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
251
+ "layers.30.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
252
+ "layers.30.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
253
+ "layers.30.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
254
+ "layers.30.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
255
+ "layers.30.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
256
+ "layers.30.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
257
+ "layers.30.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
258
+ "layers.31.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
259
+ "layers.31.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
260
+ "layers.31.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
261
+ "layers.31.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
262
+ "layers.31.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
263
+ "layers.31.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
264
+ "layers.31.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
265
+ "layers.31.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
266
+ "layers.31.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
267
+ "layers.31.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
268
+ "layers.32.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
269
+ "layers.32.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
270
+ "layers.32.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
271
+ "layers.32.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
272
+ "layers.32.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
273
+ "layers.32.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
274
+ "layers.32.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
275
+ "layers.32.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
276
+ "layers.32.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
277
+ "layers.32.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
278
+ "layers.33.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
279
+ "layers.33.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
280
+ "layers.33.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
281
+ "layers.33.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
282
+ "layers.33.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
283
+ "layers.33.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
284
+ "layers.33.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
285
+ "layers.33.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
286
+ "layers.33.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
287
+ "layers.33.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
288
+ "layers.34.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
289
+ "layers.34.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
290
+ "layers.34.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
291
+ "layers.34.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
292
+ "layers.34.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
293
+ "layers.34.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
294
+ "layers.34.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
295
+ "layers.34.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
296
+ "layers.34.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
297
+ "layers.34.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
298
+ "layers.35.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
299
+ "layers.35.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
300
+ "layers.35.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
301
+ "layers.35.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
302
+ "layers.35.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
303
+ "layers.35.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
304
+ "layers.35.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
305
+ "layers.35.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
306
+ "layers.35.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
307
+ "layers.35.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
308
+ "layers.36.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
309
+ "layers.36.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
310
+ "layers.36.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
311
+ "layers.36.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
312
+ "layers.36.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
313
+ "layers.36.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
314
+ "layers.36.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
315
+ "layers.36.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
316
+ "layers.36.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
317
+ "layers.36.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
318
+ "layers.37.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
319
+ "layers.37.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
320
+ "layers.37.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
321
+ "layers.37.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
322
+ "layers.37.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
323
+ "layers.37.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
324
+ "layers.37.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
325
+ "layers.37.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
326
+ "layers.37.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
327
+ "layers.37.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
328
+ "layers.38.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
329
+ "layers.38.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
330
+ "layers.38.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
331
+ "layers.38.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
332
+ "layers.38.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
333
+ "layers.38.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
334
+ "layers.38.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
335
+ "layers.38.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
336
+ "layers.38.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
337
+ "layers.38.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
338
+ "layers.39.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
339
+ "layers.39.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
340
+ "layers.39.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
341
+ "layers.39.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
342
+ "layers.39.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
343
+ "layers.39.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
344
+ "layers.39.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
345
+ "layers.39.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
346
+ "layers.39.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
347
+ "layers.39.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
348
+ "layers.4.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
349
+ "layers.4.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
350
+ "layers.4.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
351
+ "layers.4.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
352
+ "layers.4.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
353
+ "layers.4.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
354
+ "layers.4.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
355
+ "layers.4.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
356
+ "layers.4.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
357
+ "layers.4.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
358
+ "layers.40.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
359
+ "layers.40.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
360
+ "layers.40.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
361
+ "layers.40.proj.ffn_down.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
362
+ "layers.40.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
363
+ "layers.40.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
364
+ "layers.40.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
365
+ "layers.40.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
366
+ "layers.40.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
367
+ "layers.40.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
368
+ "layers.41.k_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
369
+ "layers.41.norm1.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
370
+ "layers.41.norm2.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
371
+ "layers.41.proj.ffn_down.weight": "diffusion_pytorch_model-00003-of-00003.safetensors",
372
+ "layers.41.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00003-of-00003.safetensors",
373
+ "layers.41.proj.k.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
374
+ "layers.41.proj.o.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
375
+ "layers.41.proj.q.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
376
+ "layers.41.proj.v.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
377
+ "layers.41.q_norm.weight": "diffusion_pytorch_model-00002-of-00003.safetensors",
378
+ "layers.5.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
379
+ "layers.5.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
380
+ "layers.5.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
381
+ "layers.5.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
382
+ "layers.5.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
383
+ "layers.5.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
384
+ "layers.5.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
385
+ "layers.5.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
386
+ "layers.5.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
387
+ "layers.5.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
388
+ "layers.6.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
389
+ "layers.6.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
390
+ "layers.6.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
391
+ "layers.6.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
392
+ "layers.6.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
393
+ "layers.6.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
394
+ "layers.6.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
395
+ "layers.6.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
396
+ "layers.6.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
397
+ "layers.6.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
398
+ "layers.7.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
399
+ "layers.7.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
400
+ "layers.7.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
401
+ "layers.7.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
402
+ "layers.7.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
403
+ "layers.7.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
404
+ "layers.7.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
405
+ "layers.7.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
406
+ "layers.7.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
407
+ "layers.7.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
408
+ "layers.8.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
409
+ "layers.8.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
410
+ "layers.8.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
411
+ "layers.8.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
412
+ "layers.8.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
413
+ "layers.8.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
414
+ "layers.8.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
415
+ "layers.8.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
416
+ "layers.8.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
417
+ "layers.8.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
418
+ "layers.9.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
419
+ "layers.9.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
420
+ "layers.9.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
421
+ "layers.9.proj.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
422
+ "layers.9.proj.ffn_up_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
423
+ "layers.9.proj.k.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
424
+ "layers.9.proj.o.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
425
+ "layers.9.proj.q.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
426
+ "layers.9.proj.v.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
427
+ "layers.9.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
428
+ "rope.bands": "diffusion_pytorch_model-00001-of-00003.safetensors",
429
+ "shared_block_modulation.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
430
+ "shared_block_modulation.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
431
+ "text_embedder.blocks.0.ffn_down.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
432
+ "text_embedder.blocks.0.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
433
+ "text_embedder.blocks.0.ffn_gate.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
434
+ "text_embedder.blocks.0.ffn_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
435
+ "text_embedder.blocks.0.ffn_up.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
436
+ "text_embedder.blocks.0.ffn_up.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
437
+ "text_embedder.blocks.0.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
438
+ "text_embedder.blocks.0.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
439
+ "text_embedder.blocks.0.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
440
+ "text_embedder.blocks.0.proj.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
441
+ "text_embedder.blocks.0.proj.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
442
+ "text_embedder.blocks.0.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
443
+ "text_embedder.blocks.0.qkv.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
444
+ "text_embedder.blocks.0.qkv.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
445
+ "text_embedder.blocks.1.ffn_down.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
446
+ "text_embedder.blocks.1.ffn_down.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
447
+ "text_embedder.blocks.1.ffn_gate.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
448
+ "text_embedder.blocks.1.ffn_gate.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
449
+ "text_embedder.blocks.1.ffn_up.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
450
+ "text_embedder.blocks.1.ffn_up.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
451
+ "text_embedder.blocks.1.k_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
452
+ "text_embedder.blocks.1.norm1.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
453
+ "text_embedder.blocks.1.norm2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
454
+ "text_embedder.blocks.1.proj.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
455
+ "text_embedder.blocks.1.proj.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
456
+ "text_embedder.blocks.1.q_norm.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
457
+ "text_embedder.blocks.1.qkv.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
458
+ "text_embedder.blocks.1.qkv.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
459
+ "text_embedder.proj.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
460
+ "text_embedder.proj.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
461
+ "time_embedding.0.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
462
+ "time_embedding.0.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
463
+ "time_embedding.2.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
464
+ "time_embedding.2.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
465
+ "video_embedder.bias": "diffusion_pytorch_model-00001-of-00003.safetensors",
466
+ "video_embedder.weight": "diffusion_pytorch_model-00001-of-00003.safetensors",
467
+ "video_head_modulation.bias": "diffusion_pytorch_model-00003-of-00003.safetensors",
468
+ "video_head_modulation.weight": "diffusion_pytorch_model-00003-of-00003.safetensors"
469
+ }
470
+ }
transformer/pipeline_moss_image.py ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """MOSSImage modeling and text-to-image pipeline (no Motor/TorchTitan imports).
2
+
3
+ Dependencies: torch>=2.9, diffusers>=0.38, transformers>=5.3, safetensors,
4
+ accelerate, Pillow. Copy this file anywhere and import it normally.
5
+
6
+ import torch
7
+ # Import MOSSImagePipeline from this file for component-level loading.
8
+ pipe = MOSSImagePipeline.from_components_pretrained(
9
+ transformer_path="exported_transformer", # save_pretrained directory
10
+ text_encoder_path="Qwen/Qwen3.5-9B",
11
+ vae_path="black-forest-labs/FLUX.2-klein-4B",
12
+ ).to("cuda")
13
+ pipe("A cat", generator=torch.Generator("cuda").manual_seed(42)).images[0].save("cat.png")
14
+
15
+ Default guidance uses CFG 3 and skips block 22 only in the negative branch
16
+ (zero-based main DiT block indices; two forwards per sampling step):
17
+ pipe("A cat", guidance_scale=3.0, uncond_skip_layers=[22])
18
+ pipe("A cat", uncond_skip_layers=[]) # disable negative-branch skipping
19
+ Optional additional positive-branch SLG adds a third forward:
20
+ pipe("A cat", slg_layers=[24], slg_scale=3.0)
21
+ The additional SLG layer/scale above illustrates the API, not a quality-tuned setting.
22
+
23
+ For a consolidated training state dict, create MOSSImageTransformer and
24
+ call load_training_state_dict(state), then save_pretrained("exported_transformer").
25
+ Select raw or EMA weights explicitly before calling it; distributed checkpoint
26
+ shards/optimizer states are not model state dicts. Defaults match the finalized dense MOSSImage model,
27
+ not MoE, CFG-distilled, video, or reference-image variants. Prompt strings are
28
+ already-rendered captions (dataset-specific quality/domain tags are not added).
29
+
30
+ First-release defaults: bf16 DiT/text-encoder weights, fp32 RoPE frequencies
31
+ and phase/sin/cos calculation, then RoPE cast to the video activation dtype.
32
+ Initial Gaussian noise is sampled directly in fp32, including with bf16 weights.
33
+ CFG and Euler latent updates use fp32; VAE decoding defaults to fp32. Scheduler
34
+ shift defaults to 5.0. Exact numerical parity with the original fp32-master
35
+ inference pipeline is not a release requirement.
36
+ """
37
+ from __future__ import annotations
38
+
39
+ import math
40
+ from pathlib import Path
41
+
42
+ import torch
43
+ from torch import nn
44
+ from torch.nn import functional as F
45
+ from diffusers import AutoencoderKLFlux2, DiffusionPipeline, FlowMatchEulerDiscreteScheduler
46
+ from diffusers.schedulers.scheduling_utils import SchedulerMixin # Required by custom-component discovery.
47
+ from diffusers.configuration_utils import ConfigMixin, register_to_config
48
+ from diffusers.image_processor import VaeImageProcessor
49
+ from diffusers.models.modeling_utils import ModelMixin
50
+ from diffusers.models.modeling_outputs import Transformer2DModelOutput
51
+ from diffusers.pipelines.pipeline_utils import ImagePipelineOutput
52
+ from diffusers.utils.torch_utils import randn_tensor
53
+ from transformers import AutoModel, AutoTokenizer
54
+
55
+
56
+ class _RMSNorm(nn.Module):
57
+ def __init__(self, dim):
58
+ super().__init__()
59
+ self.weight = nn.Parameter(torch.ones(dim))
60
+
61
+ def forward(self, x):
62
+ y = x.float() * torch.rsqrt(x.float().square().mean(-1, keepdim=True) + 1e-6)
63
+ return y.to(x.dtype) * self.weight
64
+
65
+
66
+ def _situ(hidden, gate):
67
+ return (4.0 * torch.tanh(gate / 4.0) * torch.sigmoid(gate)) * (25.0 * torch.tanh(hidden / 25.0))
68
+
69
+
70
+ def _validate_skip_layers(layers, depth, name='skip_layers'):
71
+ layers = () if layers is None else tuple(layers)
72
+ if any(type(index) is not int or not 0 <= index < depth for index in layers):
73
+ raise ValueError(f'{name} must contain integer block indices in [0, {depth}).')
74
+ return frozenset(layers)
75
+
76
+
77
+ def _rotate(x, rope):
78
+ sin, cos = rope.chunk(2, -1)
79
+ sin = torch.cat((sin, sin), -1).unsqueeze(-2)
80
+ cos = torch.cat((cos, cos), -1).unsqueeze(-2)
81
+ a, b = x.chunk(2, -1)
82
+ return x * cos + torch.cat((-b, a), -1) * sin
83
+
84
+
85
+ def _attention(q, k, v, rope, heads):
86
+ shape = (*q.shape[:2], heads, q.shape[-1] // heads)
87
+ q = _rotate(q.reshape(shape), rope).transpose(1, 2)
88
+ k = _rotate(k.reshape(shape), rope).transpose(1, 2)
89
+ v = v.reshape(shape).transpose(1, 2)
90
+ return F.scaled_dot_product_attention(q.to(v.dtype), k.to(v.dtype), v).transpose(1, 2).flatten(2)
91
+
92
+
93
+ class _TextBlock(nn.Module):
94
+ def __init__(self, dim, ffn_dim, heads):
95
+ super().__init__()
96
+ self.heads = heads
97
+ self.norm1, self.norm2 = _RMSNorm(dim), _RMSNorm(dim)
98
+ self.q_norm, self.k_norm = _RMSNorm(dim // heads), _RMSNorm(dim // heads)
99
+ self.qkv = nn.Linear(dim, 3 * dim)
100
+ self.proj = nn.Linear(dim, dim)
101
+ self.ffn_gate, self.ffn_up = nn.Linear(dim, ffn_dim), nn.Linear(dim, ffn_dim)
102
+ self.ffn_down = nn.Linear(ffn_dim, dim)
103
+
104
+ def forward(self, x, rope):
105
+ q, k, v = self.qkv(self.norm1(x)).chunk(3, -1)
106
+ q = self.q_norm(q.unflatten(-1, (self.heads, -1))).flatten(2)
107
+ k = self.k_norm(k.unflatten(-1, (self.heads, -1))).flatten(2)
108
+ x = x + self.proj(_attention(q, k, v, rope, self.heads))
109
+ y = self.norm2(x)
110
+ return x + self.ffn_down(_situ(self.ffn_up(y), self.ffn_gate(y)))
111
+
112
+
113
+ class _TextProjection(nn.Module):
114
+ def __init__(self, text_dim, dim, ffn_dim, heads):
115
+ super().__init__()
116
+ self.proj = nn.Linear(text_dim, dim)
117
+ self.blocks = nn.ModuleList([_TextBlock(dim, ffn_dim, heads) for _ in range(2)])
118
+
119
+ def forward(self, x, rope):
120
+ x = self.proj(x.to(self.proj.weight.dtype))
121
+ for block in self.blocks:
122
+ x = block(x, rope)
123
+ return x
124
+
125
+
126
+ class _Block(nn.Module):
127
+ def __init__(self, dim, ffn_dim, heads):
128
+ super().__init__()
129
+ self.heads = heads
130
+ self.norm1, self.norm2 = _RMSNorm(dim), _RMSNorm(dim)
131
+ self.q_norm, self.k_norm = _RMSNorm(dim // heads), _RMSNorm(dim // heads)
132
+ self.proj = nn.ModuleDict({
133
+ name: nn.Linear(dim, dim, bias=False) for name in ('q', 'k', 'v', 'o')
134
+ })
135
+ self.proj['ffn_up_gate'] = nn.Linear(dim, 2 * ffn_dim, bias=False)
136
+ self.proj['ffn_down'] = nn.Linear(ffn_dim, dim, bias=False)
137
+
138
+ def forward(self, x, rope, modulation):
139
+ shift_a, scale_a, gate_a, shift_f, scale_f, gate_f = modulation.unbind(1)
140
+ y = self.norm1(x) * (1 + scale_a[:, None]) + shift_a[:, None]
141
+ dtype = self.proj['q'].weight.dtype
142
+ y = y.to(dtype)
143
+ q = self.q_norm(self.proj['q'](y).unflatten(-1, (self.heads, -1))).flatten(2)
144
+ k = self.k_norm(self.proj['k'](y).unflatten(-1, (self.heads, -1))).flatten(2)
145
+ x = x + self.proj['o'](_attention(q, k, self.proj['v'](y), rope, self.heads)) * gate_a[:, None]
146
+ y = self.norm2(x) * (1 + scale_f[:, None]) + shift_f[:, None]
147
+ hidden, gate = self.proj['ffn_up_gate'](y.to(dtype)).chunk(2, -1)
148
+ return x + self.proj['ffn_down'](_situ(hidden, gate)) * gate_f[:, None]
149
+
150
+
151
+ class _RoPE(nn.Module):
152
+ def __init__(self, head_dim, base):
153
+ super().__init__()
154
+ self.num_bands = head_dim // 8
155
+ self.base = base
156
+ self.register_buffer('bands', self._default_bands(torch.device('cpu')))
157
+
158
+ def _default_bands(self, device):
159
+ # Match training's CPU fp32 construction, including under meta init.
160
+ exponent = torch.arange(self.num_bands, device='cpu', dtype=torch.float32) / self.num_bands
161
+ return (1 / (self.base ** exponent)).to(device)
162
+
163
+ def _apply(self, fn, recurse=True):
164
+ super()._apply(fn, recurse=recurse)
165
+ # .float() cannot recover frequencies already rounded by .to(bf16).
166
+ self.bands = self._default_bands(self.bands.device)
167
+ return self
168
+
169
+ def _load_from_state_dict(self, *args, **kwargs):
170
+ super()._load_from_state_dict(*args, **kwargs)
171
+ # Frequencies are derived constants; retain the key for checkpoint compatibility.
172
+ self.bands = self._default_bands(self.bands.device)
173
+
174
+ def forward(self, height, width, text_length, device):
175
+ # Diffusers/Accelerate can install tensors directly, bypassing load hooks.
176
+ if self.bands.dtype != torch.float32:
177
+ self.bands = self._default_bands(device)
178
+ # Coordinates: (r, f, h, w); sequence order is image followed by text.
179
+ h, w = torch.meshgrid(torch.arange(height, device=device), torch.arange(width, device=device), indexing='ij')
180
+ image = torch.stack((torch.zeros_like(h), torch.full_like(h, text_length), h, w), -1).flatten(0, 1).float()
181
+ image[:, 2] -= (height - 1) / 2
182
+ image[:, 3] -= (width - 1) / 2
183
+ text = torch.zeros(text_length, 4, device=device, dtype=torch.float32)
184
+ text[:, 1] = torch.arange(text_length, device=device)
185
+ phase = torch.cat((image, text), 0).unsqueeze(-1) * self.bands
186
+ return torch.cat((phase.sin(), phase.cos()), -2).flatten(-2).unsqueeze(0)
187
+
188
+
189
+ class MOSSImageTransformer(ModelMixin, ConfigMixin):
190
+ """MOSSImage DiT with training-compatible state-dict names and SDPA attention.
191
+
192
+ Each sample is evaluated at its true text length, including text refinement;
193
+ padded tokens cannot influence either text or joint attention.
194
+ """
195
+ @register_to_config
196
+ def __init__(self, dim=3072, ffn_dim=8192, num_heads=24, num_layers=42,
197
+ text_dim=4096, freq_dim=256, latent_channels=128, rope_base=10000.0):
198
+ super().__init__()
199
+ if dim % num_heads or (dim // num_heads) % 8 or freq_dim % 2:
200
+ raise ValueError('Require dim divisible by heads, head_dim divisible by 8, and even freq_dim.')
201
+ self.video_embedder = nn.Linear(latent_channels, dim)
202
+ self.text_embedder = _TextProjection(text_dim, dim, ffn_dim, num_heads)
203
+ self.rope = _RoPE(dim // num_heads, rope_base)
204
+ self.time_embedding = nn.Sequential(nn.Linear(freq_dim, dim), nn.SiLU(), nn.Linear(dim, dim))
205
+ self.shared_block_modulation = nn.Linear(dim, 6 * dim)
206
+ self.layers = nn.ModuleList([_Block(dim, ffn_dim, num_heads) for _ in range(num_layers)])
207
+ self.final_norm_video = _RMSNorm(dim)
208
+ self.final_linear_video = nn.Linear(dim, latent_channels, bias=False)
209
+ self.video_head_modulation = nn.Linear(dim, 2 * dim)
210
+
211
+ def load_training_state_dict(self, state_dict, *, prefix=''):
212
+ """Load a consolidated raw/EMA model mapping, strictly; no silent key drops."""
213
+ if prefix:
214
+ if any(not key.startswith(prefix) for key in state_dict):
215
+ raise ValueError('All keys must start with the explicit prefix.')
216
+ state_dict = {key[len(prefix):]: value for key, value in state_dict.items()}
217
+ return self.load_state_dict(state_dict, strict=True)
218
+
219
+ def forward(self, hidden_states, timestep, encoder_hidden_states,
220
+ encoder_attention_mask=None, return_dict=True, skip_layers=None):
221
+ skip_layers = _validate_skip_layers(skip_layers, len(self.layers))
222
+ if hidden_states.ndim != 4 or hidden_states.shape[1] != self.config.latent_channels:
223
+ raise ValueError('hidden_states must be [B, latent_channels, H, W].')
224
+ batch, _, height, width = hidden_states.shape
225
+ if encoder_hidden_states.ndim != 3 or encoder_hidden_states.shape[0] != batch:
226
+ raise ValueError('encoder_hidden_states must be [B, S, text_dim].')
227
+ mask = encoder_attention_mask
228
+ if mask is None:
229
+ mask = torch.ones(encoder_hidden_states.shape[:2], dtype=torch.bool, device=hidden_states.device)
230
+ if mask.shape != encoder_hidden_states.shape[:2] or not torch.all((mask == 0) | (mask == 1)):
231
+ raise ValueError('encoder_attention_mask must be a binary [B, S] mask.')
232
+ times = torch.as_tensor(timestep, device=hidden_states.device, dtype=torch.float32).reshape(-1)
233
+ times = times.expand(batch)
234
+ # Training computes the sinusoid in float64 and feeds float32 into its MLP.
235
+ half = self.config.freq_dim // 2
236
+ freq = 10000 ** (-torch.arange(half, device=times.device, dtype=torch.float64) / half)
237
+ phase = times.double()[:, None] * freq
238
+ embedding = torch.cat((phase.cos(), phase.sin()), -1).float()
239
+ time = self.time_embedding(embedding.to(self.time_embedding[0].weight.dtype)).float()
240
+ mod = self.shared_block_modulation(time.to(self.shared_block_modulation.weight.dtype)).view(batch, 6, -1)
241
+ head = self.video_head_modulation(time.to(self.video_head_modulation.weight.dtype)).view(batch, 2, -1)
242
+ outputs = []
243
+ for index in range(batch):
244
+ context = encoder_hidden_states[index:index + 1, mask[index].bool()]
245
+ if context.shape[1] == 0:
246
+ raise ValueError('Each sample needs at least one valid text token.')
247
+ video = hidden_states[index:index + 1].flatten(2).transpose(1, 2)
248
+ video = self.video_embedder(video.to(self.video_embedder.weight.dtype).contiguous())
249
+ # Match the reference activation dtype under fp32 weights + autocast.
250
+ rope = self.rope(height, width, context.shape[1], hidden_states.device).to(video.dtype)
251
+ text = self.text_embedder(context, rope[:, height * width:])
252
+ x = torch.cat((video, text), 1)
253
+ for layer_index, layer in enumerate(self.layers):
254
+ if layer_index not in skip_layers:
255
+ x = layer(x, rope, mod[index:index + 1])
256
+ x = self.final_norm_video(x[:, :height * width].to(self.final_norm_video.weight.dtype))
257
+ x = x * (1 + head[index:index + 1, 1, None]) + head[index:index + 1, 0, None]
258
+ x = self.final_linear_video(x.to(self.final_linear_video.weight.dtype))
259
+ outputs.append(x.transpose(1, 2).reshape(1, -1, height, width))
260
+ sample = torch.cat(outputs)
261
+ return Transformer2DModelOutput(sample=sample) if return_dict else (sample,)
262
+
263
+
264
+ class MOSSImageScheduler(FlowMatchEulerDiscreteScheduler):
265
+ """Euler integration using the training project's V2, nearest-grid schedule."""
266
+ @register_to_config
267
+ def __init__(self, num_train_timesteps=1000, shift=5.0, training_shift=1.0):
268
+ super().__init__(num_train_timesteps=num_train_timesteps, shift=1.0)
269
+ self.register_to_config(shift=shift, training_shift=training_shift)
270
+
271
+ def set_timesteps(self, num_inference_steps=50, device=None):
272
+ if num_inference_steps < 1 or self.config.shift <= 0 or self.config.training_shift <= 0:
273
+ raise ValueError('Steps and shifts must be positive.')
274
+ total = self.config.num_train_timesteps
275
+ def grid(count, shift):
276
+ lower = shift / (total + shift - 1)
277
+ values = torch.linspace(1, lower, count)
278
+ return shift * values / (1 + (shift - 1) * values)
279
+ sigmas = grid(num_inference_steps, self.config.shift)
280
+ training = grid(total, self.config.training_shift).flip(0)
281
+ upper = torch.searchsorted(training, sigmas).clamp(max=total - 1)
282
+ lower = (upper - 1).clamp(min=0)
283
+ nearest = torch.where((sigmas - training[lower]).abs() <= (training[upper] - sigmas).abs(), lower, upper)
284
+ sigmas = torch.unique_consecutive(training[nearest])
285
+ # Our sigmas have already been shifted and snapped. Avoid a second shift.
286
+ self._shift = 1.0
287
+ super().set_timesteps(device=device, sigmas=sigmas.tolist())
288
+
289
+
290
+ class MOSSImagePipeline(DiffusionPipeline):
291
+ model_cpu_offload_seq = 'text_encoder->transformer->vae'
292
+ _optional_components = ['text_encoder', 'tokenizer', 'vae']
293
+
294
+ def __init__(self, transformer: MOSSImageTransformer,
295
+ scheduler: MOSSImageScheduler, text_encoder=None, tokenizer=None, vae=None):
296
+ super().__init__()
297
+ self.register_modules(transformer=transformer, scheduler=scheduler,
298
+ text_encoder=text_encoder, tokenizer=tokenizer, vae=vae)
299
+ self.image_processor = VaeImageProcessor(vae_scale_factor=16)
300
+
301
+ @classmethod
302
+ def from_components_pretrained(cls, transformer_path, text_encoder_path, vae_path,
303
+ torch_dtype=torch.bfloat16, vae_dtype=torch.float32,
304
+ local_files_only=False):
305
+ common = dict(local_files_only=local_files_only)
306
+ transformer = MOSSImageTransformer.from_pretrained(transformer_path, torch_dtype=torch_dtype, **common)
307
+ tokenizer = AutoTokenizer.from_pretrained(text_encoder_path, **common)
308
+ text_encoder = AutoModel.from_pretrained(text_encoder_path, dtype=torch_dtype, **common).eval()
309
+ subfolder = None if (Path(vae_path) / 'config.json').is_file() else 'vae'
310
+ vae = AutoencoderKLFlux2.from_pretrained(vae_path, subfolder=subfolder, torch_dtype=vae_dtype, **common).eval()
311
+ return cls(transformer.eval(), MOSSImageScheduler(), text_encoder, tokenizer, vae)
312
+
313
+ @torch.no_grad()
314
+ def encode_prompt(self, prompt, max_sequence_length=4096):
315
+ if self.text_encoder is None or self.tokenizer is None:
316
+ raise ValueError('Text encoder/tokenizer required for string prompts.')
317
+ prompts = [prompt] if isinstance(prompt, str) else list(prompt)
318
+ if not prompts or not all(isinstance(p, str) for p in prompts):
319
+ raise ValueError('prompt must be a string or a nonempty list of strings.')
320
+ rows = []
321
+ # Unpadded individual forwards also avoid padding effects in Qwen GDN.
322
+ for value in prompts:
323
+ formatted = self.tokenizer.apply_chat_template(
324
+ [{'role': 'user', 'content': value}], tokenize=False,
325
+ add_generation_prompt=True, enable_thinking=True)
326
+ inputs = self.tokenizer(formatted, return_tensors='pt', truncation=True,
327
+ max_length=max_sequence_length).to(self._execution_device)
328
+ output = self.text_encoder(**inputs, use_cache=False, return_dict=True)
329
+ rows.append(output.last_hidden_state[0])
330
+ length = max(row.shape[0] for row in rows)
331
+ embeds = rows[0].new_zeros(len(rows), length, rows[0].shape[-1])
332
+ mask = torch.zeros(len(rows), length, device=embeds.device, dtype=torch.bool)
333
+ for index, row in enumerate(rows):
334
+ embeds[index, :row.shape[0]] = row
335
+ mask[index, :row.shape[0]] = True
336
+ return embeds, mask
337
+
338
+ @torch.no_grad()
339
+ def __call__(self, prompt=None, *, height=1024, width=1024, num_inference_steps=50,
340
+ guidance_scale=3.0, negative_prompt='', num_images_per_prompt=1,
341
+ generator=None, latents=None, prompt_embeds=None, prompt_attention_mask=None,
342
+ negative_prompt_embeds=None, negative_prompt_attention_mask=None,
343
+ max_sequence_length=4096, output_type='pil', return_dict=True,
344
+ uncond_skip_layers=(22,), slg_layers=None, slg_scale=0.0,
345
+ slg_start=0.0, slg_stop=1.0):
346
+ """Generate images with optional full-block skipping (zero-based indices).
347
+
348
+ uncond_skip_layers defaults to (22,) and replaces CFG's negative-prompt
349
+ prediction with a skipped-block prediction, retaining two forwards per
350
+ step. Pass None or an empty sequence to disable skipping. slg_layers
351
+ adds a skipped positive-prompt forward and the fp32 correction
352
+ slg_scale * (cond - cond_skip) to CFG. With guidance_scale=1, active
353
+ SLG uses cond_skip + slg_scale * (cond - cond_skip), matching Diffusers'
354
+ default SkipLayerGuidance formulation, with two forwards and no negative
355
+ branch. Both options can combine. slg_scale=1 then gives normal cond.
356
+ Both uncond skipping and SLG are active where
357
+ slg_start <= step_index / num_steps < slg_stop;
358
+ the interval follows denoising order, from initial noise to final image.
359
+ Outside it, inference uses normal CFG without skipping.
360
+ slg_scale=0 or empty slg_layers disables the additional forward.
361
+ """
362
+ uncond_skip_layers = _validate_skip_layers(
363
+ uncond_skip_layers, len(self.transformer.layers), 'uncond_skip_layers')
364
+ slg_layers = _validate_skip_layers(slg_layers, len(self.transformer.layers), 'slg_layers')
365
+ if not math.isfinite(slg_scale) or slg_scale < 0:
366
+ raise ValueError('slg_scale must be finite and nonnegative.')
367
+ if not 0 <= slg_start <= slg_stop <= 1:
368
+ raise ValueError('Require 0 <= slg_start <= slg_stop <= 1.')
369
+ if height <= 0 or width <= 0 or height % 16 or width % 16:
370
+ raise ValueError('height and width must be positive multiples of 16.')
371
+ if output_type not in {'pil', 'np', 'pt', 'latent'}:
372
+ raise ValueError('output_type must be pil, np, pt or latent.')
373
+ if num_images_per_prompt < 1 or not math.isfinite(guidance_scale) or guidance_scale < 0:
374
+ raise ValueError('Invalid image count or guidance scale.')
375
+ if not 1 <= max_sequence_length <= 4096:
376
+ raise ValueError('max_sequence_length must be between 1 and 4096.')
377
+ if (prompt is None) == (prompt_embeds is None):
378
+ raise ValueError('Provide exactly one of prompt and prompt_embeds.')
379
+ device = self._execution_device
380
+ if prompt_embeds is None:
381
+ prompt_embeds, prompt_attention_mask = self.encode_prompt(prompt, max_sequence_length)
382
+ batch = prompt_embeds.shape[0]
383
+ def prepare(embeds, mask):
384
+ if embeds.ndim != 3 or embeds.shape[0] != batch:
385
+ raise ValueError('Prompt embeddings must be [B, S, C] with matching batch size.')
386
+ if mask is None:
387
+ mask = torch.ones(embeds.shape[:2], dtype=torch.bool, device=embeds.device)
388
+ return (embeds.to(device).repeat_interleave(num_images_per_prompt, 0),
389
+ mask.to(device).repeat_interleave(num_images_per_prompt, 0))
390
+ positive, positive_mask = prepare(prompt_embeds, prompt_attention_mask)
391
+ do_cfg = guidance_scale != 1.0
392
+ if do_cfg:
393
+ if negative_prompt_embeds is None:
394
+ negatives = [negative_prompt] * batch if isinstance(negative_prompt, str) else negative_prompt
395
+ if len(negatives) != batch:
396
+ raise ValueError('negative_prompt must match prompt batch size.')
397
+ negative_prompt_embeds, negative_prompt_attention_mask = self.encode_prompt(negatives, max_sequence_length)
398
+ negative, negative_mask = prepare(negative_prompt_embeds, negative_prompt_attention_mask)
399
+ shape = (batch * num_images_per_prompt, self.transformer.config.latent_channels, height // 16, width // 16)
400
+ if latents is None:
401
+ # Sample in fp32: promoting bf16 noise afterward cannot restore its precision.
402
+ latents = randn_tensor(shape, generator=generator, device=device, dtype=torch.float32)
403
+ elif tuple(latents.shape) != shape:
404
+ raise ValueError(f'latents must have shape {shape}.')
405
+ else:
406
+ latents = latents.to(device=device, dtype=torch.float32)
407
+ self.scheduler.set_timesteps(num_inference_steps, device=device)
408
+ num_steps = len(self.scheduler.timesteps)
409
+ for step_index, timestep in enumerate(self.progress_bar(self.scheduler.timesteps)):
410
+ skip_active = slg_start <= step_index / num_steps < slg_stop
411
+ # CFG must combine fp32 predictions, even when the DiT runs in bf16.
412
+ # Converting only the combined velocity would preserve rounding errors.
413
+ prediction = self.transformer(latents, timestep, positive, positive_mask).sample.float()
414
+ conditional = prediction
415
+ if do_cfg:
416
+ skip_kwargs = {'skip_layers': uncond_skip_layers} if uncond_skip_layers and skip_active else {}
417
+ uncond = self.transformer(latents, timestep, negative, negative_mask, **skip_kwargs).sample.float()
418
+ prediction = uncond + guidance_scale * (prediction - uncond)
419
+ if slg_layers and slg_scale > 0 and skip_active:
420
+ skipped = self.transformer(
421
+ latents, timestep, positive, positive_mask, skip_layers=slg_layers).sample.float()
422
+ if not do_cfg:
423
+ prediction = skipped
424
+ prediction = prediction + slg_scale * (conditional - skipped)
425
+ latents = self.scheduler.step(prediction, timestep, latents, return_dict=False)[0]
426
+ if output_type == 'latent':
427
+ images = latents
428
+ else:
429
+ if self.vae is None:
430
+ raise ValueError('A FLUX.2 VAE is required for decoded output.')
431
+ z = latents.to(dtype=self.vae.dtype)
432
+ bn = self.vae.bn
433
+ eps = self.vae.config.batch_norm_eps
434
+ z = z * (bn.running_var + eps).sqrt().to(z).view(1, -1, 1, 1) + bn.running_mean.to(z).view(1, -1, 1, 1)
435
+ b, c, h, w = z.shape
436
+ z = z.reshape(b, c // 4, 2, 2, h, w).permute(0, 1, 4, 2, 5, 3).reshape(b, c // 4, 2 * h, 2 * w)
437
+ images = self.vae.decode(z, return_dict=False)[0].clamp(-1, 1)
438
+ images = self.image_processor.postprocess(images, output_type=output_type)
439
+ self.maybe_free_model_hooks()
440
+ return ImagePipelineOutput(images=images) if return_dict else (images,)
vae/config.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "AutoencoderKLFlux2",
3
+ "_diffusers_version": "0.38.0",
4
+ "act_fn": "silu",
5
+ "batch_norm_eps": 0.0001,
6
+ "batch_norm_momentum": 0.1,
7
+ "block_out_channels": [
8
+ 128,
9
+ 256,
10
+ 512,
11
+ 512
12
+ ],
13
+ "decoder_block_out_channels": [
14
+ 96,
15
+ 192,
16
+ 384,
17
+ 384
18
+ ],
19
+ "down_block_types": [
20
+ "DownEncoderBlock2D",
21
+ "DownEncoderBlock2D",
22
+ "DownEncoderBlock2D",
23
+ "DownEncoderBlock2D"
24
+ ],
25
+ "force_upcast": true,
26
+ "in_channels": 3,
27
+ "latent_channels": 32,
28
+ "layers_per_block": 2,
29
+ "mid_block_add_attention": true,
30
+ "norm_num_groups": 32,
31
+ "out_channels": 3,
32
+ "patch_size": [
33
+ 2,
34
+ 2
35
+ ],
36
+ "sample_size": 1024,
37
+ "up_block_types": [
38
+ "UpDecoderBlock2D",
39
+ "UpDecoderBlock2D",
40
+ "UpDecoderBlock2D",
41
+ "UpDecoderBlock2D"
42
+ ],
43
+ "use_post_quant_conv": true,
44
+ "use_quant_conv": true
45
+ }
vae/diffusion_pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3bdf94dc67ec69b30ea9fe1fa8340085679cae64d019f7c7e4a9921f1a7f17a
3
+ size 249521372