报错内容
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