Repository navigation
Support Qwen3.8 compressed NVFP4 checkpoints - #654
Merged
Merged
Conversation
Copilot stopped reviewing on behalf of
justinchuby due to an error
August 26, 2026 15:48
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for loading compressed-tensors (mixed FP8/NVFP4) checkpoints via streaming/lazy reconstruction and routes Transformers builds to use it, including guards for FP8 KV-cache scale requirements.
Changes:
- Add a new
mobius.integrations.compressed_tensorsloader that streams/dequantizes supportedcompressed-tensorscheckpoints into ONNX initializers viair.LazyTensor. - Update Transformers builder to detect
compressed-tensorsconfigs, validate FP8 KV-cache scale maps, and avoid eager weight downloads. - Add extensive tests for the new loader and routing behavior, and attach a
quantization_reporttoModelPackage.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mobius/integrations/transformers/_builder.py | Detects compressed-tensors configs, validates KV-cache scales, and streams weights into packages. |
| src/mobius/integrations/transformers/_builder_test.py | Adds tests ensuring streaming loader is used and KV-cache scale validation triggers. |
| src/mobius/integrations/compressed_tensors/_loader.py | Implements streamed lazy reconstruction/dequantization and fail-closed validation for compressed-tensors 0.17.2. |
| src/mobius/integrations/compressed_tensors/_loader_test.py | Adds reconstruction, config-resolution, and end-to-end build/load tests for compressed-tensors. |
| src/mobius/integrations/compressed_tensors/init.py | Exposes compressed-tensors public API. |
| src/mobius/_model_package.py | Adds quantization_report field to carry loader reports. |
| src/mobius/_configs/_quantization.py | Rejects compressed-tensors in coarse quantization parsing (fail-closed). |
| src/mobius/_configs/_base.py | Updates Kimi-K3 detection/rejection path for compressed-tensors configs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Performance Comparison
|
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
Parse compressed-tensors 0.17.2 mixed FP8/NVFP4 metadata before graph construction so packed E2M1 weights cannot fall into MatMulNBits. Reconstruct supported weights lazily into dense float tensors with strict target, layout, dtype, shape, and KV-cache scale validation while reporting the loss of native quantization semantics. Add pinned checkpoint header evidence, reduced ORT parity, and Qwen3.5 VLM streaming load coverage. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Make target replacement and version handling match compressed-tensors exactly, reject unsupported output quantization, report only emitted FP8 KV-cache support, and preserve lazy post-weight transpose/concat folding. Pin the official Qwen3.8 base config alongside the quantized derivative evidence. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Preserve declared target precedence, batch safetensors reads per logical tensor, normalize compressed-tensors config representations, and document the transient quantization report contract. Add focused regressions for each behavior. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Emit Microsoft's native W4A16/W8A16 block-weight operators from compressed-tensors checkpoints, register an inlineable standard-ONNX NVFP4 fallback, and retain exact packed codes and scales through serialization. Keep dense reconstruction behind the explicit dequantize policy and persist the source quantization recipe and runtime caveats. Co-authored-by: Copilot App <[email protected]> Copilot-Session: acdf6027-4e8f-40aa-8600-abc9ee8591a4 Signed-off-by: Justin Chu <[email protected]>
Route local compressed-tensors directories through the faithful streaming loader for both native and explicit dense policies. Reject E5M2 and FNUZ FP8 payloads from the E4M3FN-only native operator while retaining exact dense E5M2 reconstruction. Co-authored-by: Copilot App <[email protected]> Copilot-Session: acdf6027-4e8f-40aa-8600-abc9ee8591a4 Signed-off-by: Justin Chu <[email protected]>
Resolve guaranteed compressed-tensors dtypes without touching FNUZ attributes that are absent from minimum-supported PyTorch versions. Register optional FNUZ dtypes only when available and preserve explicit fail-closed errors otherwise. Co-authored-by: Copilot App <[email protected]> Copilot-Session: acdf6027-4e8f-40aa-8600-abc9ee8591a4 Signed-off-by: Justin Chu <[email protected]>
Require the PyTorch release baseline selected for compressed FP8/FNUZ support, remove the obsolete legacy-attribute compatibility shim, and update the recorded dependency lower bound. Co-authored-by: Copilot App <[email protected]> Copilot-Session: acdf6027-4e8f-40aa-8600-abc9ee8591a4 Signed-off-by: Justin Chu <[email protected]>
justinchuby
force-pushed
the
justinchuby-support-qwen3-8-nvfp4
branch
from
August 27, 2026 05:13
06b10cc to
a3df09b
Compare
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.
Summary
Capability
q * channel_scale; NVFP4 weights reconstruct asE2M1(code) * E4M3(block_scale) / stored_global_scale, emitted as dense floating-point weights. The package report and warning explicitly state that output is no longer NVFP4 and dynamic activation quantization is not represented.k_scale/v_scalesupplied.Immutable evidence
Qwen/Qwen3.8-27B@1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0unsloth/Qwen3.8-27B-NVFP4@9e3d73c76eddb75f795cc24ccfbc5affe41c66bdValidation
8371 passed, 57 skipped, 12 deselectedin the broad serial suitelintrunner f --output oneline --all-filesandlintrunner -apassWaivers