记录踩过的坑-PyTorch

目录

Pytorch中RuntimeError: expected scalar type Double but found Float

安装报错

RuntimeError: Distributed package doesn‘t have NCCL built in


Pytorch中RuntimeError: expected scalar type Double but found Float

将原来的tensor转成torch.float32类型即可

x = x.to(torch.float32)

安装报错

按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")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值