Comfy-Org / Comfy-Org/ComfyUI

MiniMax H3 nvfp4-awq text encoder fails to load: UnicodeDecodeError (utf-32-be) on empty comfy_quant tensors, then "Unknown quantization format"

Open
#15,400 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Describe the bug

The official MiniMax H3 text encoder from `Comfy-Org/MiniMax-H3` (`text_encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors`, 15.69 GB) cannot be loaded with `CLIPLoader(type="minimax")` in the native H3 workflow (as documented at https://docs.comfy.org/tutorials/video/minimax/minimax-h3). Two separate failures occur in sequence.

**Error 1 — UnicodeDecodeError on empty `comfy_quant` tensors:**

```
UnicodeDecodeError: 'utf-32-be' codec can't decode byte 0x00 in position 28: truncated data
```
Traceback: `comfy/sd.py` `load_text_encoder_state_dicts` → `comfy/ops.py` `_load_from_state_dict` → `json.loads(layer_conf.numpy().tobytes())`.

Some `comfy_quant` tensors in this file contain only NUL bytes (e.g. `model.embed_tokens.comfy_quant` is a `uint8` tensor of shape `[29]`, all zeros — an "unquantized" placeholder). Python's `json.loads` runs `detect_encoding()` on the bytes, sees the leading NULs and guesses utf-32-be, then crashes.

**Error 2 — "Unknown quantization format" (after working around #1):**

```
ValueError: Unknown quantization format for layer model.layers.0.self_attn.q_proj
```
at `comfy/ops.py:1166` (`if module.quant_format is None: raise ...`). After treating the empty payloads as `{}`, the layer config of the official nvfp4 file apparently uses a format name that is not mapped in `QUANT_ALGOS` on current master.

### Expected behavior

The officially published files for the native H3 tutorial should load out of the box on current master (they are the files linked from the official docs).

### Reproduction steps

1. Download `qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors` from `Comfy-Org/MiniMax-H3` into `ComfyUI/models/text_encoders/`.
2. Submit the native I2V workflow: `UNETLoader(minimax_h3_fl2va_pruned_int8_convrot.safetensors)` + `CLIPLoader(qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors, type="minimax")` + `MiniMaxH3ImageToVideo`.
3. Observe Error 1; apply the local workaround (`json.loads(x) if x.strip(b'\x00') else {}`), observe Error 2.

### Environment

- ComfyUI: master @ `344b4398` ("Support asym w4a8_int (#15308)")
- Python 3.12, CUDA 12.9, RTX 3090
- Models: `Comfy-Org/MiniMax-H3` (public), official pruned INT8 FL2VA diffusion model + nvfp4-AWQ text encoder

Contributor guide

Open the contributing guide

Research direction

Start in comfy/sd.py at load_text_encoder_state_dicts and trace the loading path into comfy/ops.py, especially _load_from_state_dict and the QUANT_ALGOS lookup around the reported line. Reproduce with the linked MiniMax-H3 safetensors file and native workflow; done means the empty comfy_quant tensors and the nvfp4-AWQ layer format load without either reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.