--- license: apache-2.0 base_model: OpenMOSS-Team/MOSS-Image-SFT base_model_relation: quantized language: - en - zh pipeline_tag: text-to-image library_name: comfyui tags: - moss-image - comfyui - text-to-image - quantized - int8 - w4a8 - gptq - convrot --- # MOSS-Image-SFT — INT8 / W4A8 ConvRot (ComfyUI) Single-file, ComfyUI-ready quantization of [**OpenMOSS-Team/MOSS-Image-SFT**](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT) (code and docs: [OpenMOSS/MOSS-Image](https://github.com/OpenMOSS/MOSS-Image)). All credit for the model goes to OpenMOSS; this repo only re-packages the weights. | Component | Format | Size | Original | |---|---|---|---| | Diffusion model (DiT, 42 blocks) | **INT8 ConvRot** | 5.41 GB | 10.16 GB (bf16) | | Text encoder (Qwen3.5-9B) | **W4A8 GPTQ ConvRot** | 5.43 GB | 16.79 GB (bf16) | | VAE (`AutoencoderKLFlux2`) | **bf16** | 125 MB | 250 MB (fp32) | ## File layout ``` MOSS-Image-SFT-INT8-W4A8-ConvRot/ ├── diffusion_models/ │ └── moss_image_sft_int8_convrot.safetensors # 5.41 GB ├── text_encoders/ │ └── qwen3.5_9b_moss_image_sft_w4a8_gptq.safetensors # 5.43 GB ├── vae/ │ └── moss_image_vae_bf16.safetensors # 125 MB └── assets/ # comparison images ``` Drop each file into the matching folder of your ComfyUI `models/` directory. ## Usage (ComfyUI) 1. Install the official node pack from the [MOSS-Image ComfyUI guide](https://github.com/OpenMOSS/MOSS-Image/blob/main/comfyui/README.md) (copy `comfyui/moss-image` into `custom_nodes/`). ComfyUI needs [comfy-kitchen](https://github.com/Comfy-Org/comfy-kitchen) quantized-op support; the quantization type is auto-detected from the files. 2. Load with the plugin's single-file loaders: - **MOSSImageUNETLoader** → `moss_image_sft_int8_convrot.safetensors` - **MOSSImageCLIPLoader** → `qwen3.5_9b_moss_image_sft_w4a8_gptq.safetensors` - **VAELoader** → `moss_image_vae_bf16.safetensors` 3. Use the official SFT sampling settings: **Euler**, 50 steps, **CFG 3**, `ModelSamplingSD3` shift **5**, uncond skip-layer **22**. Tested end-to-end in stock ComfyUI on an 8 GB RTX 3060 Ti (≈210 s for 1024×1536, 50 steps). ## How it was made - **DiT:** all 252 block linears (`layers.N.proj.{q,k,v,o,ffn_up_gate,ffn_down}`) quantized to INT8 with a group-Hadamard (size 256) ConvRot rotation and per-output-channel scales. Embedders, modulation, final layers and norms are kept in original precision. - **Text encoder:** the 200 body linears (attention / linear-attention / MLP) quantized to 4-bit weights (group 16, fp8 relative scales) with 8-bit activations, using GPTQ run in the rotated basis. Calibration used the model's real chat template on the official example prompts and negatives plus public prompt datasets. Embeddings and the vision tower are INT8 ConvRot; everything else is unchanged. - **VAE:** plain fp32 → bf16 cast. ## Quality check 50 steps, official sizes, same seed, cfg 3. Left → right in each strip: original bf16 pipeline · bf16 VAE · INT8 DiT · everything quantized (INT8 DiT + W4A8 text encoder + bf16 VAE). ![anime](assets/compare_anime.jpg) ![pop-up book](assets/compare_popup_book.jpg) ![noir photo](assets/compare_noir_photo.jpg) - bf16 VAE vs. fp32 decode: **~54 dB PSNR** (visually identical). - Quantized DiT / full stack diverge in fine detail over the 50-step trajectory (PSNR 19–27 dB vs. the original output), but composition, identity, style, lighting and rendered text are preserved. - Text-encoder `last_hidden_state` cosine vs. bf16: ≈ 0.996 (mean over tokens, first example prompt). Limitations: only three prompts were compared visually; the original model card recommends an fp32 VAE, which is the safest choice if you see banding. Results in ComfyUI's sampler will not match the diffusers pipeline pixel for pixel. ## Checksums (SHA-256) ``` ffd98820ac8f0f57c48386bd98852720de50c3acb502f73fd641d0cd9df6d0af moss_image_sft_int8_convrot.safetensors b5f31a430e4912decb152f3a0761350f52282176823b597edd43b2e3f6403da4 qwen3.5_9b_moss_image_sft_w4a8_gptq.safetensors 81a27c7135775f149648fa35a58eec6d78a3e6a9bb9273885b51895cbc212d5d moss_image_vae_bf16.safetensors ``` ## License & attribution Apache-2.0, same as the original. Original model, architecture and pipeline © OpenMOSS-Team ([MOSS-Image-Base](https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base), [MOSS-Image-SFT](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT), [technical report](https://github.com/OpenMOSS/MOSS-Image/blob/main/paper/MOSS_Image_Technical_Report.pdf)). This repo is an unofficial community quantization and is not affiliated with OpenMOSS.