【报错】macos+python+分布式训练

avatar
作者
筋斗云
阅读量:0

Downloads/loca-main/train.py
Traceback (most recent call last):
  File "/Users/dearr/Downloads/loca-main/train.py", line 222, in <module>
    train(args)
  File "/Users/dearr/Downloads/loca-main/train.py", line 32, in train
    world_size = int(os.environ['WORLD_SIZE'])
  File "/Users/dearr/anaconda3/envs/pytorch/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'WORLD_SIZE'

分布式训练出现这个错误的解决办法:KeyError:‘RANK‘_keyerror: 'rank-CSDN博客

(pytorch) (base) dearr@dearrdeMacBook-Air loca-main % /Users/dearr/anaconda3/envs/pytorch/bin/python /Users/dearr/
Downloads/loca-main/train.py
Traceback (most recent call last):
  File "/Users/dearr/Downloads/loca-main/train.py", line 224, in <module>
    train(args)
  File "/Users/dearr/Downloads/loca-main/train.py", line 36, in train
    gpu = int(os.environ['LOCAL_RANK'])
  File "/Users/dearr/anaconda3/envs/pytorch/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'LOCAL_RANK'

(pytorch) (base) dearr@dearrdeMacBook-Air loca-main % export LOCAL_RANK=0

(pytorch) (base) dearr@dearrdeMacBook-Air loca-main % /Users/dearr/anaconda3/envs/pytorch/bin/python /Users/dearr/Dow
nloads/loca-main/dearRongerr.py
Traceback (most recent call last):
  File "/Users/dearr/Downloads/loca-main/dearRongerr.py", line 25, in <module>
    print(os.environ['RANK'])
  File "/Users/dearr/anaconda3/envs/pytorch/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'RANK'

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!