@@ -518,7 +518,10 @@ class ModelArchitecture(BaseModel):
518518 True ,
519519 description = "Whether to apply scale on query and key normalizations (default True)." ,
520520 )
521- v_norm_with_scale : bool = Field (True , description = "Whether to apply scale on value normalization (default True)." )
521+ v_norm_with_scale : bool = Field (
522+ True ,
523+ description = "Whether to apply scale on value normalization (default True)." ,
524+ )
522525
523526
524527class MTP (BaseModel ):
@@ -624,7 +627,7 @@ class Attention(BaseModel):
624627 ),
625628 )
626629 ragged_block_size : int = Field (256 , description = "Block size for ragged attention." )
627- enable_padding_causal_mask : bool = Field (True , description = "Temporary flag for TE padding." )
630+ enable_padding_causal_mask : bool = Field (True , description = "Temporary flag for Transformer Engine padding." )
628631 use_tokamax_splash : bool = Field (False , description = "Whether to use tokamax splash attention." )
629632 use_jax_splash : bool = Field (False , description = "Whether to use jax splash attention." )
630633 force_q_layout : bool = Field (False , description = "Force the Q layout" )
@@ -656,7 +659,10 @@ class CompressedAttention(BaseModel):
656659
657660 o_lora_rank : NonNegativeInt = Field (0 , description = "Output LoRA rank for Compressed Attention." )
658661 o_groups : NonNegativeInt = Field (0 , description = "Output groups for Compressed Attention." )
659- compress_ratios : list [int ] = Field (default_factory = list , description = "Per-layer compression ratios (0, 4, 128, etc)." )
662+ compress_ratios : list [int ] = Field (
663+ default_factory = list ,
664+ description = "Per-layer compression ratios (0, 4, 128, etc)." ,
665+ )
660666 compressed_rope_max_timescale : int = Field (
661667 160000 , description = "If positive, used for Compressed Sparse/Heavy Attention."
662668 )
@@ -757,14 +763,18 @@ class MoEGeneral(BaseModel):
757763 num_experts : PositiveInt = Field (1 , description = "The total number of experts in each MoE layer." )
758764 num_experts_per_tok : PositiveInt = Field (1 , description = "The number of experts to route each token to." )
759765 capacity_factor : float = Field (- 1.0 , description = "Expert capacity factor. If < 0, no token dropping." )
760- ragged_buffer_factor : float = Field (- 1.0 , description = "Ragged buffer factor. If < 0, ragged buffer is worst case size." )
766+ ragged_buffer_factor : float = Field (
767+ - 1.0 ,
768+ description = "Ragged buffer factor. If < 0, ragged buffer is worst case size." ,
769+ )
761770 moe_expert_input_dim : int = Field (
762771 - 1 ,
763772 description = "Dimension of tokens entering the MoE layer. If < 0, defaults to emb_dim." ,
764773 )
765774 base_moe_mlp_dim : int = Field (- 1 , description = "Intermediate dimension at MoE layer." )
766775 padded_base_moe_mlp_dim : Optional [int ] = Field (
767- None , description = "Padded intermediate dimension at MoE layer for efficient GMM_v2 kernel execution."
776+ None ,
777+ description = "Padded intermediate dimension at MoE layer for efficient GMM_v2 kernel execution." ,
768778 )
769779 load_balance_loss_weight : NonNegativeFloat = Field (0.0 , description = "Weight for the load balancing auxiliary loss." )
770780 use_custom_sort_vjp : bool = Field (
@@ -783,7 +793,8 @@ class MoEGeneral(BaseModel):
783793 ),
784794 )
785795 use_ragged_sort : bool = Field (
786- False , description = "Whether to use ragged kernel for sorting, improve performance when EP is enabled."
796+ False ,
797+ description = "Whether to use ragged kernel for sorting, improve performance when EP is enabled." ,
787798 )
788799 use_gather_mosaic_kernel : bool = Field (
789800 False ,
@@ -919,7 +930,8 @@ class DeepSeekMoE(BaseModel):
919930 )
920931 n_routing_groups : int = Field (- 1 , description = "Number of groups for routing, disabled by default." )
921932 first_num_hash_layers : int = Field (
922- 0 , description = "Number of hash routing layers, used in DeepSeek V4 (0 means disabled)."
933+ 0 ,
934+ description = "Number of hash routing layers, used in DeepSeek V4 (0 means disabled)." ,
923935 )
924936 topk_routing_group : int = Field (- 1 , description = "Number of top groups to route inputs to." )
925937 use_batch_split_schedule : bool = Field (
@@ -993,7 +1005,8 @@ class HardwareAndMesh(BaseModel):
9931005 )
9941006 custom_mesh : str = Field ("" , description = "Available options: ['hybrid_ring_64x4', 'hybrid_ring_32x8']" )
9951007 custom_mesh_and_rule : CustomRule = Field (
996- CustomRule .DEFAULT , description = "Customized mesh and logical rules for granularity."
1008+ CustomRule .DEFAULT ,
1009+ description = "Customized mesh and logical rules for granularity." ,
9971010 )
9981011 allow_split_physical_axes : bool = Field (False , description = "Allow splitting physical axes for device mesh creation." )
9991012 enable_nnx : bool = Field (True , description = "Whether to use NNX for model definition." )
@@ -1002,7 +1015,8 @@ class HardwareAndMesh(BaseModel):
10021015 pure_nnx_decoder : bool = Field (True , description = "Whether to enable pure NNX decoder." )
10031016 pure_nnx : bool = Field (True , description = "Whether to enable pure NNX mode." )
10041017 remove_size_one_mesh_axis_from_type : bool = Field (
1005- True , description = "Whether to remove size one mesh axis from type through jax.config."
1018+ True ,
1019+ description = "Whether to remove size one mesh axis from type through jax.config." ,
10061020 )
10071021
10081022
@@ -1028,7 +1042,10 @@ class LayoutAndSharding(BaseModel):
10281042 "with auto sharding, megablox kernel, and EP / FSDP parallelisms." ,
10291043 )
10301044 shard_optimizer_over_data : bool = Field (False , description = "Enable ZeRO-1 optimizer sharding over the data axis." )
1031- internal_compile : bool = Field (False , description = "Use internal_compile to bypass open-source topology mappings." )
1045+ internal_compile : bool = Field (
1046+ False ,
1047+ description = "Use internal_compile to bypass open-source topology mappings." ,
1048+ )
10321049 internal_compile_num_devices : int = Field (- 1 , description = "Number of devices when using internal_compile." )
10331050 compile_xla_flags : str = Field ("" , description = "Compiler options for compilation only." )
10341051
@@ -1073,7 +1090,8 @@ class PipelineParallelism(BaseModel):
10731090 """Configuration for pipeline parallelism."""
10741091
10751092 pipeline_fsdp_ag_per_repeat : bool = Field (
1076- False , description = "Enable weight prefetching for circular pipeline parallelism."
1093+ False ,
1094+ description = "Enable weight prefetching for circular pipeline parallelism." ,
10771095 )
10781096 num_layers_per_pipeline_stage : int = Field (1 , description = "Number of layers to place on each pipeline stage." )
10791097 num_pipeline_repeats : int = Field (
@@ -1139,6 +1157,7 @@ class RematAndOffload(BaseModel):
11391157 query_proj : RematLocation = Field (RematLocation .REMAT , description = "Remat policy for the query projection." )
11401158 key_proj : RematLocation = Field (RematLocation .REMAT , description = "Remat policy for the key projection." )
11411159 value_proj : RematLocation = Field (RematLocation .REMAT , description = "Remat policy for the value projection." )
1160+ kv_proj : RematLocation = Field (RematLocation .REMAT , description = "Remat policy for the unified KV projection." )
11421161 query_wa_proj : RematLocation = Field (
11431162 RematLocation .REMAT ,
11441163 description = "Remat policy for the MLA query weighted attention projection." ,
@@ -1321,7 +1340,10 @@ class OlmoGrainDataset(BaseModel):
13211340 ``data_shuffle_seed``); only OLMo-specific fields are listed here.
13221341 """
13231342
1324- olmo_index_path : PathStr = Field ("" , description = "Path or gs:// URI to the JSON index from build_olmo_npy_index.py." )
1343+ olmo_index_path : PathStr = Field (
1344+ "" ,
1345+ description = "Path or gs:// URI to the JSON index from build_olmo_npy_index.py." ,
1346+ )
13251347 olmo_path_remap_from : PathStr = Field (
13261348 "" ,
13271349 description = "If set, rewrite index file paths starting with this prefix to olmo_path_remap_to." ,
@@ -1428,19 +1450,24 @@ class Distillation(BaseModel):
14281450 distill_layer_indices : None | list = Field (None , description = "Feature indices for feature loss." )
14291451 distill_alpha_end : Optional [float ] = Field (None , description = "Target alpha at end of training. None keeps alpha fixed." )
14301452 distill_alpha_schedule : Literal ["constant" , "linear" , "cosine" ] = Field (
1431- "constant" , description = "Schedule type for alpha annealing ('constant', 'linear', or 'cosine')."
1453+ "constant" ,
1454+ description = "Schedule type for alpha annealing ('constant', 'linear', or 'cosine')." ,
14321455 )
14331456 distill_temperature_end : Optional [float ] = Field (
1434- None , description = "Target temperature at end of training. None keeps temperature fixed."
1457+ None ,
1458+ description = "Target temperature at end of training. None keeps temperature fixed." ,
14351459 )
14361460 distill_temperature_schedule : Literal ["constant" , "linear" , "cosine" ] = Field (
1437- "constant" , description = "Schedule type for temperature annealing ('constant', 'linear', or 'cosine')."
1461+ "constant" ,
1462+ description = "Schedule type for temperature annealing ('constant', 'linear', or 'cosine')." ,
14381463 )
14391464 distill_beta_end : Optional [float ] = Field (
1440- None , description = "Target beta_feature at end of training. None keeps beta fixed."
1465+ None ,
1466+ description = "Target beta_feature at end of training. None keeps beta fixed." ,
14411467 )
14421468 distill_beta_schedule : Literal ["constant" , "linear" , "cosine" ] = Field (
1443- "constant" , description = "Schedule type for beta annealing ('constant', 'linear', or 'cosine')."
1469+ "constant" ,
1470+ description = "Schedule type for beta annealing ('constant', 'linear', or 'cosine')." ,
14441471 )
14451472
14461473 # --- Learn to init related parameters --
@@ -1463,11 +1490,13 @@ class Distillation(BaseModel):
14631490 )
14641491
14651492 attn_module_name : Optional [str ] = Field (
1466- None , description = "Attention nnx module attribute name to augment with LTI logic"
1493+ None ,
1494+ description = "Attention nnx module attribute name to augment with LTI logic" ,
14671495 )
14681496
14691497 lti_layer_indices : Optional [list [int ]] = Field (
1470- None , description = "List of layer indices to apply LTI modifications. If None, applied to all layers."
1498+ None ,
1499+ description = "List of layer indices to apply LTI modifications. If None, applied to all layers." ,
14711500 )
14721501 # ---------------------------------------
14731502
@@ -1532,11 +1561,13 @@ class DilocoParams(BaseModel):
15321561 diloco_outer_lr : float = Field (0.3 , description = "learning rate for outer optimizer." )
15331562 diloco_outer_momentum : float = Field (0.9 , description = "momentum for outer optimizer." )
15341563 dcn_bandwidth_limit : str = Field (
1535- "" , description = "Programmatic DCN egress bandwidth limit (e.g., '28gbit'). Empty means no limit."
1564+ "" ,
1565+ description = "Programmatic DCN egress bandwidth limit (e.g., '28gbit'). Empty means no limit." ,
15361566 )
15371567 dcn_bandwidth_burst : str = Field ("10mb" , description = "Burst size for Token Bucket Filter (TBF) traffic shaping." )
15381568 dcn_bandwidth_latency : str = Field (
1539- "50ms" , description = "Latency threshold for Token Bucket Filter (TBF) traffic shaping."
1569+ "50ms" ,
1570+ description = "Latency threshold for Token Bucket Filter (TBF) traffic shaping." ,
15401571 )
15411572 dcn_bandwidth_interface : str = Field ("eth0" , description = "Network interface to apply bandwidth limits on." )
15421573
@@ -1829,7 +1860,8 @@ class Profiling(BaseModel):
18291860 tpu_num_chips_to_profile_per_task : int = Field (1 , description = "Specifies the number of TPU chips to profile per task." )
18301861 tpu_num_sparse_cores_to_trace : int = Field (2 , description = "Specifies the number of TPU chips to profile per task." )
18311862 tpu_num_sparse_core_tiles_to_trace : int = Field (
1832- 1 , description = "Specifies the number of tiles within each sparse core to trace on the TPU."
1863+ 1 ,
1864+ description = "Specifies the number of tiles within each sparse core to trace on the TPU." ,
18331865 )
18341866 xprof_tpu_power_trace_level : XProfTPUPowerTraceMode = Field (
18351867 XProfTPUPowerTraceMode .POWER_TRACE_NONE ,
@@ -2770,7 +2802,11 @@ def validate_and_set_hlo_dump_defaults():
27702802 )
27712803 for param_name , schedule , end_value in [
27722804 ("distill_alpha" , self .distill_alpha_schedule , self .distill_alpha_end ),
2773- ("distill_temperature" , self .distill_temperature_schedule , self .distill_temperature_end ),
2805+ (
2806+ "distill_temperature" ,
2807+ self .distill_temperature_schedule ,
2808+ self .distill_temperature_end ,
2809+ ),
27742810 ("distill_beta" , self .distill_beta_schedule , self .distill_beta_end ),
27752811 ]:
27762812 if schedule != "constant" and end_value is None :
@@ -2827,7 +2863,10 @@ def get_num_target_devices():
28272863
28282864 # Check for AQT deprecation warning
28292865 if self .quantization and not self .use_qwix_quantization :
2830- if self .quantization not in ("fp8" , "nanoo_fp8" ) and not self .quantization .startswith ("te_" ):
2866+ if self .quantization not in (
2867+ "fp8" ,
2868+ "nanoo_fp8" ,
2869+ ) and not self .quantization .startswith ("te_" ):
28312870 logger .warning (
28322871 "WARNING: AQT quantization is deprecated and will be removed in a future release. "
28332872 "Please migrate to Qwix by setting use_qwix_quantization=True."
@@ -2935,6 +2974,7 @@ def calculate_global_batch_sizes(per_device_batch_size, expansion_factor, num_de
29352974 "query_proj" ,
29362975 "key_proj" ,
29372976 "value_proj" ,
2977+ "kv_proj" ,
29382978 "query_wa_proj" ,
29392979 "kv_wa_proj" ,
29402980 "mla_kv" ,
0 commit comments