@@ -2191,11 +2191,6 @@ class DerivedValues(BaseModel):
21912191 description = "Boolean flag indicating if pipeline parallelism is active across ICI or DCN." ,
21922192 )
21932193
2194- context_parallel_size : None | int = Field (
2195- None ,
2196- description = "The total size of context parallelism, derived from ICI and DCN values." ,
2197- )
2198-
21992194 num_target_devices : None | int = Field (
22002195 None ,
22012196 description = "The number of devices computed from topology in train_compile or jax.devices() in train" ,
@@ -2789,9 +2784,6 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
27892784 self .tensors_on_device = [t for t in tensors if getattr (self , t ) == "device" ]
27902785 self .tensors_to_offload = [t for t in tensors if getattr (self , t ) == "offload" ]
27912786
2792- self .context_parallel_size = getattr (self , f"ici_{ self .context_sharding } _parallelism" , 1 ) * getattr (
2793- self , f"dcn_{ self .context_sharding } _parallelism" , 1
2794- )
27952787 if self .pipeline_parallel_layers == - 1 :
27962788 if self .decoder_block == DecoderBlockType .DEEPSEEK :
27972789 moe_layers = self .num_decoder_layers - self .first_num_dense_layers
@@ -3058,7 +3050,10 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
30583050 and (self .per_device_batch_size * self .max_target_length ) % self .num_vocab_tiling != 0
30593051 ):
30603052 raise ValueError ("Per device batch size times sequence length should be divisible by the number of vocab tiles." )
3061- if self .context_parallel_size > 1 and self .context_parallel_strategy .lower () == "ring" :
3053+ context_parallel_size = getattr (self , f"ici_{ self .context_sharding } _parallelism" , 1 ) * getattr (
3054+ self , f"dcn_{ self .context_sharding } _parallelism" , 1
3055+ )
3056+ if context_parallel_size > 1 and self .context_parallel_strategy .lower () == "ring" :
30623057 if "gpu" not in self .hardware :
30633058 raise ValueError (
30643059 "Ring context parallelism strategy (context_parallel_strategy='ring') is only supported on GPUs."
@@ -3068,7 +3063,7 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
30683063 # because test code paths may load the same config but use a different reorder path.
30693064 # Training's runtime path in max_utils.reorder_causal_load_balanced enforces this.
30703065 if (
3071- self . context_parallel_size > 1
3066+ context_parallel_size > 1
30723067 and "gpu" not in self .hardware
30733068 and self .context_parallel_load_balance
30743069 and self .context_parallel_reorder_strategy == ReorderStrategy .STRIPED
0 commit comments