afea72c6创建于 2025年1月2日历史提交
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
use_parallel: True
run_mode: 'finetune'

# trainer config
trainer:
  type: CausalLanguageModelingTrainer
  model_name: 'whisper-large-v3'

runner_config:
  epochs: 2
  batch_size: 8
  sink_mode: True
  sink_size: 1

# optimizer
optimizer:
  type: AdamW
  eps: 1.e-8
  learning_rate: 1.e-5

# lr schedule
lr_schedule:
  type: CosineWithWarmUpLR
  learning_rate: 1.e-5
  lr_end: 0.0
  warmup_ratio: 0.03
  total_steps: -1 # -1 means it will load the total steps of the dataset

# dataset
train_dataset: &train_dataset
  data_loader:
    type: MindDataset
    dataset_dir: ""
    shuffle: False
  input_columns: [ "input_features", "decoder_input_ids", "encoder_dropout_probability",
                   "decoder_dropout_probability" ]
  num_parallel_workers: 8
  python_multiprocessing: False
  drop_remainder: True
  batch_size: 2
  repeat: 1
  numa_enable: False
  prefetch_size: 1
train_dataset_task:
  type: CausalLanguageModelDataset
  dataset_config: *train_dataset
# if True, do evaluate during the training process. if false, do nothing.
# note that the task trainer should support _evaluate_in_training function.
do_eval: False

# eval dataset
eval_dataset: &eval_dataset
  data_loader:
    type: MindDataset
    dataset_dir: ""
    shuffle: False
  input_columns: [ "input_ids" ]
  num_parallel_workers: 8
  python_multiprocessing: False
  drop_remainder: False
  repeat: 1
  numa_enable: False
  prefetch_size: 1
eval_dataset_task:
  type: CausalLanguageModelDataset
  dataset_config: *eval_dataset

# 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_save_file: "./ckpt_strategy.ckpt"
  parallel_optimizer_config:
    gradient_accumulation_shard: False
    parallel_optimizer_threshold: 64
# default parallel of device num = 8 for Atlas 800T A2
parallel_config:
  data_parallel: 8
  model_parallel: 1
  pipeline_stage: 1
  use_seq_parallel: False
  micro_batch_num: 1
  vocab_emb_dp: True
  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: False
  select_recompute: False
  parallel_optimizer_comm_recompute: False
  mp_comm_recompute: True
  recompute_slice_activation: True

# callbacks
callbacks:
  - type: MFLossMonitor
  - type: CheckpointMonitor
    prefix: "whisper-large-v3"
    save_checkpoint_steps: 100
    integrated_save: False
    async_save: False
  - type: ObsMonitor

# mindspore context init config
context:
  mode: 0 #0--Graph Mode; 1--Pynative Mode
  device_target: "Ascend"
  max_call_depth: 10000
  max_device_memory: "58GB"
  save_graphs: False
  jit_level: "O0"
  save_graphs_path: "./graph"
  device_id: 0

# model config
model:
  model_config:
    type: WhisperConfig
    batch_size: 1 # add for increase predict
    activation_dropout: 0
    activation_function: 'gelu'
    attention_dropout: 0
    bos_token_id: 50257
    compute_dtype: "bfloat16"
    d_model: 1280
    decoder_attention_heads: 20
    decoder_ffn_dim: 5120
    decoder_layerdrop: 0
    decoder_layers: 32
    decoder_start_token_id: 50258
    dropout: 0.0
    embedding_init_type: "float32"
    encoder_attention_heads: 20
    encoder_ffn_dim: 5120
    encoder_layerdrop: 0
    encoder_layers: 32
    eos_token_id: 50257
    is_dynamic: False
    is_encoder_decoder: True
    layernorm_compute_dtype: "float32"
    max_source_positions: 1500
    max_target_positions: 448
    num_hidden_layers: 32
    num_layers_of_each_stage: null
    num_mel_bins: 128
    pad_token_id: 50256
    param_init_type: "float32"
    softmax_compute_type: "float32"
    use_flash_attention: True
    vocab_size: 51866
  arch:
    type: WhisperForConditionalGeneration

# metric
metric:
  type: PerplexityMetric

# wrapper cell config
runner_wrapper:
  type: MFTrainOneStepCell
  scale_sense:
    type: DynamicLossScaleUpdateCell
    loss_scale_value: 8192
    scale_factor: 2
    scale_window: 1000
  use_clip_grad: True

eval_callbacks:
  - type: ObsMonitor

auto_tune: False
filepath_prefix: './autotune'
autotune_per_step: 10

profile: False
profile_start_step: 1
profile_stop_step: 10
init_start_profile: False
profile_communication: False
profile_memory: True
layer_scale: False
layer_decay: 0.65
lr_scale_factor: 256

# aicc
remote_save_url: "Please input obs url on AICC platform."