[Fix] Support fp32 param preservation during FSDP save and load#1626
Closed
HAOCHENYE wants to merge 1 commit intogh/HAOCHENYE/19/basefrom
Closed
[Fix] Support fp32 param preservation during FSDP save and load#1626HAOCHENYE wants to merge 1 commit intogh/HAOCHENYE/19/basefrom
HAOCHENYE wants to merge 1 commit intogh/HAOCHENYE/19/basefrom
Conversation
This was referenced Mar 24, 2026
Open
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.
Stack from ghstack (oldest at bottom):
fp32_keys_patterntoHFSaveCfgto specify params that shouldbe saved in fp32 regardless of the global save dtype
_fully_shard()toBaseModelwhich wrapsfully_shard()anddistributes matched params as Replicate DTensors so FSDP ignores them
fully_shard()call sites withself._fully_shard()_get_save_dtype()to select fp32 per-param at save time_load_same_hf_paramto skip shard-offset logic forReplicate DTensors (only apply for Shard-placed params)
world_meshproperty setter bug: use_world_meshdirectlyinstead of assigning through the read-only property
MoE.scale_and_reduce_gradto correctlyidentify the Replicate mesh dimension via DTensor placements
requires_gradwhen distributing params in EP and fp32 pathsQwen3_5_VLTextMoEConfigwith fp32 patterns forlinear_attn.norm.weightandlinear_attn.A_logtest_save_hf_with_mtpto verify round-trip weight preservation