@@ -2094,12 +2094,12 @@ def megatron_to_hf(
20942094
20952095 # Broadcast config to all PP ranks for collective communication
20962096 if megatron_module is None :
2097- config = self .broadcast_obj_from_pp_rank (None )
2097+ config = self .broadcast_obj_from_pp_rank (None , cache_key = "config" )
20982098 else :
20992099 config = self ._get_config (megatron_module )
21002100 # create shallow copy and remove non-picklable objects with max depth=3
21012101 config = remove_non_pickleables (config , max_depth = 3 )
2102- config = self .broadcast_obj_from_pp_rank (config )
2102+ config = self .broadcast_obj_from_pp_rank (config , cache_key = "config" )
21032103
21042104 d_inner_local = (config .mamba_num_heads * config .mamba_head_dim ) // self .tp_size
21052105 d_tot_ssm_local = (config .mamba_state_dim * config .mamba_num_groups ) // self .tp_size
@@ -2197,12 +2197,12 @@ def megatron_to_hf(
21972197
21982198 # Broadcast config to all PP ranks for collective communication
21992199 if megatron_module is None :
2200- config = self .broadcast_obj_from_pp_rank (None )
2200+ config = self .broadcast_obj_from_pp_rank (None , cache_key = "config" )
22012201 else :
22022202 config = self ._get_config (megatron_module )
22032203 # create shallow copy and remove non-picklable objects with max depth=3
22042204 config = remove_non_pickleables (config , max_depth = 3 )
2205- config = self .broadcast_obj_from_pp_rank (config )
2205+ config = self .broadcast_obj_from_pp_rank (config , cache_key = "config" )
22062206
22072207 shard_idx = self .get_shard_idx (config , local_tp = True )
22082208
@@ -2316,12 +2316,12 @@ def megatron_to_hf(
23162316 # collective communication.
23172317 # ------------------------------------------------------------------
23182318 if megatron_module is None :
2319- config = self .broadcast_obj_from_pp_rank (None )
2319+ config = self .broadcast_obj_from_pp_rank (None , cache_key = "config" )
23202320 else :
23212321 config = self ._get_config (megatron_module )
23222322 # create shallow copy and remove non-picklable objects with max depth=3
23232323 config = remove_non_pickleables (config , max_depth = 3 )
2324- config = self .broadcast_obj_from_pp_rank (config )
2324+ config = self .broadcast_obj_from_pp_rank (config , cache_key = "config" )
23252325
23262326 # Delegate TP/PP gathering.
23272327 packed_dict = self ._tp_mapping .megatron_to_hf (megatron_weights , megatron_module )
@@ -2416,11 +2416,11 @@ def megatron_to_hf(
24162416
24172417 # Broadcast config across PP ranks (mirrors GDNLinearMapping).
24182418 if megatron_module is None :
2419- config = self .broadcast_obj_from_pp_rank (None )
2419+ config = self .broadcast_obj_from_pp_rank (None , cache_key = "config" )
24202420 else :
24212421 config = self ._get_config (megatron_module )
24222422 config = remove_non_pickleables (config , max_depth = 3 )
2423- config = self .broadcast_obj_from_pp_rank (config )
2423+ config = self .broadcast_obj_from_pp_rank (config , cache_key = "config" )
24242424
24252425 packed_dict = self ._tp_mapping .megatron_to_hf (megatron_weights , megatron_module )
24262426 if not packed_dict :
0 commit comments