seed: 1234
output_dir: './output'
load_checkpoint: ''
load_ckpt_format: 'safetensors'
auto_trans_ckpt: False
only_save_strategy: False
resume_training: False
run_mode: 'train'
use_parallel: True
use_legacy: False
print_separate_loss: True
trainer:
type: CausalLanguageModelingTrainer
model_name: 'qwen3_moe'
runner_config:
epochs: 1
batch_size: 1
sink_mode: True
sink_size: 1
gradient_accumulation_steps: 1
optimizer:
type: AdamW
betas: [0.9, 0.95]
eps: 1.e-8
weight_decay: 0.0
lr_schedule:
type: ConstantWarmUpLR
learning_rate: 1.e-5
warmup_steps: 0
total_steps: -1
train_dataset: &train_dataset
data_loader:
type: BlendedMegatronDatasetDataLoader
datasets_type: "GPTDataset"
sizes:
- 8000
- 0
- 0
config:
seed: 1234
split: "1, 0, 0"
seq_length: 4096
eod_mask_loss: False
reset_position_ids: False
create_attention_mask: False
reset_attention_mask: False
create_compressed_eod_mask: False
eod_pad_length: 128
eod: 1
pad: -1
data_path:
- '1'
- "/path/to/wiki103-megatron_text_document"
input_columns: ["input_ids", "labels", "loss_mask", "position_ids"]
construct_args_key: ["input_ids", "labels", "loss_mask", "position_ids"]
num_parallel_workers: 8
python_multiprocessing: False
drop_remainder: True
numa_enable: False
prefetch_size: 1
seed: 1234
train_dataset_task:
type: CausalLanguageModelDataset
dataset_config: *train_dataset
context:
mode: 0
device_target: "Ascend"
max_call_depth: 10000
max_device_memory: "58GB"
save_graphs: False
save_graphs_path: "./graph"
device_id: 0
memory_optimize_level: "O0"
jit_config:
jit_level: "O0"
ascend_config:
precision_mode: "must_keep_origin_dtype"
parallel_speed_up_json_path: "configs/qwen3_moe/parallel_speed_up.json"
parallel_config:
data_parallel: &dp 1
model_parallel: 4
pipeline_stage: 4
micro_batch_num: µ_batch_num 16
expert_parallel: 4
use_seq_parallel: True
gradient_aggregation_group: 1
micro_batch_interleave_num: 1
parallel:
parallel_mode: 1
gradients_mean: False
enable_alltoall: True
full_batch: False
dataset_strategy: [
[*dp, 1],
[*dp, 1],
[*dp, 1],
[*dp, 1]
]
search_mode: "sharding_propagation"
enable_parallel_optimizer: False
strategy_ckpt_config:
save_file: "./ckpt_strategy.ckpt"
only_trainable_params: False
parallel_optimizer_config:
gradient_accumulation_shard: False
parallel_optimizer_threshold: 8
recompute_config:
recompute: True
select_recompute: False
parallel_optimizer_comm_recompute: True
mp_comm_recompute: True
model:
model_config:
model_type: "qwen3_moe"
architectures: "Qwen3MoeForCausalLM"
offset: 0
vocab_size: 151936
hidden_size: 2048
intermediate_size: 6144
num_hidden_layers: 48
max_position_embeddings: 40960
hidden_act: 'silu'
num_attention_heads: 32
num_key_value_heads: 4
head_dim: 128
rms_norm_eps: 1.e-6
add_bias_linear: False
tie_word_embeddings: False
use_flash_attention: True
use_contiguous_weight_layout_attention: False
input_sliced_sig: True
hidden_dropout: 0.0
attention_dropout: 0.0
position_embedding_type: "rope"
rope_theta: 1000000
params_dtype: "float32"
compute_dtype: "bfloat16"
layernorm_compute_dtype: "float32"
softmax_compute_dtype: "float32"
rotary_dtype: "float32"
initializer_range: 0.02
moe_grouped_gemm: True
num_experts: 128
num_experts_per_tok: 8
moe_intermediate_size: 768
router_dense_type: "float32"
gated_linear_unit: True
norm_topk_prob: False
moe_router_pre_softmax: True
moe_token_drop_policy: probs
routed_scaling_factor: 1.5
router_aux_loss_coef: 0.001
moe_aux_loss_coeff: 0.001
moe_router_load_balancing_type: "gbs_aux_loss"
callbacks:
- type: MFLossMonitor
runner_wrapper:
type: MFTrainOneStepCell
scale_sense: 1.0
use_clip_grad: True
profile: False
profile_start_step: 1
profile_stop_step: 10
init_start_profile: False
profile_communication: False
profile_memory: True