Epyan nif0 commited on
Commit
8b31b82
Β·
0 Parent(s):

Duplicate from nif0/MOSS-Image-SFT-ComfyUI

Browse files

Co-authored-by: Nif <nif0@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
+ assets/compare_anime.jpg filter=lfs diff=lfs merge=lfs -text
37
+ assets/compare_noir_photo.jpg filter=lfs diff=lfs merge=lfs -text
38
+ assets/compare_popup_book.jpg filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: OpenMOSS-Team/MOSS-Image-SFT
4
+ base_model_relation: quantized
5
+ language:
6
+ - en
7
+ - zh
8
+ pipeline_tag: text-to-image
9
+ library_name: comfyui
10
+ tags:
11
+ - moss-image
12
+ - comfyui
13
+ - text-to-image
14
+ - quantized
15
+ - int8
16
+ - w4a8
17
+ - gptq
18
+ - convrot
19
+ ---
20
+
21
+ # MOSS-Image-SFT β€” INT8 / W4A8 ConvRot (ComfyUI)
22
+
23
+ Single-file, ComfyUI-ready quantization of
24
+ [**OpenMOSS-Team/MOSS-Image-SFT**](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT)
25
+ (code and docs: [OpenMOSS/MOSS-Image](https://github.com/OpenMOSS/MOSS-Image)).
26
+ All credit for the model goes to OpenMOSS; this repo only re-packages the weights.
27
+
28
+ | Component | Format | Size | Original |
29
+ |---|---|---|---|
30
+ | Diffusion model (DiT, 42 blocks) | **INT8 ConvRot** | 5.41 GB | 10.16 GB (bf16) |
31
+ | Text encoder (Qwen3.5-9B) | **W4A8 GPTQ ConvRot** | 5.43 GB | 16.79 GB (bf16) |
32
+ | VAE (`AutoencoderKLFlux2`) | **bf16** | 125 MB | 250 MB (fp32) |
33
+
34
+ ## File layout
35
+
36
+ ```
37
+ MOSS-Image-SFT-INT8-W4A8-ConvRot/
38
+ β”œβ”€β”€ diffusion_models/
39
+ β”‚ └── moss_image_sft_int8_convrot.safetensors # 5.41 GB
40
+ β”œβ”€β”€ text_encoders/
41
+ β”‚ └── qwen3.5_9b_moss_image_sft_w4a8_gptq.safetensors # 5.43 GB
42
+ β”œβ”€β”€ vae/
43
+ β”‚ └── moss_image_vae_bf16.safetensors # 125 MB
44
+ └── assets/ # comparison images
45
+ ```
46
+
47
+ Drop each file into the matching folder of your ComfyUI `models/` directory.
48
+
49
+ ## Usage (ComfyUI)
50
+
51
+ 1. Install the official node pack from the
52
+ [MOSS-Image ComfyUI guide](https://github.com/OpenMOSS/MOSS-Image/blob/main/comfyui/README.md)
53
+ (copy `comfyui/moss-image` into `custom_nodes/`). ComfyUI needs
54
+ [comfy-kitchen](https://github.com/Comfy-Org/comfy-kitchen) quantized-op support; the
55
+ quantization type is auto-detected from the files.
56
+ 2. Load with the plugin's single-file loaders:
57
+ - **MOSSImageUNETLoader** β†’ `moss_image_sft_int8_convrot.safetensors`
58
+ - **MOSSImageCLIPLoader** β†’ `qwen3.5_9b_moss_image_sft_w4a8_gptq.safetensors`
59
+ - **VAELoader** β†’ `moss_image_vae_bf16.safetensors`
60
+ 3. Use the official SFT sampling settings: **Euler**, 50 steps, **CFG 3**, `ModelSamplingSD3` shift **5**,
61
+ uncond skip-layer **22**.
62
+
63
+ Tested end-to-end in stock ComfyUI on an 8 GB RTX 3060 Ti (β‰ˆ210 s for 1024Γ—1536, 50 steps).
64
+
65
+ ## How it was made
66
+
67
+ - **DiT:** all 252 block linears (`layers.N.proj.{q,k,v,o,ffn_up_gate,ffn_down}`) quantized to INT8 with a
68
+ group-Hadamard (size 256) ConvRot rotation and per-output-channel scales. Embedders, modulation,
69
+ final layers and norms are kept in original precision.
70
+ - **Text encoder:** the 200 body linears (attention / linear-attention / MLP) quantized to 4-bit weights
71
+ (group 16, fp8 relative scales) with 8-bit activations, using GPTQ run in the rotated basis. Calibration used
72
+ the model's real chat template on the official example prompts and negatives plus public prompt datasets.
73
+ Embeddings and the vision tower are INT8 ConvRot; everything else is unchanged.
74
+ - **VAE:** plain fp32 β†’ bf16 cast.
75
+
76
+ ## Quality check
77
+
78
+ 50 steps, official sizes, same seed, cfg 3. Left β†’ right in each strip: original bf16 pipeline Β·
79
+ bf16 VAE Β· INT8 DiT Β· everything quantized (INT8 DiT + W4A8 text encoder + bf16 VAE).
80
+
81
+ ![anime](assets/compare_anime.jpg)
82
+ ![pop-up book](assets/compare_popup_book.jpg)
83
+ ![noir photo](assets/compare_noir_photo.jpg)
84
+
85
+ - bf16 VAE vs. fp32 decode: **~54 dB PSNR** (visually identical).
86
+ - Quantized DiT / full stack diverge in fine detail over the 50-step trajectory (PSNR 19–27 dB vs. the
87
+ original output), but composition, identity, style, lighting and rendered text are preserved.
88
+ - Text-encoder `last_hidden_state` cosine vs. bf16: β‰ˆ 0.996 (mean over tokens, first example prompt).
89
+
90
+ Limitations: only three prompts were compared visually; the original model card recommends an fp32 VAE, which
91
+ is the safest choice if you see banding. Results in ComfyUI's sampler will not match the diffusers pipeline
92
+ pixel for pixel.
93
+
94
+ ## Checksums (SHA-256)
95
+
96
+ ```
97
+ ffd98820ac8f0f57c48386bd98852720de50c3acb502f73fd641d0cd9df6d0af moss_image_sft_int8_convrot.safetensors
98
+ b5f31a430e4912decb152f3a0761350f52282176823b597edd43b2e3f6403da4 qwen3.5_9b_moss_image_sft_w4a8_gptq.safetensors
99
+ 81a27c7135775f149648fa35a58eec6d78a3e6a9bb9273885b51895cbc212d5d moss_image_vae_bf16.safetensors
100
+ ```
101
+
102
+ ## License & attribution
103
+
104
+ Apache-2.0, same as the original. Original model, architecture and pipeline Β© OpenMOSS-Team
105
+ ([MOSS-Image-Base](https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base),
106
+ [MOSS-Image-SFT](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT),
107
+ [technical report](https://github.com/OpenMOSS/MOSS-Image/blob/main/paper/MOSS_Image_Technical_Report.pdf)).
108
+ This repo is an unofficial community quantization and is not affiliated with OpenMOSS.
assets/compare_anime.jpg ADDED

Git LFS Details

  • SHA256: ac6c50a8fa1139f077f97d98b0d7608a3770816920cb5db57edc67ba83c9c39f
  • Pointer size: 131 Bytes
  • Size of remote file: 209 kB
assets/compare_noir_photo.jpg ADDED

Git LFS Details

  • SHA256: 594d329949b88904a715c81c2ad5511ddcce389412377ce9bf00aadf76385dc8
  • Pointer size: 131 Bytes
  • Size of remote file: 277 kB
assets/compare_popup_book.jpg ADDED

Git LFS Details

  • SHA256: 7f8010abfed180d5989110172c9cd50bbd74fa60e57e9b12814ac23b288437af
  • Pointer size: 131 Bytes
  • Size of remote file: 492 kB
diffusion_models/moss_image_sft_int8_convrot.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ffd98820ac8f0f57c48386bd98852720de50c3acb502f73fd641d0cd9df6d0af
3
+ size 5413724040
text_encoders/qwen3.5_9b_moss_image_sft_w4a8_gptq.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5f31a430e4912decb152f3a0761350f52282176823b597edd43b2e3f6403da4
3
+ size 5428937108
vae/moss_image_vae_bf16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81a27c7135775f149648fa35a58eec6d78a3e6a9bb9273885b51895cbc212d5d
3
+ size 124774710