do not overwrite storage dtypes - #1716
Merged
jlarson4 merged 3 commits intoAug 22, 2026
Merged
Conversation
jlarson4
reviewed
Aug 21, 2026
jlarson4
left a comment
Collaborator
There was a problem hiding this comment.
Hey @MdSadiqMd, thanks for the fix! A couple notes on the test coverage
Collaborator
|
@MdSadiqMd I missed this the first time around, could you please rebase this to |
Contributor
Author
|
sure |
MdSadiqMd
force-pushed
the
sadiq/do-not-overwrite-storage-dtypes
branch
from
August 21, 2026 22:10
0319690 to
9fc6507
Compare
Collaborator
|
Hi @MdSadiqMd, just pushed a CI update to your branch that should help stabilize Full Code Coverage, there was a flaw in dev that was causing failures. Everything looks good, once this run passes I'll merge, thanks for your patience! |
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.
Description
When
TransformerBridge.boot_transformersloads a quantized HuggingFace model, its post-load dtype normalization viacast_floating_params_to_dtypecasts every floating-point parameter to the requested dtype. This includes floating-point parameters owned by the quantizer, such as FP8 scale tensors (e.g.,float8_e8m0fnu).On MXFP4 checkpoints like
deepseek-ai/DeepSeek-V4-Flash-0731, loading withdtype=torch.bfloat16changes the expert scales fromtorch.float8_e8m0fnutotorch.bfloat16. The packed int8 expert weights are left unchanged, so the weight/scale pair no longer describes the same quantization format, causing forward pass failures.Fix implemented at two levels:
cast_floating_params_to_dtypeentirely when the model has an activequantization_configcast_floating_params_to_dtypeas a defensive guardFixes #1713
Type of change
Checklist: