安装报错

按PyTorch官网给出的命令

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

报错

ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

原因:当前python版本过低(我是3.6)

解决方法:用Anaconda重新建一个Python高版本环境(比如3.10)

RuntimeError: Distributed package doesn‘t have NCCL built in

我的是Windows系统,不支持nccl

在运行的py文件最开始加代码

import os
os.environ["PL_TORCH_DISTRIBUTED_BACKEND"] = "gloo"

修改类似地方,把nccl改成gloo

torch.distributed.init_process_group("nccl")
03-04 06:09