文档首页> AI开发平台ModelArts> 最佳实践> 昇腾业务迁移> LLM训练业务昇腾迁移指导> 常见问题> 报错提示“RuntimeError: Default process group has not been initialized, please make sure to call init_process_group.”
更新时间:2024-03-14 GMT+08:00
分享

报错提示“RuntimeError: Default process group has not been initialized, please make sure to call init_process_group.”

问题现象

报错提示“RuntimeError: Default process group has not been initialized, please make sure to call init_process_group.”。

原因分析

原因由于单卡脚本中未添加参数“--local_rank -1”,单卡执行脚本如下,需要指定local_rank为-1为单卡模式。

# ptuning/run_npu_1d.sh
export ASCEND_RT_VISIBLE_DEVICES=0  # 指定 0 号卡对当前进程可见
PRE_SEQ_LEN=128
LR=2e-2
 
python3 ptuning/main.py \
    --do_train \
    --train_file ${HOME}/AdvertiseGen/train.json \ 
    --validation_file ${HOME}/AdvertiseGen/dev.json \
    --prompt_column content \
    --response_column summary \
    --overwrite_cache \
    --model_name_or_path ${HOME}/chatglm \
    --output_dir output/adgen-chatglm-6b-pt-$PRE_SEQ_LEN-$LR \
    --overwrite_output_dir \
    --max_source_length 64 \
    --max_target_length 64 \
    --per_device_train_batch_size 4 \
    --per_device_eval_batch_size 1 \
    --gradient_accumulation_steps 1 \
    --predict_with_generate \
    --max_steps 3000 \
    --logging_steps 10 \
    --save_steps 1000 \
    --learning_rate $LR \
    --pre_seq_len $PRE_SEQ_LEN \
    --local_rank -1

处理方法

单卡执行脚本中添加参数“--local_rank -1”。

多卡模式下无需指定,会默认启动DistributedDataParallel(DDP) 多卡并行模式。GPU环境单卡执行同样需要指定local_rank为 -1。

分享:

    相关文档

    相关产品