@@ -2098,12 +2098,12 @@ def megatron_to_hf(
20982098
20992099 # Broadcast config to all PP ranks for collective communication
21002100 if megatron_module is None :
2101- config = self .broadcast_obj_from_pp_rank (None )
2101+ config = self .broadcast_obj_from_pp_rank (None , cache_key = "config" )
21022102 else :
21032103 config = self ._get_config (megatron_module )
21042104 # create shallow copy and remove non-picklable objects with max depth=3
21052105 config = remove_non_pickleables (config , max_depth = 3 )
2106- config = self .broadcast_obj_from_pp_rank (config )
2106+ config = self .broadcast_obj_from_pp_rank (config , cache_key = "config" )
21072107
21082108 d_inner_local = (config .mamba_num_heads * config .mamba_head_dim ) // self .tp_size
21092109 d_tot_ssm_local = (config .mamba_state_dim * config .mamba_num_groups ) // self .tp_size
@@ -2201,12 +2201,12 @@ def megatron_to_hf(
22012201
22022202 # Broadcast config to all PP ranks for collective communication
22032203 if megatron_module is None :
2204- config = self .broadcast_obj_from_pp_rank (None )
2204+ config = self .broadcast_obj_from_pp_rank (None , cache_key = "config" )
22052205 else :
22062206 config = self ._get_config (megatron_module )
22072207 # create shallow copy and remove non-picklable objects with max depth=3
22082208 config = remove_non_pickleables (config , max_depth = 3 )
2209- config = self .broadcast_obj_from_pp_rank (config )
2209+ config = self .broadcast_obj_from_pp_rank (config , cache_key = "config" )
22102210
22112211 shard_idx = self .get_shard_idx (config , local_tp = True )
22122212
@@ -2320,12 +2320,12 @@ def megatron_to_hf(
23202320 # collective communication.
23212321 # ------------------------------------------------------------------
23222322 if megatron_module is None :
2323- config = self .broadcast_obj_from_pp_rank (None )
2323+ config = self .broadcast_obj_from_pp_rank (None , cache_key = "config" )
23242324 else :
23252325 config = self ._get_config (megatron_module )
23262326 # create shallow copy and remove non-picklable objects with max depth=3
23272327 config = remove_non_pickleables (config , max_depth = 3 )
2328- config = self .broadcast_obj_from_pp_rank (config )
2328+ config = self .broadcast_obj_from_pp_rank (config , cache_key = "config" )
23292329
23302330 # Delegate TP/PP gathering.
23312331 packed_dict = self ._tp_mapping .megatron_to_hf (megatron_weights , megatron_module )
@@ -2420,11 +2420,11 @@ def megatron_to_hf(
24202420
24212421 # Broadcast config across PP ranks (mirrors GDNLinearMapping).
24222422 if megatron_module is None :
2423- config = self .broadcast_obj_from_pp_rank (None )
2423+ config = self .broadcast_obj_from_pp_rank (None , cache_key = "config" )
24242424 else :
24252425 config = self ._get_config (megatron_module )
24262426 config = remove_non_pickleables (config , max_depth = 3 )
2427- config = self .broadcast_obj_from_pp_rank (config )
2427+ config = self .broadcast_obj_from_pp_rank (config , cache_key = "config" )
24282428
24292429 packed_dict = self ._tp_mapping .megatron_to_hf (megatron_weights , megatron_module )
24302430 if not packed_dict :
0 commit comments