[遇到问题][已解决]Accelerate设置训练报错,端口问题

报错内容

ValueError: Less than two GPU ids were configured and tried to run on on multiple GPUs. Please ensure at least two are specified for `--gpu_ids`, or use `--gpu_ids='all'`.

ValueError:配置了少于两个GPU id,并试图在多个GPU上运行。请确保为'——gpu_ids '指定至少两个,或者使用'——gpu_ids='all' '。

当前设置
(报错Less than two GPU ids were configured and tried to run on on multiple GPUs)

更改设置

运行如下,可以看出虽然 0,1 内存为主,但是其他卡内存为3m也被占用

然后设置2,3,跑另外一个程序

报错显示端口被占用
ConnectionError: Tried to launch distributed communication on port `9999`, but another process is utilizing it. Please specify a different port (such as using the `----main_process_port` flag or specifying a different `main_process_port` in your config file) and rerun your script. To automatically use the next open port (on a single node), you can set this to `0`.

解决办法

从报错可以看出,

ConnectionError: Tried to launch distributed communication on port `9999`, but another process is utilizing it. Please specify a different port (such as using the `----main_process_port` flag or specifying a different `main_process_port` in your config file) and rerun your script. To automatically use the next open port (on a single node), you can set this to `0`.

我们设置端口是9999,只要再跑程序还是这个端口,这是因为我们的代码里设置了端口9999

更改设置为,端口8888即可(肯定可以),或者按照提示设置为0(未得到验证)

accelerate launch --mixed_precision="fp16"  --main_process_port=8888 ../kd_yw.py

  • 13
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

计算机视觉-Archer

图像分割没有团队的同学可加群

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值