data-archetype commited on
Commit
7ba8d0f
·
0 Parent(s):

moss_pht: step 12,500 EMA

Browse files
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [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,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: OpenMOSS-Team/MOSS-Image-Base
3
+ base_model_relation: finetune
4
+ language:
5
+ - en
6
+ - zh
7
+ license: apache-2.0
8
+ pipeline_tag: text-to-image
9
+ tags:
10
+ - moss-image
11
+ - diffusers
12
+ - text-to-image
13
+ ---
14
+ # moss_pht
15
+
16
+ A lightweight, photo-oriented full fine-tune of
17
+ [OpenMOSS-Team/MOSS-Image-Base](https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base).
18
+ The text encoder (Qwen3.5-9B), VAE
19
+ (FLUX.2 small decoder), tokenizer, scheduler and inference pipeline are the base
20
+ release's, unchanged. This repository therefore ships only the transformer, in
21
+ two formats; load the other components from their official repositories, or
22
+ swap in any compatible ones (for example a quantized text encoder).
23
+
24
+ | File | Format |
25
+ | --- | --- |
26
+ | `transformer/` | Diffusers, the same layout as MOSS-Image-Base's `transformer/` |
27
+ | `diffusion_models/moss_pht_bf16.safetensors` | ComfyUI single file, the same layout as Comfy-Org's `moss_image_base_bf16.safetensors` |
28
+
29
+ ## Diffusers
30
+
31
+ ```bash
32
+ pip install "diffusers>=0.38" "transformers>=5.3" "accelerate>=1.10" "safetensors>=0.6" "Pillow>=10"
33
+ ```
34
+
35
+ ```python
36
+ import torch
37
+ from diffusers import AutoencoderKLFlux2
38
+ from diffusers.utils.dynamic_modules_utils import get_class_from_dynamic_module
39
+ from transformers import AutoModel, AutoTokenizer
40
+
41
+ BASE = "OpenMOSS-Team/MOSS-Image-Base"
42
+
43
+
44
+ def moss_class(name):
45
+ return get_class_from_dynamic_module(
46
+ BASE, "pipeline_moss_image.py", class_name=name, trust_remote_code=True
47
+ )
48
+
49
+
50
+ pipe = moss_class("MOSSImagePipeline")(
51
+ transformer=moss_class("MOSSImageTransformer").from_pretrained(
52
+ "data-archetype/moss_pht", subfolder="transformer", torch_dtype=torch.bfloat16
53
+ ),
54
+ scheduler=moss_class("MOSSImageScheduler").from_pretrained(BASE, subfolder="scheduler"),
55
+ text_encoder=AutoModel.from_pretrained(BASE, subfolder="text_encoder", dtype=torch.bfloat16),
56
+ tokenizer=AutoTokenizer.from_pretrained(BASE, subfolder="tokenizer"),
57
+ vae=AutoencoderKLFlux2.from_pretrained(BASE, subfolder="vae", torch_dtype=torch.float32),
58
+ )
59
+ pipe.to("cuda") # or pipe.enable_model_cpu_offload() on a smaller GPU
60
+
61
+ image = pipe(
62
+ "A candid street photograph of a cyclist crossing a rain-soaked intersection at dusk",
63
+ height=1024,
64
+ width=1024,
65
+ num_inference_steps=50,
66
+ guidance_scale=3.0,
67
+ uncond_skip_layers=[22],
68
+ generator=torch.Generator("cpu").manual_seed(42),
69
+ ).images[0]
70
+ ```
71
+
72
+ Each component is passed explicitly, so any of them can be replaced, for
73
+ example `text_encoder=` with a quantized Qwen3.5-9B. Sampling settings, prompt
74
+ formats (natural language, tags and JSON layouts) and requirements are the base
75
+ model's; see its [model card](https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base)
76
+ and [user guide](https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE.md).
77
+
78
+ ## ComfyUI
79
+
80
+ Use ComfyUI's native MOSS-Image support with the
81
+ [Comfy-Org/MOSS-Image](https://huggingface.co/Comfy-Org/MOSS-Image) text encoder
82
+ and VAE; `moss_pht_bf16.safetensors` drops in for `moss_image_base_bf16.safetensors`
83
+ in the Comfy-Org workflows.
84
+
85
+ | File | Put in | Loader |
86
+ | --- | --- | --- |
87
+ | `diffusion_models/moss_pht_bf16.safetensors` (this repo) | `models/diffusion_models/` | Load Diffusion Model |
88
+ | `text_encoders/qwen3.5_9b_bf16.safetensors` (or its int8 / w4a8 variants), from Comfy-Org/MOSS-Image | `models/text_encoders/` | Load CLIP, type `moss_image` |
89
+ | `vae/flux2-vae_small.safetensors`, from Comfy-Org/MOSS-Image | `models/vae/` | Load VAE |
90
+
91
+ ## Recommended: a DMD LoRA
92
+
93
+ Like the base checkpoint, generations with the standard multi-step sampler can be
94
+ a bit unstable. Using a DMD LoRA distilled from MOSS-Image-Base is recommended: it
95
+ sharpens the output distribution and stabilises generations.
96
+
97
+ ## Training
98
+
99
+ | Setting | Value |
100
+ | --- | --- |
101
+ | Initialization | MOSS-Image-Base |
102
+ | Trained parameters | All transformer parameters (fp32 master weights, bf16 autocast); text encoder and VAE frozen |
103
+ | Steps | 12,500 at 64 images per step |
104
+ | Resolution | About 1 megapixel, aspect-ratio buckets |
105
+ | Text | Prompts up to 2,304 tokens; 10% of captions dropped to the empty prompt |
106
+ | Objective | The base's flow-matching objective; noise levels from a truncated logit-normal (μ 1.09, σ 0.95, truncated at 0.95), plus 1% uniform and 1% pure noise |
107
+ | Optimizer | [dionw](https://github.com/JTriggerFish/dionw): Dion (row-selected NorMuon) on weight matrices, AdamW on the rest |
108
+ | Learning rate | 9e-6, AdamW-equivalent for every parameter |
109
+ | Schedule | 200-step linear warmup, constant to step 10,500, then a 2,000-step 1 − √ cooldown to 0 |
110
+ | Dion matrices | 25% of each block's rows updated per step (blocks with both sides ≥ 1024), Gram Newton–Schulz, heavy-ball momentum 0.95, NorMuon row normalization β₂ 0.975 |
111
+ | AdamW parameters | β = (0.9, 0.975), ε 1e-8; includes the fused conditioning (AdaLN) projections |
112
+ | Weight decay | 0.01 on Dion matrices, none on AdamW parameters |
113
+ | Gradient clipping | Global norm 1.0 |
114
+ | Released weights | EMA of the weights (decay 0.999, fp32, updated every step) at step 12,500, stored in bfloat16 (`rope.bands` in float32, as in the base release) |
115
+
116
+ ## License
117
+
118
+ The weights and the bundled inference code (`transformer/pipeline_moss_image.py`,
119
+ from OpenMOSS-Team/MOSS-Image-Base) are released under the base model's license,
120
+ Apache 2.0 ([LICENSE](LICENSE), copied from OpenMOSS-Team/MOSS-Image-Base).
121
+
122
+ We thank the OpenMOSS team for MOSS-Image.
diffusion_models/moss_pht_bf16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42e929263750e59e3a4134e3a8f44140d3fd38d9863d124faf4bd2fc58730f68
3
+ size 10164655808
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:19087e757d8e3e797a9bdda8bac28e84f284181e2637d59fb90c5b7d5ad603fe
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:19501128f57aba7c0c2732f8e8e09e00405c57cd591a7d02f7f619a38c08076e
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:fa067f79c0c2c023fe673936ed774cd91e89a18419c0983af611763a2b605b86
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,)