最近在搞分布式训练大模型,踩了两个晚上的坑今天终于爬出来了

我们使用 2台 8*H100

遇到过

错误1

10.255.19.85: ncclSystemError: System call (e.g. socket, malloc) or external library call failed or device error.
10.255.19.85: Last error:
10.255.19.85: socketStartConnect: Connect to 127.0.0.1<34273> failed : Software caused connection abort

错误2

10.255.19.82: torch.distributed.DistBackendError: [7] is setting up NCCL communicator and retrieving ncclUniqueId from [0] via c10d key-value store by key '0', but store->get('0') got error: Connection reset by

错误3

10.255.19.85: ncclInternalError: Internal check failed.
10.255.19.85: Last error:
10.255.19.85: Bootstrap : no socket interface found

其实这三个错误都是一个问题导致的,就是网卡配置的问题

这是之前的配置

hostfile

10.255.19.82 slots=8
10.255.19.85 slots=8

fine-tune.sh

hostfile="/data2/xinyuuliu/Baichuan2-main/fine-tune/hostfile"

export NCCL_SOCKET_IFNAME=enp194s0f0
# export MASTER_ADDR=10.255.19.82 # 主节点的IP地址
# export MASTER_PORT=29500
# --include localhost:0,1,2,3,4,5,6,7
export NCCL_DEBUG=INFO
# export NCCL_IB_TIMEOUT=22
# export NCCL_IB_GID_INDEX=3
# export NCCL_IB_TC=128
# export NCCL_IB_DISABLE=1 deepspeed --master_addr 10.255.19.82 --master_port 29500 --hostfile=$hostfile fine-tune.py \
--report_to "none" \
--data_path "/data2/xinyuuliu/Baichuan2-main/fine-tune/data/全网评价总结训练数据.json" \
--model_name_or_path "/data1/xinyuuliu/Baichuan2-13B-Chat" \
--output_dir "output_lora_summary" \
--model_max_length 10000\
--num_train_epochs 10 \
--per_device_train_batch_size 4 \
--gradient_accumulation_steps 1 \
--save_strategy epoch \
--learning_rate 2e-4 \
--lr_scheduler_type constant \
--adam_beta1 0.9 \
--adam_beta2 0.98 \
--adam_epsilon 1e-8 \
--max_grad_norm 1.0 \
--weight_decay 1e-4 \
--warmup_ratio 0.0 \
--logging_steps 1 \
--gradient_checkpointing True \
--deepspeed ds_config.json \
--bf16 True \
--tf32 True \
--use_lora True \
# --load_lora_path /data2/xinyuuliu/Baichuan2-main/fine-tune/output_lora4_1_1/checkpoint-7516
# --use_NEFT True
# --use_frozen True #"/data2/xinyuuliu/baichuan2_7B"

修改后之后的配置

问题主要出现在 NCCL_SOCKET_IFNAME 这个环境变量,这个环境变量会被携带到其他机器上,但是网卡的名称是不一样的,尤其我的两台机器包含很多的网卡,因此,我们配置的时候需要把那些没用的虚拟网卡屏蔽掉,只留下需要的

解决方法,这个要根据实际情况来改,英伟达官方写法如下,屏蔽显卡用^开头

export NCCL_SOCKET_IFNAME=^br-c485a8390817,docker0,eno2,ens6f0,ens6f1,enx46a838614d5f,lo,veth23d7383,br-dcd3e4ec14e7,enp194s0f1,ens6f0,ens6f1,enxe278666d5a52,veth110d0b7,veth215ea4e,veth3203d6b,veth87c3cbf,vethec6fc79,virbr0

我的网卡太多了,之前一直以为环境变量在 /etc/profile 下配置各自的就行,

然后再source /etc/profile,结果发现不对,从机也都指向了主机的网卡,没办法建立socket


hostfile="/data2/xinyuuliu/Baichuan2-main/fine-tune/hostfile"

export NCCL_SOCKET_IFNAME=^br-c485a8390817,docker0,eno2,ens6f0,ens6f1,enx46a838614d5f,lo,veth23d7383,br-dcd3e4ec14e7,enp194s0f1,ens6f0,ens6f1,enxe278666d5a52,veth110d0b7,veth215ea4e,veth3203d6b,veth87c3cbf,vethec6fc79,virbr0
# export NCCL_SOCKET_IFNAME=enp194s0f0
# export MASTER_ADDR=10.255.19.82 # 主节点的IP地址
# export MASTER_PORT=29500
# --include localhost:0,1,2,3,4,5,6,7
export NCCL_DEBUG=INFO
# export NCCL_IB_TIMEOUT=22
# export NCCL_IB_GID_INDEX=3
# export NCCL_IB_TC=128
# export NCCL_IB_DISABLE=1 deepspeed --master_addr 10.255.19.82 --master_port 29500 --hostfile=$hostfile fine-tune.py \
--report_to "none" \
--data_path "/data2/xinyuuliu/Baichuan2-main/fine-tune/data/全网评价总结训练数据.json" \
--model_name_or_path "/data1/xinyuuliu/Baichuan2-13B-Chat" \
--output_dir "output_lora_summary" \
--model_max_length 10000\
--num_train_epochs 10 \
--per_device_train_batch_size 4 \
--gradient_accumulation_steps 1 \
--save_strategy epoch \
--learning_rate 2e-4 \
--lr_scheduler_type constant \
--adam_beta1 0.9 \
--adam_beta2 0.98 \
--adam_epsilon 1e-8 \
--max_grad_norm 1.0 \
--weight_decay 1e-4 \
--warmup_ratio 0.0 \
--logging_steps 1 \
--gradient_checkpointing True \
--deepspeed ds_config.json \
--bf16 True \
--tf32 True \
--use_lora True \
# --load_lora_path /data2/xinyuuliu/Baichuan2-main/fine-tune/output_lora4_1_1/checkpoint-7516
# --use_NEFT True
# --use_frozen True #"/data2/xinyuuliu/baichuan2_7B"

修改后成功跑起16*H100,爽歪歪

deepspeed 训练多机多卡报错 ncclSystemError Last error的更多相关文章

  1. cordova-ios 升级到4.4.0 无法真机跑iOS8 报错: dyld`dyld_fatal_error: -> 0x120085088 <+0>: brk #0x3

    项目进入测试阶段,马上要上线了,同事拿了自己的iOS8系统5s跑真机,无缘无故报错,之前跑她的手机完全没有问题的.Xcode 8.x中最低部署版本是iOS8.0,按理说完全能够跑真机的. 但是报了一个 ...

  2. http报错之return error code:401 unauthorized

     http报错之return error code:401 unauthorized 依据HTTP返回码所表示的意思应该是未授权,没有输入账号和password,因此解决方法就直接在HTTP包里面 ...

  3. 支付宝 报错 rsa_private read error : private key is NULL解决方法

    原因:  真机调试IOS支付宝功能GDB出现 rsa_private read error : private key is NULL提示 调试iOS 支付宝SDK的时候,执行demo.把 Partn ...

  4. 配置MySQL主从复制报错Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work

    配置MySQL主从复制报错 ``` Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave ha ...

  5. VS经常报错的link error 2019

    VS经常报错的link error 2019 原因如下: 可能是找得到头文件,但是相关的dll或者lib找不到,需要在配置里面添加相应的库文件. project=>configuration.. ...

  6. 解决FPDF报错:FPDF error: Not a JPEG file / FPDF error: Not a PNG file

    最近有个项目需要用到FPDF,但是输出的时候报错: FPDF error: Not a JPEG file: http://***/data/attachment/forum/201603/19/10 ...

  7. Heka 编译安装后 运行报错 panic: runtime error: cgo argument has Go pointer to Go pointer

    Heka 编译安装后 运行报错 panic: runtime error: cgo argument has Go pointer to Go pointer 解决办法: 1.  Start heka ...

  8. PHP编译安装报错:configure: error: mcrypt.h not found. Please reinstall libmcrypt

    我是在CentOS6.5安装php5.5.28这个版本,PHP编译代码如下: ./configure --prefix=/usr/local/php --with-config-file-path=/ ...

  9. mysql启动报错 mysql InnoDB: Error: could not open single-table tablespace file

    mysql启动不成功,报错 mysql InnoDB: Error: could not open single-table tablespace file innodb_force_recovery ...

  10. xtrabackup备份MySQL报错:InnoDB: Error number 24 means 'Too many open files'

    xtrabackup备份MySQL报错:InnoDB: Error number 24 means 'Too many open files' 1.使用xtrabackup备份MySQL时出现如下报错 ...

随机推荐

  1. 那些年,我的Mysql学习之旅(学习笔记持续整理更新中)

    MySql海量数据存储与优化 一.Mysql架构原理和存储机制 1.体系结构 2.查询缓存 3.存储引擎 存储引擎的分类 innodb:支持事务,具有支持回滚,提交,崩溃恢复等功能,事务安全 myis ...

  2. USB数据传输与手机授权:充电宝常规使用不需要授权

    概述 此篇为解答充电宝骗局问题,骗局概述:两个人做局,以充测试充电宝是否损坏为由,插到受骗者手机上,受骗者允许了手机弹出的授权请求后,偷偷将病毒注入手机. Q:什么情况下手机会弹出授权? A:手机用数 ...

  3. vscode vue 鼠标Ctrl+单击 函数跳转 插件名称:vue-helper

  4. 简单实用算法——位图算法(BitMap)

    目录 算法原理 优点和缺点 算法实现(C#) 算法应用 参考文章 算法原理 BitMap的基本思想就是用一个bit位来标记某个元素对应的Value,而Key即是该元素.由于采用了Bit为单位来存储数据 ...

  5. Python3解决UnicodeDecodeError: 'utf-8' codec can't decode byte..问题最快解决方案

    问题: 使用python3 作为socket通信的时候,出现了这个错误:UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in posi ...

  6. Spring之事务传播属性

    在Spring中,我们可以从单调烦闷的事务管理代码中解脱出来,通过声明式方式灵活地进行事务的管理,提高开发效率和质量. 在使用Spring时,大部分会用到他的声明式事务,简单的在配置文件中进行一些规则 ...

  7. Linux输入输出

    1.重定向概述 1.什么是重定向 将原本要输出到屏幕的数据信息,重新定向到某个指定的文件中.比如:每天凌晨定时备份数据,希望将备份数据的结果保存到某个文件中. 这样第二天通过查看文件的内容就知道昨天备 ...

  8. 如何理解UDP 和 TCP? 区别? 应用场景?

    一.UDP UDP(User Datagram Protocol),用户数据包协议,是一个简单的面向数据报的通信协议,即对应用层交下来的报文,不合并,不拆分,只是在其上面加上首部后就交给了下面的网络层 ...

  9. NOI Linux 2.0 下载安装和使用

    下载安装部分 NOI Linux 2.0发布,将于9月1日起正式启用! 首先来到 NOI 的官网,下载 .iso 格式的盘符. 然后下载任意一个虚拟机软件,这里以 VirtualBox 为例. Dow ...

  10. 无法进去wordpress后台,也不能修改密码怎么办?wordpress无需下载插件修改代码配置SMTP发送邮件(网易邮箱)

    (解决不能进入wordpress后台,忘记密码,找回密码时提示站点邮件配置失败的问题,配置好之后即可通过邮件重置wordpress密码) 使用ssh工具远程连接自己的服务器(Xshell或者服务器自带 ...