jennyxue commited on
Commit
9b42863
·
verified ·
1 Parent(s): 4716365

Model card and the original license

Browse files
Files changed (2) hide show
  1. LICENSE +202 -0
  2. README.md +274 -0
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,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: OpenMOSS-Team/MOSS-Image-SFT
3
+ base_model_relation: quantized
4
+ license: apache-2.0
5
+ pipeline_tag: text-to-image
6
+ library_name: mlx
7
+ tags:
8
+ - mlx
9
+ - moonbox
10
+ - moss-image
11
+ - text-to-image
12
+ - diffusion-single-file
13
+ ---
14
+
15
+ # MOSS-Image (SFT) MLX
16
+
17
+ MLX builds of [MOSS-Image (SFT)](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT), made by Moonbox for Apple Silicon Macs. Each precision is a folder; keep a folder's
18
+ files together. Only the parts listed below are converted: the rest of the pipeline comes from the original
19
+ repository unless the section below says otherwise.
20
+
21
+ ## Files
22
+
23
+ The last column is how far each build is from the original PyTorch model on the same inputs (see the section below
24
+ for what was measured).
25
+
26
+ | Precision | File | Size | sha256 | Checked against the original |
27
+ |---|---|---|---|---|
28
+ | 4bit | [`4bit/mflux_model.json`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/mflux_model.json) | 0.4 kB | `ec9428aa8f27` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
29
+ | 4bit | [`4bit/text_encoder/0.safetensors`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/text_encoder/0.safetensors) | 2.13 GB | `3d461b13a81f` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
30
+ | 4bit | [`4bit/text_encoder/1.safetensors`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/text_encoder/1.safetensors) | 2.14 GB | `6f8e09165bca` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
31
+ | 4bit | [`4bit/text_encoder/2.safetensors`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/text_encoder/2.safetensors) | 202.9 MB | `56de27e47826` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
32
+ | 4bit | [`4bit/text_encoder/model.safetensors.index.json`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/text_encoder/model.safetensors.index.json) | 54.2 kB | `bd366e569b0b` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
33
+ | 4bit | [`4bit/tokenizer/chat_template.jinja`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/tokenizer/chat_template.jinja) | 7.8 kB | `a4aee8afcf2e` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
34
+ | 4bit | [`4bit/tokenizer/tokenizer.json`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/tokenizer/tokenizer.json) | 20.0 MB | `06b9509352d2` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
35
+ | 4bit | [`4bit/tokenizer/tokenizer_config.json`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/tokenizer/tokenizer_config.json) | 1.1 kB | `bee8eba30f0e` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
36
+ | 4bit | [`4bit/transformer/0.safetensors`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/transformer/0.safetensors) | 2.15 GB | `ce2b196b2dba` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
37
+ | 4bit | [`4bit/transformer/1.safetensors`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/transformer/1.safetensors) | 712.5 MB | `147842364c26` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
38
+ | 4bit | [`4bit/transformer/model.safetensors.index.json`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/transformer/model.safetensors.index.json) | 50.6 kB | `1a400badd1dd` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
39
+ | 4bit | [`4bit/vae/0.safetensors`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/vae/0.safetensors) | 122.4 MB | `3737818da953` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
40
+ | 4bit | [`4bit/vae/model.safetensors.index.json`](https://huggingface.co/moonbox-ai/MOSS-Image-SFT-MLX/blob/main/4bit/vae/model.safetensors.index.json) | 17.5 kB | `e396f8330c32` | below threshold (experimental), vs bf16: PSNR 17.0 dB, LPIPS 0.273 mean / 0.292 worst |
41
+
42
+ ## How to run
43
+
44
+ Each folder is the whole pipeline (Qwen3.5 text encoder, transformer, FLUX.2 VAE, tokenizer) saved by
45
+ [mflux](https://github.com/filipstrand/mflux) 0.24.0 from the original weights at the revision below. Run it with
46
+ mflux:
47
+
48
+ ```bash
49
+ pip install mflux==0.24.0
50
+ hf download moonbox-ai/MOSS-Image-SFT-MLX --include "8bit/*" --local-dir moss
51
+ mflux-generate-moss-image --model moss/8bit --base-model moss-image-sft \
52
+ --prompt "A red fox in fresh snow at sunrise, photo" --width 1024 --height 1024 --seed 7 --output fox.png
53
+ ```
54
+
55
+ `8bit/`, `6bit/` and `4bit/` quantize the transformer's and the text encoder's linear layers (MLX affine, group size
56
+ 64); the VAE stays bf16. No fp16 folder: mflux computes in bf16 whatever the weights are.
57
+
58
+ **How they were checked.** Each quantized pipeline against `bf16/` from the *same* initial noise, 3 prompts at
59
+ 512x512, mflux's default steps. Pass: LPIPS <= 0.15 on every prompt. `bf16/` itself is the original weights in bf16;
60
+ it wasn't compared with a PyTorch run (diffusers has no MOSS-Image pipeline).
61
+
62
+ | Precision | Size | PSNR vs bf16 (mean) | LPIPS (mean / worst) | Status |
63
+ |---|---|---|---|---|
64
+ | `bf16/` | 26.2 GB | reference | - | the original weights |
65
+ | `8bit/` | 14.0 GB | 36.0 dB | 0.011 / 0.014 | passes |
66
+ | `6bit/` | 10.7 GB | 28.1 dB | 0.038 / 0.044 | passes |
67
+ | `4bit/` | 7.5 GB | 17.0 dB | 0.273 / 0.292 | **below threshold, experimental** |
68
+
69
+ About 2.5 minutes per 512x512 picture on an Apple M5 with 24 GB at mflux's defaults.
70
+
71
+ ## How these were made
72
+
73
+ From [MOSS-Image (SFT)](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT) at revision `f972bd4b4b`: the original weights loaded in MLX and stored as bf16 or fp16, or
74
+ quantized with MLX's affine quantization (`8bit`, `6bit`, `4bit`, group size 64; layers MLX can't quantize, such as
75
+ convolutions and norms, stay bf16). Every build was checked against the original before upload; the `sha256` column
76
+ above is what the files must hash to.
77
+
78
+ ## License
79
+
80
+ Apache-2.0. These files are a derivative of the original model and carry its license: it is copied in this
81
+ repository, and it governs your use of these files. The original model card follows unchanged.
82
+
83
+ ---
84
+
85
+ # Original model card
86
+
87
+ # MOSS-Image-SFT
88
+
89
+ <div align="center">
90
+ <p>
91
+ <a href="https://github.com/OpenMOSS/MOSS-Image">
92
+ <img class="dark:hidden mx-auto" src="assets/lockup-light.svg" alt="MOSS-Image" width="520">
93
+ <img class="hidden dark:block mx-auto" src="assets/lockup-dark.svg" alt="MOSS-Image" width="520">
94
+ </a>
95
+ </p>
96
+ <p>
97
+ <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>
98
+ &nbsp;
99
+ <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>
100
+ &nbsp;
101
+ <a href="https://modelscope.cn/models/openmoss/MOSS-Image-Base"><img alt="ModelScope · MOSS-Image-Base" src="assets/modelscope-base-badge.svg"></a>
102
+ &nbsp;
103
+ <a href="https://modelscope.cn/models/openmoss/MOSS-Image-SFT"><img alt="ModelScope · MOSS-Image-SFT" src="assets/modelscope-sft-badge.svg"></a>
104
+ &nbsp;
105
+ <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>
106
+ &nbsp;
107
+ <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>
108
+ &nbsp;
109
+ <a href="https://platform.mosi.cn/?utm_source=huggingface&amp;utm_medium=readme&amp;utm_campaign=imageapi"><img alt="MOSI API Platform" src="https://img.shields.io/badge/🔌%20MOSI-API%20Platform-0f766e?style=flat-square"></a>
110
+ &nbsp;
111
+ <a href="https://openmoss.github.io/MOSS-Image/"><img alt="Homepage" src="https://img.shields.io/badge/🌐%20Project-Homepage-2563eb?style=flat-square"></a>
112
+ &nbsp;
113
+ <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>
114
+ &nbsp;
115
+ <a href="https://arxiv.org/abs/2610.23374"><img alt="arXiv: 2610.23374" src="https://img.shields.io/badge/arXiv-2610.23374-b31b1b?style=flat-square&amp;logo=arxiv&amp;logoColor=white"></a>
116
+ &nbsp;
117
+ <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>
118
+ &nbsp;
119
+ <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>
120
+ &nbsp;
121
+ <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>
122
+ &nbsp;
123
+ <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>
124
+ </p>
125
+ <p>
126
+ <a href="https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE.md">User guide</a> &nbsp; · &nbsp;
127
+ <a href="https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE_ZH.md">中文用户指南</a> &nbsp; · &nbsp;
128
+ <a href="https://github.com/OpenMOSS/MOSS-Image/blob/main/comfyui/README.md">ComfyUI</a>
129
+ </p>
130
+ </div>
131
+
132
+ ![MOSS-Image-Base and MOSS-Image-SFT](assets/teaser.webp)
133
+
134
+ MOSS-Image-SFT is a supervised fine-tuned text-to-image model in the
135
+ **MOSS-Image** family from OpenMOSS, derived from
136
+ [MOSS-Image-Base](https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base).
137
+ It uses the same architecture and inference pipeline, supporting natural-language
138
+ prompts, tag sequences, and JSON layouts for controlling text placement and
139
+ object arrangement.
140
+
141
+ ## Base vs. SFT
142
+
143
+ In this example, SFT produces clearer text grouping and a more organized whiteboard layout.
144
+
145
+ | MOSS-Image-Base | MOSS-Image-SFT |
146
+ | --- | --- |
147
+ | ![MOSS-Image-Base](assets/comparison/base.webp) | ![MOSS-Image-SFT](assets/comparison/sft.webp) |
148
+
149
+ ## Quick start
150
+
151
+ Use Python 3.10 or later and an NVIDIA GPU with CUDA support. Install a PyTorch
152
+ 2.9 or later build compatible with your CUDA environment, then install:
153
+
154
+ ```bash
155
+ pip install "diffusers>=0.38" "transformers>=5.3" "accelerate>=1.10" "safetensors>=0.6" "Pillow>=10"
156
+ ```
157
+
158
+ ```python
159
+ import torch
160
+ from diffusers import DiffusionPipeline
161
+
162
+ pipe = DiffusionPipeline.from_pretrained(
163
+ "OpenMOSS-Team/MOSS-Image-SFT",
164
+ custom_pipeline="pipeline_moss_image",
165
+ trust_remote_code=True,
166
+ torch_dtype={"default": torch.bfloat16, "vae": torch.float32},
167
+ )
168
+ pipe.scheduler = type(pipe.scheduler).from_config(pipe.scheduler.config)
169
+ pipe.to("cuda")
170
+
171
+ 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:
172
+ "记得买牛奶和鸡蛋!
173
+ 牛奶两盒,鸡蛋一打。
174
+ 顺便带一袋面包。"'''
175
+
176
+ image = pipe(
177
+ prompt,
178
+ height=1024,
179
+ width=1024,
180
+ num_inference_steps=50,
181
+ guidance_scale=3.0,
182
+ uncond_skip_layers=[22],
183
+ generator=torch.Generator("cpu").manual_seed(42),
184
+ ).images[0]
185
+ image.save("refrigerator_note.png")
186
+ ```
187
+
188
+ The model and custom pipeline code are downloaded and cached automatically. You
189
+ can also pass a complete local model directory to `from_pretrained`.
190
+ The transformer and text encoder use bfloat16; the VAE and initial noise use
191
+ float32. The bundled VAE uses the FLUX.2 small decoder.
192
+
193
+ For the Gradio interface, CPU offload, and compilation options, follow the
194
+ [project quick start](https://github.com/OpenMOSS/MOSS-Image#quick-start).
195
+ For ComfyUI, search for **MOSS-Image** in **ComfyUI Manager** to install the
196
+ native plugin. Integration into the official ComfyUI repository is in progress.
197
+ See the [installation and usage guide](https://github.com/OpenMOSS/MOSS-Image/blob/main/comfyui/README.md)
198
+ and [example workflow](https://github.com/OpenMOSS/MOSS-Image/blob/main/comfyui/moss-image/example_workflows/moss-image.json).
199
+
200
+ ## Sampling settings
201
+
202
+ | Setting | Default |
203
+ | --- | --- |
204
+ | Sampler | Flow-matching Euler |
205
+ | Steps | 50 |
206
+ | CFG | 3 |
207
+ | Shift | 5 |
208
+ | Layer skipping | Negative branch, layer index 22 (zero-based) |
209
+ | Negative prompt | Empty |
210
+
211
+ The default guidance uses two transformer forwards per step. Pass
212
+ `uncond_skip_layers=[]` to disable negative-branch skipping, or set
213
+ `negative_prompt` to provide a negative prompt. Python API image dimensions must
214
+ be positive multiples of 16.
215
+
216
+ See the [user guide](https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE.md)
217
+ for resolution, sampling, prompt, and LoRA training recommendations.
218
+
219
+ ## Prompt enhancer skill
220
+
221
+ The [MOSS-Image Prompt Enhancer](https://github.com/OpenMOSS/MOSS-Image/blob/main/skills/moss-image-prompt-enhancer/SKILL.md) turns
222
+ image ideas into detailed captions or spatial Layout prompts. It is designed for
223
+ GPT-6-family agents with local file and Python tools. The bundled script converts
224
+ pixel-coordinate drafts into compact JSON with integer centered coordinates;
225
+ it does not call an image-generation service.
226
+
227
+ Install the [skill folder](https://github.com/OpenMOSS/MOSS-Image/tree/main/skills/moss-image-prompt-enhancer) in your agent's skills
228
+ directory, then invoke `$moss-image-prompt-enhancer` with your image idea, desired
229
+ caption or Layout output, and any canvas dimensions. Paste the compiled result
230
+ into MOSS-Image's positive prompt; for Layout, use the same generation dimensions.
231
+
232
+ ## Layout-to-image generation
233
+
234
+ Pass a JSON layout as the prompt to describe the scene, rendered text, objects,
235
+ and their positions. Layouts use `summary.caption` and `items`, with
236
+ `bbox_format: "yxyx"` and `bbox_coord_space: "abs_centralized"`.
237
+
238
+ With the Python API, serialize the layout using
239
+ `json.dumps(layout, ensure_ascii=False)` and pass it to `pipe`. In Gradio, paste
240
+ the JSON into the Prompt field and set the matching image dimensions.
241
+ See the [layout format and example](https://github.com/OpenMOSS/MOSS-Image/blob/main/USERGUIDE.md#layout-prompts-experimental).
242
+
243
+ Layouts can also support controlled editing and user-friendly layout tools.
244
+ Edit text, element descriptions, and bounding boxes to adjust image content and
245
+ composition in a structured way.
246
+
247
+ ![Layout control](assets/showcase/layout-bboxes.webp)
248
+
249
+ ## Showcase
250
+
251
+ ![Examples overview](assets/showcase/overview.webp)
252
+
253
+ ![Examples overview 2](assets/showcase/overview2.webp)
254
+
255
+ ## Citation
256
+
257
+ ```bibtex
258
+ @misc{ai2026mossimagetechnicalreport,
259
+ title={MOSS-Image Technical Report},
260
+ author={MOSI. AI},
261
+ year={2026},
262
+ eprint={2610.23374},
263
+ archivePrefix={arXiv},
264
+ primaryClass={cs.CV},
265
+ url={https://arxiv.org/abs/2610.23374},
266
+ }
267
+ ```
268
+
269
+ ## License and acknowledgements
270
+
271
+ The model weights and bundled inference code are released under the
272
+ [Apache License, Version 2.0](LICENSE).
273
+
274
+ We thank the Diffusers, Qwen, and FLUX teams.