代码拉取完成,页面将自动刷新
seed: 0
output_dir: './output' # path to save checkpoint/strategy
load_checkpoint: ''
src_strategy_path_or_dir: ''
auto_trans_ckpt: False # If true, auto transform load_checkpoint to load in distributed model
only_save_strategy: False
resume_training: False
run_mode: 'finetune'
use_parallel: True
# trainer config
trainer:
type: CausalLanguageModelingTrainer
model_name: 'qwen_14b'
# dataset
train_dataset: &train_dataset
data_loader:
type: MindDataset
dataset_dir: ""
shuffle: True
input_columns: ["input_ids", "labels", "attention_mask"]
num_parallel_workers: 8
python_multiprocessing: False
drop_remainder: True
batch_size: 4
repeat: 1
numa_enable: False
prefetch_size: 1
train_dataset_task:
type: CausalLanguageModelDataset
dataset_config: *train_dataset
# runner config
runner_config:
epochs: 5
batch_size: 1
sink_mode: True
sink_size: 2
runner_wrapper:
type: MFTrainOneStepCell
scale_sense:
type: DynamicLossScaleUpdateCell
loss_scale_value: 1024
scale_factor: 2
scale_window: 1000
use_clip_grad: True
# optimizer
optimizer:
type: FP32StateAdamWeightDecay
beta1: 0.9
beta2: 0.95
eps: 1.e-8
weight_decay: 0.1
# lr schedule
lr_schedule:
type: CosineWithWarmUpLR
learning_rate: 1.e-5
warmup_ratio: 0.01
total_steps: -1 # -1 means it will load the total steps of the dataset
# callbacks
callbacks:
- type: MFLossMonitor
- type: CheckpointMonitor
prefix: "qwen"
save_checkpoint_steps: 10000
keep_checkpoint_max: 3
integrated_save: False
async_save: False
- type: ObsMonitor
# default parallel of device num = 8 for Atlas 800T A2
parallel_config:
data_parallel: 8
model_parallel: 1
pipeline_stage: 1
micro_batch_num: 1
vocab_emb_dp: False
gradient_aggregation_group: 4
# when model parallel is greater than 1, we can set micro_batch_interleave_num=2, that may accelerate the train process.
micro_batch_interleave_num: 1
# recompute config
recompute_config:
recompute: True
select_recompute: False
parallel_optimizer_comm_recompute: False
mp_comm_recompute: True
recompute_slice_activation: True
model:
model_config:
type: QwenConfig
batch_size: 1
seq_length: 2048
hidden_size: 5120
num_layers: 40
num_heads: 40
vocab_size: 152064
intermediate_size: 13696
rms_norm_eps: 1.0e-6
emb_dropout_prob: 0.0
eos_token_id: 151643
pad_token_id: 151643
compute_dtype: "bfloat16"
layernorm_compute_type: "float32"
softmax_compute_type: "float16"
rotary_dtype: "float16"
param_init_type: "float32"
use_past: True
use_flash_attention: True
block_size: 32
num_blocks: 128
offset: 0
checkpoint_name_or_path: "/path/qwen_14b_base.ckpt"
repetition_penalty: 1
max_decode_length: 512
top_k: 0
top_p: 0.8
do_sample: False
# configuration items copied from Qwen
rotary_pct: 1.0
rotary_emb_base: 10000
kv_channels: 128
arch:
type: QwenForCausalLM
processor:
return_tensors: ms
tokenizer:
vocab_file: "/path/qwen.tiktoken"
pad_token: "<|endoftext|>"
type: QwenTokenizer
type: QwenProcessor
# mindspore context init config
context:
jit_config:
jit_level: "O2"
mode: 0 #0--Graph Mode; 1--Pynative Mode
device_target: "Ascend"
enable_graph_kernel: False
ascend_config:
precision_mode: "must_keep_origin_dtype"
max_call_depth: 10000
max_device_memory: "59GB"
save_graphs: False
save_graphs_path: "./graph"
device_id: 0
# parallel context config
parallel:
parallel_mode: 1 # 0-data parallel, 1-semi-auto parallel, 2-auto parallel, 3-hybrid parallel
gradients_mean: False
enable_alltoall: False
full_batch: True
search_mode: "sharding_propagation"
enable_parallel_optimizer: True
strategy_ckpt_config:
save_file: "./ckpt_strategy.ckpt"
only_trainable_params: False
parallel_optimizer_config:
gradient_accumulation_shard: False
parallel_optimizer_threshold: 64
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。