Repository navigation
Studio: load plain FP8 encoder safetensors without torchao - #12333
Merged
danielhanchen merged 2 commits intoSep 30, 2026
Merged
Conversation
Member
Author
|
Reached Codex review convergence at oobabooga#319. |
Member
|
Review record for #12333, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#256. 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
|
This was referenced Sep 30, 2026
Closed
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows ROCm, Studio rejects the Qwen-Image-2.1 FP8 text-encoder safetensors because the generic prequant capability check requires torchao serialization helpers. It then tries an unavailable .pt artifact and falls back to loading the dense encoder and casting it to FP8. The supplied encoder contains ordinary tensors and does not need torchao.
Fix
Read plain encoder safetensors directly through safetensors.safe_open, and use that capability when resolving the artifact. Validate the header, tensor names and plain-tensor metadata before reading weights; keep the existing component, scheme, base-model and state-dict checks. The transformer tensor-subclass reader is unchanged.
Tests
Live A/B against main at 4700dbc, using Qwen-Image-2.1 Q4_K_M, Auto memory, 1024x1024, four steps and three renders per variant on Radeon 8060S (gfx1151), Windows and Linux. PyTorch 2.11 / ROCm 7.13; the planner sees 20 GiB total and 19 GiB free, with a 19 GiB PyTorch allocation cap.
All six paired images are pixel-identical. Warm generation time is effectively unchanged. Load timing is not comparable because the patched Windows case downloads the newly accessible encoder artifact.
98 focused tests pass, including a real-writer FP8/bias/root-buffer round trip through both readers with torchao disabled for the plain reader. Earlier broader related coverage: 731 pass, one fails on an absent local ./temp/qwen_image_21 fixture; the same test fails with the production files restored to main. Formatting and diff checks pass.
Live A/B run, both OS jobs passed
Scope
This fixes unnecessary dense-encoder loading, not the Auto placement policy or AMD attention performance. The hardware probes in the run artifacts report shared-memory GPUs and 124.95 GiB of host RAM on Linux / 127.15 GiB on Windows; RX 7900 XT behavior and discrete-GPU transfer costs remain untested. Other callers of the shared encoder loader have unit coverage but were not exercised live.