MAGI-2-preview, expert weights in NVFP4

The preview transformer of sand-ai/MAGI-2-preview (revision 2dea51b64db47ee5b4402d36fd90829a0c58913b) with its mixture-of-experts weights quantised to NVFP4. Everything else in the transformer is copied unchanged in bf16.

This is a storage format, not a 4-bit runtime: the loader it was made for dequantises each layer's experts to bf16 in front of the original bf16 expert kernel.

Two forms of the same model

Folder For Size
comfyui/ ComfyUI, on one 96 GB GPU see below
preview/ the MAGI-2 inference code (39 shards) and adapter training 71.8 GB

Both hold the same weights and the same NVFP4 codes; only the file layout differs.

ComfyUI

Needs the node pack comfyui-magi2-native, which adds the MAGI-2 model type to ComfyUI. The files then load with the stock Load Diffusion Model and Load VAE nodes.

File ComfyUI folder Size What it is
comfyui/diffusion_models/magi2_preview_nvfp4_comfy.safetensors models/diffusion_models 71.8 GB the preview transformer as one file, experts in NVFP4
comfyui/diffusion_models/magi2_refiner.safetensors models/diffusion_models 13.5 GB the 1080p refiner, the original bf16 weights merged into one file; only needed for 1080p
comfyui/vae/Wan2.2_VAE.pth models/vae 2.8 GB the Wan2.2 video VAE, unchanged from the original release

Still taken from the original repository: text_encoder/ (Qwen3.5, 52 GB) and stable-audio-open-1.0/ (audio VAE). The pack's nodes read them from the directory named by MAGI2_CKPT_ROOT.

Requirements: one GPU with 96 GB (tested on an RTX PRO 6000 Blackwell) and about 64 GB of free host RAM. Both models have to be entirely on the GPU; there is no partial offload.

Measured through ComfyUI's /prompt API on one card that also drives a desktop:

Run Time Peak on the card
540p, 100 steps 32 min 47 s 90.2 GiB
1080p, 3 preview + 5 refiner steps 18 min 31 s 87.9 GiB

Text-to-video, image-to-video, separate video and audio guidance, and the stock LoRA loader (non-expert weights only) are covered by the pack's workflows; see its README.

Contents of preview/

preview/: 39 safetensors shards, 71.83 GB, 1,695 tensors, plus model.safetensors.index.json and nvfp4_manifest.json (source hash, quantiser settings, per-tensor error, key mapping).

Original This repository
Expert tensors (W_gate, W_up, W_down, 36 layers, 3,072 experts each) bf16, 217.4 GB NVFP4, 61.2 GB
All other tensors (1,263) bf16 byte-identical copies
Total 228.1 GB 71.8 GB

Not in preview/: the text encoder, the VAEs, the audio VAE and the 1080p refiner. The refiner and the Wan2.2 VAE are under comfyui/; take the rest from the original repository.

Quantisation

  • E2M1 4-bit codes, one FP8 E4M3 scale per block of 16 weights along the input dimension, one fp32 scale per expert (4.5 bits per weight).
  • Block scales chosen per block to minimise squared error (searched within 6 E4M3 codes of the max-abs scale); round to nearest, no calibration data.
  • Layout: each expert tensor is stored as a ComfyUI / comfy-kitchen NVFP4 MoEExperts bank: <key>.weight uint8 [E, out, in/2] (high nibble first), <key>.weight_scale E4M3 in comfy-kitchen's tiled order, <key>.weight_scale_2 fp32 [E], <key>.comfy_quant. Note the transposition: the original tensors are [E, in, out]. This describes the preview/ shards. The single ComfyUI file stores the same codes under the model's own state-dict keys (W_*, W_*_bscale, W_*_scale), in the layout the expert kernel reads directly.

Measured error (against the bf16 weights)

FP8 with per-channel scale This file
Relative weight error, all 108 expert tensors 2.62 % 8.13 to 8.39 %
MoE layer output error on real activations (7 layers) 2.3 to 3.6 % 6.2 to 10.9 %

Visual and audio quality: compared by eye and ear against the FP8 experts on the same prompts and seeds at 540p, the uploader found very little difference. No formal quality metric has been run.

Measured on 2x RTX PRO 6000 Blackwell (96 GB, sm_120), 540p, 100 steps

FP8 experts This file
Weight load 60.5 s 9.5 s
Peak memory per GPU 83.3 / 86.4 GiB 60.6 / 64.2 GiB
Time per denoising step 12.6 s 11.7 s

Loading preview/ outside ComfyUI

The shards were written by, and tested with, a fork of Abbara/MAGI-2-preview-2gpu (scripts/quantize_nvfp4.py, loader behind MAGI2_MOE_QUANT=nvfp4). The inference code of that fork, the quantiser and the converter are published inside the node pack (vendor/magi2/, tools/). nvfp4_manifest.json documents the key mapping and the exact quantiser.

Licence

Apache-2.0, as the original weights. This is a quantised derivative of Sand AI's release. The refiner and the Wan2.2 VAE are redistributed unchanged in content.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for colinb83/MAGI-2-preview-NVFP4

Quantized
(1)
this model