Skip to content

Support for INT8, MXFP8 and NVFP4 models - #613

Open
Joly0 wants to merge 3 commits into
numz:mainfrom
Joly0:feat/comfyorg-models-int8
Open

Support for INT8, MXFP8 and NVFP4 models#613
Joly0 wants to merge 3 commits into
numz:mainfrom
Joly0:feat/comfyorg-models-int8

Conversation

@Joly0

@Joly0 Joly0 commented Jul 25, 2026

Copy link
Copy Markdown

Also added the files from the official ComfyUI Huggingface page for the downloads https://huggingface.co/Comfy-Org/SeedVR2/tree/main/diffusion_models
grafik

Runs the int8_convrot version no problem:

 
 
   ███████╗███████╗███████╗██████╗ ██╗   ██╗██████╗     ██████╗       ███████╗
   ██╔════╝██╔════╝██╔════╝██╔══██╗██║   ██║██╔══██╗    ╚════██╗      ██╔════╝
   ███████╗█████╗  █████╗  ██║  ██║██║   ██║██████╔╝     █████╔╝      ███████╗
   ╚════██║██╔══╝  ██╔══╝  ██║  ██║╚██╗ ██╔╝██╔══██╗    ██╔═══╝       ╚════██║
   ███████║███████╗███████╗██████╔╝ ╚████╔╝ ██║  ██║    ███████╗  ██╗ ███████║
   ╚══════╝╚══════╝╚══════╝╚═════╝   ╚═══╝  ╚═╝  ╚═╝    ╚══════╝  ╚═╝ ╚══════╝
   v2.5.24                                    © ByteDance Seed · NumZ · AInVFX
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
[04:28:35.956] 💾 DiT model changed in cache (seedvr2_3b_nvfp4.safetensors → seedvr2_7b_sharp_int8_convrot.safetensors), removing stale cached model
[04:28:35.956] 💾 Removing cached DiT: 110:104
[04:28:35.959] 🏃 Creating new runner: DiT=seedvr2_7b_sharp_int8_convrot.safetensors, VAE=ema_vae_fp16.safetensors
[04:28:35.971] 🚀 Creating DiT model structure on meta device
[04:28:36.100] ♻️ Reusing cached VAE (110:105): ema_vae_fp16.safetensors
[04:28:36.319]  
[04:28:36.320] 🎬 Starting upscaling generation...
[04:28:36.320] 🎬   Input: 1 frame, 1448x1088px → Padded: 3328x2496px → Output: 3320x2496px (shortest edge: 2496px)
[04:28:36.320] 🎬   Batch size: 5, Seed: 777, Channels: RGB
[04:28:36.320]  
[04:28:36.320]  ━━━━━━━━ Phase 1: VAE encoding ━━━━━━━━
[04:28:36.320]  
[04:28:36.320] 💡 Tip: For 1 frames, batch_size=1 matches video length optimally
[04:28:36.320] 💡   Matching batch_size to shot length improves temporal coherence
[04:28:36.320]  
[04:28:36.373] 🎨 Encoding batch 1/1
[04:28:36.376] 📹   Sequence of 1 frames
[04:28:36.381] 🎨   Using VAE tiled encoding (Tile: (1024, 1024), Overlap: (128, 128))
[04:28:42.934]  
[04:28:42.934]  ━━━━━━━━ Phase 2: DiT upscaling ━━━━━━━━
[04:28:42.935] 🚀 Materializing DiT weights to CPU (offload device): /config/54-comfy-ui-test/ComfyUI/models/SEEDVR2/seedvr2_7b_sharp_int8_convrot.safetensors
[04:29:27.923] 🚀 Dequantized 288 comfy_kitchen quantized layer(s) to torch.float16
[04:29:27.998] 🔀 BlockSwap: 16/36 transformer blocks offloaded to CPU
[04:29:30.337] 💾 DiT model cached in memory (node 110:104): seedvr2_7b_sharp_int8_convrot.safetensors
[04:29:30.337] 💾 Runner template cached in memory: nodes 110:104+110:105
[04:29:30.338] 🎬 Upscaling batch 1/1
EulerSampler: 100%|██████████| 1/1 [00:22<00:00, 22.43s/it]
[04:30:09.442]  
[04:30:09.449]  ━━━━━━━━ Phase 3: VAE decoding ━━━━━━━━
[04:30:09.449] 🔧 Pre-allocating output tensor: 1 frames, 3320x2496px, RGB (0.05GB)
[04:30:13.457] 🎨 Decoding batch 1/1
[04:30:13.462] 🎨   Using VAE tiled decoding (Tile: (1024, 1024), Overlap: (128, 128))
[04:30:27.229]  
[04:30:27.229]  ━━━━━━━━ Phase 4: Post-processing ━━━━━━━━
[04:30:27.229] 📹 Post-processing batch 1/1
[04:30:27.424] 📹   Applying LAB perceptual color transfer
[04:30:27.614] 🎬 Output assembled: 1 frames, Resolution: 3320x2496px, Channels: RGB
[04:30:27.615]  
[04:30:27.624] ✅ Upscaling completed successfully!
[04:30:32.884] 💾 Models cached for next run: DiT (seedvr2_7b_sharp_int8_convrot.safetensors) and VAE (ema_vae_fp16.safetensors)
[04:30:32.890] ⚡ Average FPS: 0.01 frames/sec
[04:30:32.890]  
[04:30:32.891]  ────────────────────────
[04:30:32.891] 💬 Questions? Updates? Watch, star & sponsor if you can!
[04:30:32.891] 🎬 https://www.youtube.com/@AInVFX
[04:30:32.891] ⭐💝 https://github.com/numz/ComfyUI-SeedVR2_VideoUpscaler

Fixes #607

Joly0 and others added 3 commits July 25, 2026 01:43
Add the official Comfy-Org/SeedVR2 fp16 and fp8_e4m3fn checkpoints (3B, 7B,
7B-sharp) to the model registry so they appear in the DiT loader dropdown and
auto-download on first use. These carry the same 635 NaDiT tensors as the
existing numz weights (plus baked-in conditioning tensors, ignored by the
non-strict load_state_dict), so they are drop-in compatible.

Adds a ModelInfo.subfolder field and threads it into the HuggingFace download
URL, since Comfy-Org stores weights under diffusion_models/. The on-disk
filename stays flat; existing numz/AInVFX entries are unaffected.

Quantized formats (int8_convrot, mxfp8, nvfp4) are intentionally deferred to a
follow-up that adds comfy_kitchen dequantization support.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…on-load

The official Comfy-Org *_int8_convrot.safetensors models store each quantized
Linear as int8 weight + fp32 per-channel weight_scale + a comfy_quant JSON blob
({"format":"int8_tensorwise","convrot":true,"convrot_groupsize":256}).
Plain nn.Linear cannot consume these.

Add _dequantize_comfy_quant_state() in model_loader, invoked at the end of
load_quantized_state_dict. It reconstructs the ComfyUI QuantizedTensor exactly
as comfy.ops._load_quantized_module does (TensorWiseINT8Layout with convrot) and
dequantizes back to fp16, so the existing NaDiT model loads the weights
unchanged. This is universal — it works on the eager path and does not require
the cu130 INT8 tensor-core kernels — at the cost of true quantized-inference
VRAM/speed savings.

Registers the 3B/7B/7B-sharp int8_convrot models. Non-quantized fp16/fp8/GGUF
checkpoints pass through as a no-op. Packed nvfp4 and block-scaled mxfp8 raise a
clear NotImplementedError for now.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend _dequantize_comfy_quant_state to the remaining comfy_kitchen formats:
- mxfp8:  fp8_e4m3 weight + uint8 block scales (viewed as e8m0fnu), full shape.
- nvfp4:  uint8 weight packed 2x fp4/byte + fp8_e4m3 block scale + fp32
          tensor-wise scale; logical in-dim is weight.shape[1]*2.

Both are reconstructed as comfy QuantizedTensors (TensorCoreMXFP8Layout /
TensorCoreNVFP4Layout) exactly as comfy.ops._load_quantized_module and
dequantized to fp16 on load, verified against real layers. Registers the
3B/7B/7B-sharp mxfp8 and nvfp4 models, completing coverage of the Comfy-Org
diffusion_models repo.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@naxci1

naxci1 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Hi @Joly0

Thank you for your work. So, what was the speed difference in the videos? Did you test the difference between int8 and NVFP4, GGUF, and FP16? Was there a difference in output quality? The images show different results; the actual tests should be done on the videos to reveal the true results.

@Joly0

Joly0 commented Jul 25, 2026

Copy link
Copy Markdown
Author

Hey, so I did not test with Videos, just static images, but performance was pretty equal, I would say int8 was slightly faster than fp8.
Regarding the other two I can only say, that they worked, as my rtx 4060 ti lack the hardware to actually take advantage of those quants, but I still tested if they run, which they did.

Regarding quality I couldn't notice any drop in quality for int8 compared to fp8 or gguf, there may be a very very small drop compared to fp16, but that's to be expected. From my testing I would say that nvfp4 and mxfp8 are slightly worse then int8, maybe slightly below fp8, but no huge difference. But as I tested this with static images and not with Videos and with my limited hardware in mind, I would advice someone else should maybe test and confirm everything is fine regarding quality and performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

int8 quantization support

2 participants