配置晟腾910b的PyTorch torch_npu环境

1.【新教程】华为昇腾NPU的pytorch环境搭建 - Lukea - 博客园

1、新建conda环境。

复制代码
conda create -n pytorch python=3.10

2、在新建好的conda环境中,安装基础的依赖。

复制代码
pip install attrs cython numpy==1.24.0 decorator sympy cffi pyyaml pathlib2 psutil protobuf==3.20 scipy requests absl-py --user

3.安装Pytoch:下面是对应pytorch版本链接,注意架构是x86还是aarch64,然后pip install

wget https://download.pytorch.org/whl/cpu/torch-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl#sha256=de7d63c6ecece118684415a3dbd4805af4a4c1ee1490cccf7405d8c240a481b4

pytorch: Ascend Extension for PyTorch

4.安装pytorch-npu,找到自己适配的版本,然后pip install

https://gitee.com/ascend/pytorch/releases/tag/v6.0.0-pytorch2.1.0

社区版资源下载-资源下载中心-昇腾社区

下载好指定版本后,使用pip install 安装下载好的包即可

5、测试。

使用以下命令测试,如果正常输出结果,说明环境搭建成功。

复制代码
python3 -c "import torch;import torch_npu; a = torch.randn(3, 4).npu(); print(a + a);"

华为昇腾服务器(固件版本查询、驱动版本查询、CANN版本查询)

华为昇腾服务器(固件版本查询、驱动版本查询、CANN版本查询)_怎么查看cann版本-CSDN博客

相关推荐
Cchaofan1 小时前
lesson01-PyTorch初见(理论+代码实战)
人工智能·pytorch·python
山海不说话5 小时前
深度学习(第3章——亚像素卷积和可形变卷积)
图像处理·人工智能·pytorch·深度学习·目标检测·计算机视觉·超分辨率重建
妄想成为master5 小时前
如何完美安装GPU版本的torch、torchvision----解决torch安装慢 无法安装 需要翻墙安装 安装的是GPU版本但无法使用的GPU的错误
人工智能·pytorch·python·环境配置
立秋678910 小时前
从零开始:使用 PyTorch 构建深度学习网络
人工智能·pytorch·深度学习
白白白飘1 天前
pytorch 15.1 学习率调度基本概念与手动实现方法
人工智能·pytorch·学习
缘友一世1 天前
PyTorch深度神经网络(前馈、卷积神经网络)
pytorch·cnn·dnn
墨绿色的摆渡人1 天前
pytorch小记(二十):深入解析 PyTorch 的 `torch.randn_like`:原理、参数与实战示例
人工智能·pytorch·python
lqjun08271 天前
Pytorch实现常用代码笔记
人工智能·pytorch·笔记
qyhua1 天前
用 PyTorch 从零实现简易GPT(Transformer 模型)
人工智能·pytorch·transformer
墨绿色的摆渡人1 天前
pytorch小记(二十一):PyTorch 中的 torch.randn 全面指南
人工智能·pytorch·python