Comfy-Org / Comfy-Org/ComfyUI

qwen_image_2512_fp8_e4m3fn outputs noise since d4c7ebff (ck.apply_rope regression)

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

Description

## Bug Report: Qwen Image 2512 fp8_e4m3fn generates noise after commit d4c7ebff

### Summary

Since commit `d4c7ebff` ("Remove old useless no comfy kitchen fallback"), `qwen_image_2512_fp8_e4m3fn.safetensors` outputs noise instead of images. No errors in the log.
Image

### Environment

- **GPU**: NVIDIA GeForce RTX 5080 (Blackwell, 16GB VRAM)
- **CUDA**: 13.0
- **PyTorch**: 2.11.0+cu130
- **Python**: 3.14.4
- **OS**: Ubuntu 24.04 LTS (kernel 7.0.0-22-generic)
- **ComfyUI**: latest (HEAD at 2cdaaf4a)

### Affected model

- `qwen_image_2512_fp8_e4m3fn.safetensors` (Comfy-Org/Qwen-Image_ComfyUI)

### Not affected

- `qwen_image_edit_2511_fp8mixed.safetensors` works fine
- Standard SD models work fine

### Steps to reproduce

1. Use the official Qwen-Image-2512 workflow template
2. Generate with `qwen_image_2512_fp8_e4m3fn.safetensors`
3. Output is noise

### Root cause

`d4c7ebff` replaced the `try/except` fallback in `comfy/ldm/flux/math.py` with a direct call to `comfy.quant_ops.ck.apply_rope`. Looks like `ck.apply_rope` doesn't handle `fp8_e4m3fn` (unscaled) models correctly — the old `_apply_rope` fallback worked fine.

### Workaround

Restoring the `try/except` block in `comfy/ldm/flux/math.py` fixes it:

```python
try:
q_apply_rope = comfy.quant_ops.ck.apply_rope
q_apply_rope1 = comfy.quant_ops.ck.apply_rope1
def apply_rope(xq, xk, freqs_cis):
if comfy.model_management.in_training:
return _apply_rope(xq, xk, freqs_cis)
else:
return apply_rope1(xq, freqs_cis), apply_rope1(xk, freqs_cis)
def apply_rope1(x, freqs_cis):
if comfy.model_management.in_training:
return _apply_rope1(x, freqs_cis)
else:
return q_apply_rope1(x, freqs_cis)
except:
apply_rope = _apply_rope
apply_rope1 = _apply_rope1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.