seed: 42
output_dir: './output'
load_checkpoint: ''
src_strategy_path_or_dir: ''
auto_trans_ckpt: False
only_save_strategy: False
resume_training: False
run_mode: 'finetune'
load_ckpt_format: 'ckpt'
trainer:
type: CausalLanguageModelingTrainer
model_name: 'qwen2_32b'
runner_config:
epochs: 2
batch_size: 1
sink_mode: True
sink_size: 1
runner_wrapper:
type: MFTrainOneStepCell
use_clip_grad: True
optimizer:
type: AdamW
betas: [0.9, 0.95]
eps: 1.e-8
learning_rate: 1.e-6
weight_decay: 0.1
lr_schedule:
type: CosineWithWarmUpLR
learning_rate: 1.e-6
lr_end: 1.e-7
warmup_ratio: 0
total_steps: -1
train_dataset: &train_dataset
data_loader:
type: MindDataset
dataset_dir: ""
shuffle: False
input_columns: ["input_ids", "target_ids", "attention_mask"]
construct_args_key: ["input_ids", "labels"]
num_parallel_workers: 8
python_multiprocessing: False
drop_remainder: True
numa_enable: False
prefetch_size: 1
train_dataset_task:
type: CausalLanguageModelDataset
dataset_config: *train_dataset
use_parallel: True
parallel:
parallel_mode: 1
gradients_mean: False
enable_alltoall: False
full_batch: True
search_mode: "sharding_propagation"
enable_parallel_optimizer: True
strategy_ckpt_save_file: "./ckpt_strategy.ckpt"
parallel_optimizer_config:
gradient_accumulation_shard: False
parallel_optimizer_threshold: 64
parallel_config:
data_parallel: 1
model_parallel: 8
pipeline_stage: 2
use_seq_parallel: True
optimizer_shard: True
micro_batch_num: 128
vocab_emb_dp: False
gradient_aggregation_group: 8
micro_batch_interleave_num: 1
recompute_config:
recompute: [1, 0]
select_recompute:
'feed_forward\.mul': [ 31, 0]
'feed_forward\.w1\.activation\.silu': [ 31, 0]
'feed_forward\.w1\.reshape': [ 31, 0]
'feed_forward\.w2\.reshape': [ 31, 0]
parallel_optimizer_comm_recompute: False
mp_comm_recompute: False
recompute_slice_activation: False
callbacks:
- type: MFLossMonitor
- type: CheckpointMonitor
prefix: "qwen2"
checkpoint_format: "ckpt"
save_checkpoint_steps: 5000
keep_checkpoint_max: 1
integrated_save: False
context:
jit_config:
jit_level: "O1"
memory_optimize_level: "O0"
mode: 0
device_target: "Ascend"
max_call_depth: 10000
max_device_memory: "58GB"
save_graphs: False
save_graphs_path: "./graph"
device_id: 0
ascend_config:
precision_mode: "must_keep_origin_dtype"
model:
model_config:
type: LlamaConfig
batch_size: 1
seq_length: 8192
hidden_size: 5120
num_layers: 64
num_heads: 40
n_kv_heads: 8
vocab_size: 152064
intermediate_size: 27648
qkv_has_bias: True
rms_norm_eps: 1.0e-5
theta: 1000000.0
max_position_embedding: 131072
emb_dropout_prob: 0.0
eos_token_id: 151643
pad_token_id: 151643
compute_dtype: "bfloat16"
layernorm_compute_type: "float32"
softmax_compute_type: "float32"
rotary_dtype: "float16"
param_init_type: "float32"
use_flash_attention: True
use_past: False
fine_grain_interleave: 1
offset: [-1, 1]
checkpoint_name_or_path: ""
repetition_penalty: 1
max_decode_length: 2048
top_k: 0
top_p: 0.8
do_sample: False
compute_in_2d: True
is_dynamic: False
qkv_concat: True
rotary_pct: 1.0
rotary_emb_base: 1000000
kv_channels: 128
arch:
type: LlamaForCausalLM