Cosmos3-Edge-int4-convrot.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:416c256176f52f33768d5a551a090b63598b0ce9a26f872174543df5bf8631de
3
- size 3129557536
 
 
 
 
Cosmos3-Nano-int4-convrot.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2e94116fc798813b64c6922d746f5214b00eb1d0e12ff3ffb8433a329450ea50
3
- size 12382144496
 
 
 
 
Cosmos3-Super-Image2Video-4Step-int4-convrot.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:af234e8008f270fd1adf311d1d1a2ecaba396f728735097f633796d8a955751b
3
- size 46718563752
 
 
 
 
Cosmos3-Super-Image2Video-int4-convrot.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:969d419cf0dd1f152f1188eeb46eb3994639ee956d8691d60c2606e4e12c9985
3
- size 46718563752
 
 
 
 
Cosmos3-Super-int4-convrot.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ed496d2cd525bb12409bb8bc83f66e83c405a9fc930ca70bc2d4ea745e93083c
3
- size 46762181072
 
 
 
 
README.md CHANGED
@@ -1,133 +1,64 @@
1
  ---
2
- license: other
3
  license_name: openmdw-1.1
4
- license_link: https://openmdw.ai/license/1-1/
5
  tags:
6
- - text-to-video
7
- - image-to-video
8
- - quantized
9
- - int8
10
- - int4
11
- - comfyui
12
- - cosmos3
13
  ---
14
 
15
- # Cosmos3 quantized transformers
16
 
17
- Weight-only quantized transformers of the NVIDIA Cosmos3 models, for use with
18
- [ComfyUI-Cosmos3](https://github.com/RyukoMatoiFan/ComfyUI-Cosmos3). Each file is one quantized
19
- transformer; take the VAE, tokenizer(s) and `config.json` from the matching official
20
- `nvidia/Cosmos3-*` repo.
21
 
22
- Two formats:
23
-
24
- - **int8** weight-only INT8, per-output-channel scale + a group-wise Hadamard rotation (ConvRot).
25
- - **int4** MLP weights INT4 (GPTQ-calibrated with a ConvRot Hadamard rotation, packed as AWQ
26
- W4A16); attention kept INT8; the excluded layers (below) stay bf16. Larger quantization error than
27
- int8 (at a fixed seed the output diverges from bf16 more than int8 does); about a third of the bf16
28
- size.
29
-
30
- Both are **weight-only**: activations stay bf16, so this lowers memory/download size, not compute
31
- speed. int4 runs at about bf16 speed — the per-forward dequantize and un-rotate add a little.
32
-
33
- ## Files and sizes
34
-
35
- | Model | bf16 | int8 | int4 |
36
- |-------|------|------|------|
37
- | `Cosmos3-Nano` | 30 GB | **16.5 GB** | **12.4 GB** |
38
- | `Cosmos3-Super` | 128 GB | **65.7 GB** | **46.8 GB** |
39
- | `Cosmos3-Super-Image2Video` | 128 GB | **65.6 GB** | **46.7 GB** |
40
- | `Cosmos3-Super-Image2Video-4Step` | 128 GB | **65.6 GB** | **46.7 GB** |
41
- | `Cosmos3-Edge` | 6.7 GB | **3.9 GB** | **3.0 GB** |
42
-
43
- File names: `Cosmos3-<name>-int8-convrot.safetensors` and `Cosmos3-<name>-int4-convrot.safetensors`.
44
- int4 and int8 are provided for every model.
45
-
46
- **Prompting note (Edge):** `Cosmos3-Edge` is trained on JSON-structured prompts and is less robust to
47
- plain text than the larger Nano/Super. Plain text usually works, but on some detailed scenes (notably
48
- reflective surfaces) it can produce flare/pulsation artifacts; wrapping the text as
49
- `{"temporal_caption": "<your prompt>"}` avoids them. This is a base-model property, not a quantization
50
- effect (it shows in bf16 too).
51
-
52
- ## Runtime footprint
53
-
54
- With ComfyUI's dynamic VRAM the transformer is streamed from host RAM, so the GPU holds only the
55
- activations. Measured at 832×480, 93 frames, at the minimum VRAM budget (maximum streaming):
56
-
57
- | Model | Min VRAM | RAM (bf16 / int8 / int4) |
58
- |-------|----------|---------------------------|
59
- | `Cosmos3-Edge` | ≈6 GB | 14 / 7 / 7 GB |
60
- | `Cosmos3-Nano` | ≈7 GB | 58 / 21 / 20 GB |
61
- | `Cosmos3-Super` (t2v & i2v) | ≈8–9 GB | 240 / 67 / 63 GB |
62
-
63
- Min VRAM is the activation floor (set by resolution × frame count, not the weight format). RAM is the
64
- peak host memory — larger than the file on disk (staging + overhead), and bf16 peaks near twice the
65
- weight size. RAM and VRAM trade off: giving the GPU more VRAM holds more weights on-card and lowers the
66
- RAM figure. The Super-family int4 checkpoints fit a 64 GB host (≈63 GB); int8 needs a little more
67
- (≈67 GB).
68
 
69
  ## Usage
70
 
71
- 1. Download the official `nvidia/Cosmos3-<name>` into `ComfyUI/models/cosmos3/<name>/`.
72
- 2. In its `transformer/` folder, delete the bf16 shards and `*.index.json`, then put the quantized
73
- file there renamed to `diffusion_pytorch_model.safetensors`. Keep the official `config.json`,
74
- `vae/`, `text_tokenizer/`, `sound_tokenizer/`.
75
- 3. Load with the Cosmos3 Loader (`weight_dtype = default`); the loader reads the format from the
76
- checkpoint metadata. Requires comfy-kitchen (int8 from ComfyUI >= 0.27) and the latest
77
- ComfyUI-Cosmos3 (int4 needs the ConvRot-aware loader).
78
 
79
- ## How these were quantized
80
 
81
- Reproducible in method, not bit-for-bit (the calibration set and RNG vary per run). Both formats keep
82
- the same **escape set in bf16**: `proj_in`, `proj_out`, `time_embedder`, `audio_proj`,
83
- `modality_embed`, the embeddings, and all norms and biases.
 
84
 
85
- ### int8 every linear
86
-
87
- Weight-only symmetric INT8, per-output-channel scale (`weight_scale`, float32, `[out, 1]`), with a
88
- group-wise Hadamard rotation (ConvRot, **group 256**) applied before quantization and undone at load.
89
- comfy_quant tag `int8_tensorwise`, `convrot=true`. No calibration: at 8-bit the per-channel scale and
90
- the rotation keep the round-to-nearest error small — error feedback (GPTQ) is only needed at int4.
91
- Produced with
92
- [convert_to_quant](https://github.com/silveroxides/convert_to_quant):
93
 
 
94
  ctq -i transformer_bf16.safetensors -o out_int8_convrot.safetensors \
95
  --int8 --scaling_mode row --simple --convrot --convrot-group-size 256 \
96
  --comfy_quant --save-quant-metadata --cosmos3 --device cuda --low-memory
97
 
98
- ### int4 MLP int4, attention int8
99
-
100
- Round-to-nearest INT4 — even with the ConvRot rotation — leaves visible artifacts on these models, so
101
- the MLP path uses **GPTQ error compensation on real activations**. Steps:
102
-
103
- 1. **Capture activations.** Run genuine denoising at 832×480, 93 frames with the model's normal
104
- sampler (t2v / base-i2v: 35 steps, cfg 6, `uni_pc_bh2`; 4-step model: 4 steps, cfg 1, `euler`) over
105
- ≈4 prompts, with a forward pre-hook on every target linear. Keep a reservoir of up to **4096** rows
106
- per layer (random replacement beyond that). The understanding tower sees the text prefill; the
107
- generation tower sees every denoising step.
108
- 2. **Rotate (ConvRot).** Apply a Sylvester block-Hadamard — symmetric, orthonormal, **group 32** — to
109
- both the weight and the captured activations of each MLP linear.
110
- 3. **GPTQ.** Quantize the rotated weight to symmetric INT4 (codes −8…7, per-(row, group-32) scale).
111
- Hessian `H = XᵀX · 2/N` from the rotated activations; diagonal damping raised through
112
- `{0.01, 0.03, 0.1, 0.3, 1, 3} × mean(diag)` until the Cholesky factors; columns processed in blocks
113
- of **128** with per-column error feedback into the not-yet-quantized columns; plain round-to-nearest
114
- only if damping never succeeds.
115
- 4. **Attention → int8** (row-wise, `[out, 1]` scale). INT4 on attention produces visible artifacts.
116
- 5. **Pack** the INT4 codes into comfy-kitchen's **AWQ W4A16** layout; the loader un-rotates each group
117
- at dequant.
118
 
119
- Layer counts follow the checkpoint's `config.json` e.g. `Cosmos3-Super-Image2Video` packs 384 MLP
120
- linears (INT4) + 512 attention linears (INT8).
 
 
121
 
122
- **Execution.** Both formats run as an explicit dequantize-then-bf16 matmul (unpack the 4-bit weights
123
- to bf16, un-rotate, multiply in bf16). This is weight-only regardless: there is no int4-weight ×
124
- bf16-activation tensor-core op on any GPU (Hopper or Blackwell — Blackwell's FP4 cores are for NVFP4,
125
- both operands 4-bit, not this W4A16 layout), so a W4A16 kernel would dequantize internally too, with no
126
- compute speedup either way. We dequantize explicitly instead of calling comfy-kitchen's
127
- `gemv_awq_w4a16`, which is non-deterministic (atomic accumulation jitters the video frame-to-frame) and
128
- numerically off on these shapes.
129
 
130
  ## License
131
 
132
- Derived from NVIDIA Cosmos3 checkpoints; the [OpenMDW-1.1](https://openmdw.ai/license/1-1/) license
133
- applies (same as the upstream `nvidia/Cosmos3-*` models).
 
1
  ---
2
+ license: openmdw-1.1
3
  license_name: openmdw-1.1
 
4
  tags:
5
+ - text-to-video
6
+ - image-to-video
7
+ - quantized
8
+ - int8
9
+ - comfyui
10
+ - cosmos3
 
11
  ---
12
 
13
+ # Cosmos3 ConvRot (INT8)
14
 
15
+ INT8-ConvRot quantized transformers of the NVIDIA Cosmos3 models, for use with ComfyUI-Cosmos3
16
+ (https://github.com/RyukoMatoiFan/ComfyUI-Cosmos3). Each file is one quantized transformer; take the
17
+ VAE, tokenizer(s) and config.json from the matching official nvidia/Cosmos3-* repo.
 
18
 
19
+ | File | Source repo | Size (bf16 → int8) | Modalities |
20
+ |------|-------------|--------------------|------------|
21
+ | `Cosmos3-Nano-int8-convrot.safetensors` | nvidia/Cosmos3-Nano | 29 16 GB | t2v / i2v / audio, fps 24 |
22
+ | `Cosmos3-Super-int8-convrot.safetensors` | nvidia/Cosmos3-Super | 120 62 GB | t2v / i2v / audio, fps 24 |
23
+ | `Cosmos3-Super-Image2Video-int8-convrot.safetensors` | nvidia/Cosmos3-Super-Image2Video | 120 62 GB | i2v, fps 16 |
24
+ | `Cosmos3-Super-Image2Video-4Step-int8-convrot.safetensors` | nvidia/Cosmos3-Super-Image2Video-4Step | 120 62 GB | i2v, DMD2 4-step, cfg 1 |
25
+ | `Cosmos3-Edge-int8-convrot.safetensors` | nvidia/Cosmos3-Edge | 6.3 → 3.7 GB | t2v / i2v, nemotron_dense |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ## Usage
28
 
29
+ 1. Download the official nvidia/Cosmos3-<name> into ComfyUI/models/cosmos3/<name>/.
30
+ 2. In its transformer/ folder, delete the bf16 shards and *.index.json, then put the int8 file there
31
+ renamed to diffusion_pytorch_model.safetensors. Keep the official config.json, vae/,
32
+ text_tokenizer/, sound_tokenizer/.
33
+ 3. Load with the Cosmos3 Loader (weight_dtype = default). Requires a ComfyUI with native INT8
34
+ (>= 0.27, comfy-kitchen + Triton) and the latest ComfyUI-Cosmos3.
 
35
 
36
+ ## Quantization
37
 
38
+ Format: comfy_quant int8_tensorwise with convrot=true (weight-only INT8; quantize_input=false, so
39
+ activations stay in the bf16 compute dtype). Weights are per-output-channel (row-wise) symmetric INT8
40
+ with a float32 weight_scale of shape [out_features, 1]; a group-wise Hadamard rotation (ConvRot, group
41
+ size 256) is applied to each weight before quantization. Excluded layers stay bf16 (see below).
42
 
43
+ Produced with convert_to_quant (ctq): https://github.com/silveroxides/convert_to_quant
 
 
 
 
 
 
 
44
 
45
+ # 1. consolidate the sharded diffusers transformer into one safetensors, then:
46
  ctq -i transformer_bf16.safetensors -o out_int8_convrot.safetensors \
47
  --int8 --scaling_mode row --simple --convrot --convrot-group-size 256 \
48
  --comfy_quant --save-quant-metadata --cosmos3 --device cuda --low-memory
49
 
50
+ --simple skips learned rounding (ConvRot handles the weight outliers; learned rounding adds only
51
+ ~0.001 latent cosine for much more compute).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ --cosmos3 is a layer-exclusion preset kept in bf16, in addition to ctq's base avoid-list
54
+ (norm, bias, embed_tokens, lm_head, k_norm, q_norm): proj_in, proj_out, time_embedder, audio_proj,
55
+ action, modality_embed. To reproduce, add a cosmos3 entry to convert_to_quant/constants.py
56
+ MODEL_FILTERS with exclude = AVOID_KEY_NAMES and highprec = that list.
57
 
58
+ Checked per model against bf16: Nano latent cosine 0.986; others visually indistinguishable.
59
+ 4-bit (NVFP4) is not provided: it requires a Blackwell GPU (SM >= 10.0) for both conversion and
60
+ inference.
 
 
 
 
61
 
62
  ## License
63
 
64
+ Derived from NVIDIA Cosmos3 checkpoints; the OpenMDW-1.1 License applies.