File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -466,6 +466,9 @@ ici_autoregressive_parallelism: 1
466466ici_pipeline_parallelism : 1
467467ici_expert_parallelism : 1
468468
469+ # Enable ZeRO-1 optimizer sharding over data axis
470+ shard_optimizer_over_data : False
471+
469472# The number of TPU slices is automatically determined, you should not set this explicitly. For ahead of time compilation,
470473# you should set compile_toplogy_num_slices, which will in turn set this value. For non-TPU environments this is set to 1.
471474num_slices : -1
@@ -859,7 +862,6 @@ subslice_shape: ""
859862
860863# NNX
861864enable_nnx : false
862- shard_optimizer_over_data : False
863865
864866# ################################# Qwen3-Next Specific Configs ##################################
865867# Kernel size for the 1D convolution in the Gated Delta Net
Original file line number Diff line number Diff line change @@ -261,6 +261,9 @@ def validate_keys(keys):
261261 "For Qwen3-Next, sparse_matmul must be False for now. The dense path has been verified against reference."
262262 )
263263
264+ if keys ["shard_optimizer_over_data" ]:
265+ validate_optimizer_sharding_over_data (keys )
266+
264267
265268def validate_tokenizer (keys ):
266269 assert keys [
@@ -1119,6 +1122,15 @@ def validate_ragged_dot(raw_keys):
11191122 max_logging .log (f"JAX config { config_flag } not found, possibly due to old JAX version." )
11201123
11211124
1125+ def validate_optimizer_sharding_over_data (raw_keys ):
1126+ zero1_supported_opt_types = ("adamw" , "adam_pax" )
1127+ if raw_keys ["opt_type" ] not in zero1_supported_opt_types :
1128+ raise ValueError (
1129+ f"Optimizer type { raw_keys ["opt_type" ]} is not supported for optimizer sharding.\n "
1130+ f"Please use an optimizer from this list: { zero1_supported_opt_types } ."
1131+ )
1132+
1133+
11221134def create_new_logical_axis_rules (old_logical_axis_rules , new_logical_axis_rules ):
11231135 new_logical_axis = set ()
11241136 replacements = []
You can’t perform that action at this time.
0 commit comments