Add README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- OpenMOSS-Team/MOSS-Image-Base
|
| 5 |
+
- OpenMOSS-Team/MOSS-Image-SFT
|
| 6 |
+
library_name: comfyui
|
| 7 |
+
pipeline_tag: text-to-image
|
| 8 |
+
tags:
|
| 9 |
+
- moss-image
|
| 10 |
+
- quantization
|
| 11 |
+
- w4a8
|
| 12 |
+
- w6a8
|
| 13 |
+
- gptq
|
| 14 |
+
- comfyui
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# MOSS-Image HMS v1 (Base and SFT)
|
| 18 |
+
|
| 19 |
+
**HMS v1** is the HaDeS MOSS Suite's own quantization of MOSS-Image. Each model is **3.96 GB** instead of 10.2 GB in bfloat16 and 5.4 GB in Comfy-Org's int8 ConvRot.
|
| 20 |
+
|
| 21 |
+
- **Same loader:** it loads with ComfyUI's stock **Load Diffusion Model** node.
|
| 22 |
+
- **Native kernels:** it runs on ComfyUI's native W4A8 / W6A8 kernels (comfy-kitchen). No custom loader or custom node is needed to use it.
|
| 23 |
+
- **Faster:** on an RTX 5090 it renders about **2x faster** than bfloat16.
|
| 24 |
+
- **Less VRAM:** peak allocated VRAM is **11.6 GB** instead of 17.8 GB.
|
| 25 |
+
- **Quality:** in a blind review against bfloat16 it was judged *practically equal*.
|
| 26 |
+
|
| 27 |
+
| File | Model | Size | SHA-256 |
|
| 28 |
+
|---|---|---:|---|
|
| 29 |
+
| `MOSS-Image_Base_HMS_v1.safetensors` | MOSS-Image Base | 3,955,670,084 B | `81632cf79adc26c4dc1f86a13f9cc94bd0cb2442ec29a3fe5616d0cf2f69da89` |
|
| 30 |
+
| `MOSS-Image_SFT_HMS_v1.safetensors` | MOSS-Image SFT | 3,955,670,084 B | `a33dc49aa831a9451085ec3ac0a9ab6fdde0aba9a1eb2860d37b73864b5a0c79` |
|
| 31 |
+
|
| 32 |
+
## How to use
|
| 33 |
+
|
| 34 |
+
1. Put the file in `ComfyUI/models/diffusion_models/`.
|
| 35 |
+
2. Load it with **Load Diffusion Model** (`weight_dtype` default), or with the Suite's **MOSS Loader**.
|
| 36 |
+
3. Use the usual MOSS-Image text encoder and VAE from [Comfy-Org/MOSS-Image](https://huggingface.co/Comfy-Org/MOSS-Image): `qwen3.5_9b_int8_convrot` (or `w4a8_gptq`) through **Load CLIP** with type `moss_image`, and `flux2-vae`.
|
| 37 |
+
4. Sample as with the bfloat16 model. The figures below used 25 steps, CFG 2.5, `er_sde`, `simple`, shift 5.
|
| 38 |
+
|
| 39 |
+
The file needs a ComfyUI recent enough to ship comfy-kitchen's `AsymW4A8Int8Layout` (W4A8 / W6A8). It was tested with comfy-kitchen 0.2.40.
|
| 40 |
+
|
| 41 |
+
## What is inside
|
| 42 |
+
|
| 43 |
+
MOSS-Image is a single-stream DiT with 42 blocks. HMS v1 quantizes the four linear projections of every block and keeps everything else in bfloat16 (embedders, modulation, norms, final layers).
|
| 44 |
+
|
| 45 |
+
| Projections | Format |
|
| 46 |
+
|---|---|
|
| 47 |
+
| Attention (`qkv`, `o`), all 42 blocks | W6A8 (6-bit weights, int8 activations) |
|
| 48 |
+
| FFN (`ffn_up_gate`, `ffn_down`), blocks 30-41 | W6A8 |
|
| 49 |
+
| FFN, blocks 0-29 | W4A8 with a 4-bit codebook |
|
| 50 |
+
|
| 51 |
+
All formats are ComfyUI's native ones. The weights are rotated with the ConvRot Hadamard transform (groups of 256), and their values are set by our own calibration:
|
| 52 |
+
|
| 53 |
+
- **C1:** the 4-bit codebook and the per-group scales are searched to minimise the error weighted by each input channel's real activation energy, not the plain weight error.
|
| 54 |
+
- **GPTQ in the rotated basis:** each projection is rounded column by column against real activations captured from the model itself. The second-order correction keeps the output close to bfloat16.
|
| 55 |
+
- **Calibration:** seven fixed prompts are sampled with the model being quantized at seed 1001, 1024², 25 steps, CFG 2.5. Four are scenes and three carry quoted text. We kept the text prompts because calibrating without them lost lettering (Base text 131/143 without them, 139/143 with them).
|
| 56 |
+
|
| 57 |
+
The layout (which blocks get 6 bits) and the calibration were chosen by measurement against the earlier candidates and Comfy-Org's int8 / W4A8 files. The whole experiment, including the rejected codecs, is in the Suite's [`tools/RESULTS.md`](https://github.com/Devildonia/HaDeS-MOSS-Suite/blob/main/tools/RESULTS.md) ("HMS v1: decision" and the sections before it).
|
| 58 |
+
|
| 59 |
+
## Measured against bfloat16
|
| 60 |
+
|
| 61 |
+
All runs used an RTX 5090 and the same seeds and settings for HMS and bfloat16.
|
| 62 |
+
- **Scenes:** 10 varied prompts.
|
| 63 |
+
- **Text:** prompts with quoted text, scored by exact reading with OCR (`MOSS Text Check`). Base used its 143-case text set. SFT used 11 text prompts × 10 seeds (2001–2010) = 110 cases.
|
| 64 |
+
|
| 65 |
+
| Model | L1@64 from BF16 (scenes) | Median luma shift | Detail (Laplacian variance, HMS / BF16) | Text exact (HMS / BF16) |
|
| 66 |
+
|---|---:|---:|---|---|
|
| 67 |
+
| Base | 4.13 % | +0.49 | 548 / 514 | 139/143 vs 140/143 |
|
| 68 |
+
| SFT | 4.72 % | +0.70 | 2003 / 2079 | 106/110 vs 105/110 |
|
| 69 |
+
|
| 70 |
+
How to read this:
|
| 71 |
+
- **L1@64** is the mean absolute difference of the image downscaled to 64 px, as a percentage. It measures how far the composition and colour move from the bfloat16 render with the same seed. For scale, Base with every projection in W6A8 (larger file) measured 4.05 % on the same protocol.
|
| 72 |
+
- **Luma** stays within ±0.7 of 255: no visible brightening or darkening.
|
| 73 |
+
- **Text** reads within one case of bfloat16.
|
| 74 |
+
|
| 75 |
+
All four HMS v1 models we made (Base, SFT, HaDeS MOSS v1.0 Turbo, Bulle d'Encre) passed every gate: text no worse than BF16 − 2 and median luma within ±2.5. A blind review by the author, with keys unopened, judged them practically equal to bfloat16.
|
| 76 |
+
|
| 77 |
+
## Make your own HMS file
|
| 78 |
+
|
| 79 |
+
The **HaDeS MOSS Suite** (0.9.5 and later, [GitHub](https://github.com/Devildonia/HaDeS-MOSS-Suite), Comfy Registry `hades-moss-suite`) can save any MOSS-Image model in HMS v1, merges and baked LoRAs included:
|
| 80 |
+
|
| 81 |
+
1. In **MOSS Model Saver**, set `precision` to `HMS v1 (W4A8 / W6A8, calibrated)`.
|
| 82 |
+
2. Connect the text encoder to `clip`.
|
| 83 |
+
3. Set the calibration steps, CFG, sampler and scheduler the model is meant to run with.
|
| 84 |
+
|
| 85 |
+
The Saver runs the same recipe as these files. For MOSS-Image SFT its output is bit-identical to `MOSS-Image_SFT_HMS_v1.safetensors` (942 of 942 tensors).
|
| 86 |
+
- **Time and memory:** in a real ComfyUI on an RTX 5090 a save takes 8–10 minutes, with a peak of about 19.5 GB of RAM and 24.6 GB of VRAM.
|
| 87 |
+
- **Merges:** a merge's HMS file can land slightly darker than its bfloat16 save (median luma −2.8 on our test merge), so check a merge by eye.
|
| 88 |
+
|
| 89 |
+
## Limits
|
| 90 |
+
|
| 91 |
+
- **Not identical:** HMS v1 is close to bfloat16, but not the same. With the same seed, small details change, and now and then a busy page (a manga grid, for example) redraws a panel differently.
|
| 92 |
+
- **Measured on one GPU:** speed and memory were measured on an RTX 5090. Other GPUs need the native W4A8 / W6A8 kernels of comfy-kitchen.
|
| 93 |
+
- **Training:** for training or merging, start from the bfloat16 models. Requantizing an HMS file is not supported.
|
| 94 |
+
|
| 95 |
+
## Credits and license
|
| 96 |
+
|
| 97 |
+
Apache License 2.0 (see `LICENSE` and `NOTICE`).
|
| 98 |
+
- **Source models:** quantized from MOSS-Image Base and MOSS-Image SFT by the OpenMOSS Team (Apache 2.0), through the bfloat16 weights published by [Comfy-Org/MOSS-Image](https://huggingface.co/Comfy-Org/MOSS-Image).
|
| 99 |
+
- **Formats and kernels:** the quantized formats and kernels are ComfyUI's / comfy-kitchen's.
|
| 100 |
+
- **Calibration recipe and files:** made by HaDeS (DeVilDoNia) for the HaDeS MOSS Suite.
|