Repository navigation
Studio: keep Qwen-Image-2.1 image conditioning finite on ROCm - #12360
Conversation
|
Reached Codex review convergence at oobabooga#320. |
|
Review record for #12360, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#267. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
|
Tested on a discrete RDNA4 card with
Both images are normal (max pixel difference 14/255, mean 0.37). The eager path is harmless on this card but fixes nothing here. Only the 1024 reference size was run; 2048 references and multiple references weren't. Setup: Radeon AI PRO R9700 (gfx1201), Windows 11, PyTorch 2.11 / ROCm 7.13, main at Recommend keeping it gfx1151-only. A gfx1100 (RX 7900-class) run is still the open question. |
Qwen-Image-2.1 reference-image generation produces NaN conditioning and blank images on Radeon 8060S with native vision SDPA, on both Windows and Linux.
Fix
Use eager attention in 512-query-row chunks for the encoder's Qwen3-VL vision tower, retaining all keys and values. This avoids native SDPA's NaNs without the memory cost of unbounded eager attention. The language model, denoiser and global SDPA settings stay unchanged, and the fix applies with Speed Off too.
Default to ROCm gfx1151 only.
UNSLOTH_QWEN_IMAGE_ROCM_VISION_EAGER=0opts out;=1enables testing on other ROCm GPUs. Preserve explicitly selected non-SDPA backends and report installation failures instead of silently skipping the fix.Tests
Windows/Linux A/B on Radeon 8060S, PyTorch 2.11 / ROCm 7.13:
148 focused and related tests pass after rebasing onto
b1c522a4ea; Ruff and formatting checks pass. Hardware A/B used4e8503e437and was not repeated after the rebase and override/error-handling changes. The attention calculation is unchanged.RX 7900 XT and other ROCm architectures remain untested.