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: False
run_mode: 'predict'

# trainer config
trainer:
  type: ImageToTextGenerationTrainer
  model_name: 'qwenvl'

runner_config:
  sink_mode: True

# callbacks
callbacks:
  - type: MFLossMonitor
  - type: CheckpointMonitor
    prefix: "qwen-vl"
    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: True
  mp_comm_recompute: False
  recompute_slice_activation: True

model:
  model_config:
    type: QwenVLConfig
    auto_register: qwenvl_config.QwenVLConfig
    freeze_vision: True
    freeze_resampler: False
    freeze_llm: False
    use_past: True
    compute_dtype: "float16"
    param_init_type: "float16"
    softmax_compute_type: "float32"
    is_dynamic: True
    block_size: 16
    num_blocks: 512
    checkpoint_name_or_path: ""

    vision_model:
      arch:
        type: QwenVLVisionModel
        auto_register: qwenvl_model.QwenVLVisionModel
      model_config:
        type: QwenVLVisionConfig
        auto_register: qwenvl_config.QwenVLVisionConfig
        hidden_size: 1664
        intermediate_size: 8192
        num_hidden_layers: 48
        num_attention_heads: 16
        image_size: 448
        patch_size: 14
        gelu_dtype: "float32"
        dropout: 0.0
        attention_dropout: 0.0
        initializer_range: 0.02
        initializer_factor: 1.0

    llm_model:
      arch:
        type: QwenForCausalLM
        auto_register: qwen_model.QwenForCausalLM
      model_config:
        type: QwenConfig
        auto_register: qwenvl_config.QwenConfig
        batch_size: 1
        seq_length: 2048
        hidden_size: 4096
        num_layers: 32
        num_heads: 32
        vocab_size: 151936
        intermediate_size: 11008
        enable_slice_dp: False
        embedding_parallel_optimizer: False
        rms_norm_eps: 1.0e-6
        emb_dropout_prob: 0.0
        eos_token_id: 151643
        pad_token_id: 151643
        ignore_token_id: -100
        layernorm_compute_type: "float32"
        rotary_dtype: "float16"
        use_flash_attention: True
        is_dynamic: True
        block_size: 16
        num_blocks: 512
        offset: 0
        checkpoint_name_or_path: ""
        repetition_penalty: 1
        max_decode_length: 1024
        use_past: True
        top_k: 0
        top_p: 0.8
        do_sample: False
        enable_emb_opt: True
        qkv_concat: False

        # configuration items copied from Qwen
        rotary_pct: 1.0
        rotary_emb_base: 10000
        kv_channels: 128
  arch:
    type: QwenVL
    auto_register: qwenvl_model.QwenVL

# processor
processor:
  type: QwenVLProcessor
  auto_register: qwenvl_processor.QwenVLProcessor
  image_processor:
    type: QwenVLImageProcessor
    auto_register: qwenvl_processor.QwenVLImageProcessor
    image_size: 448  # input image size
  tokenizer:
    type: QwenVLTokenizer
    auto_register: qwenvl_tokenizer.QwenVLTokenizer
    max_length: 32
    vocab_file: ""
  max_length: 2048

# mindspore context init config
context:
  mode: 0 #0--Graph Mode; 1--Pynative Mode
  device_target: "Ascend"
  ascend_config:
    precision_mode: "must_keep_origin_dtype"
  max_call_depth: 10000
  max_device_memory: "58GB"
  save_graphs: False
  save_graphs_path: "./graph"
  device_id: 0
  infer_boost: 'on'

# 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

profile: False
profile_start_step: 5
profile_stop_step: 10
init_start_profile: False
profile_communication: False
profile_memory: True