@@ -2293,11 +2293,6 @@ class DerivedValues(BaseModel):
22932293 description = "Boolean flag indicating if pipeline parallelism is active across ICI or DCN." ,
22942294 )
22952295
2296- context_parallel_size : None | int = Field (
2297- None ,
2298- description = "The total size of context parallelism, derived from ICI and DCN values." ,
2299- )
2300-
23012296 num_target_devices : None | int = Field (
23022297 None ,
23032298 description = "The number of devices computed from topology in train_compile or jax.devices() in train" ,
@@ -2891,9 +2886,6 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
28912886 self .tensors_on_device = [t for t in tensors if getattr (self , t ) == "device" ]
28922887 self .tensors_to_offload = [t for t in tensors if getattr (self , t ) == "offload" ]
28932888
2894- self .context_parallel_size = getattr (self , f"ici_{ self .context_sharding } _parallelism" , 1 ) * getattr (
2895- self , f"dcn_{ self .context_sharding } _parallelism" , 1
2896- )
28972889 if self .pipeline_parallel_layers == - 1 :
28982890 if self .decoder_block == DecoderBlockType .DEEPSEEK :
28992891 moe_layers = self .num_decoder_layers - self .first_num_dense_layers
@@ -3199,7 +3191,10 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
31993191 and (self .per_device_batch_size * self .max_target_length ) % self .num_vocab_tiling != 0
32003192 ):
32013193 raise ValueError ("Per device batch size times sequence length should be divisible by the number of vocab tiles." )
3202- if self .context_parallel_size > 1 and self .context_parallel_strategy .lower () == "ring" :
3194+ context_parallel_size = getattr (self , f"ici_{ self .context_sharding } _parallelism" , 1 ) * getattr (
3195+ self , f"dcn_{ self .context_sharding } _parallelism" , 1
3196+ )
3197+ if context_parallel_size > 1 and self .context_parallel_strategy .lower () == "ring" :
32033198 if "gpu" not in self .hardware :
32043199 raise ValueError (
32053200 "Ring context parallelism strategy (context_parallel_strategy='ring') is only supported on GPUs."
@@ -3209,7 +3204,7 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
32093204 # because test code paths may load the same config but use a different reorder path.
32103205 # Training's runtime path in max_utils.reorder_causal_load_balanced enforces this.
32113206 if (
3212- self . context_parallel_size > 1
3207+ context_parallel_size > 1
32133208 and "gpu" not in self .hardware
32143209 and self .context_parallel_load_balance
32153210 and self .context_parallel_reorder_strategy == ReorderStrategy .STRIPED
0 commit comments