当前位置: 首页 > wzjs >正文

做游戏网站的分析免费做网站网站的软件

做游戏网站的分析,免费做网站网站的软件,wordpress 最简单皮肤,软件开发专业用什么笔记本将 PyTorch 网络迁移到昇腾平台并执行训练或推理,直接使用昇腾提供的构图接口构图。Ascend Extension for PyTorch插件用于适配PyTorch框架,可以使用昇腾AI处理器的算力。 1 pip 安装 # 下载PyTorch安装包 wget https://download.pytorch.org/whl/cpu/…

将 PyTorch 网络迁移到昇腾平台并执行训练或推理,直接使用昇腾提供的构图接口构图。Ascend Extension for PyTorch插件用于适配PyTorch框架,可以使用昇腾AI处理器的算力。

1 pip 安装

# 下载PyTorch安装包
wget https://download.pytorch.org/whl/cpu/torch-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
# 下载torch_npu插件包
wget https://gitee.com/ascend/pytorch/releases/download/v6.0.rc3-pytorch2.1.0/torch_npu-2.1.0.post8-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl# 安装命令
pip3 install torch-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pip3 install torch_npu-2.1.0.post8-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

注:

  • 如果下载whl包时出现ERROR: cannot verify gitee.com's certificate报错,可在下载命令后加上--no-check-certificate参数避免此问题
  • 执行如下命令,若返回True则说明安装成功
python3 -c "import torch;import torch_npu;print(torch_npu.npu.is_available())"
  • 若Pytorch版本为2.1.0,出现找不到google或者protobuf或者protobuf版本过高报错时,需执行如下命令:
pip install protobuf==3.20

2 源码安装

2.1 源码编译安装 PyTorch 框架
  • Get the PyTorch Source
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
# if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive
  • Install Dependencies
conda install cmake ninja
# Run this command from the PyTorch directory after cloning the source code using the “Get the PyTorch Source“ section below
pip install -r requirements.txtpip install mkl-static mkl-include
# CUDA only: Add LAPACK support for the GPU if needed
conda install -c pytorch magma-cuda121  # or the magma-cuda* that matches your CUDA version from https://anaconda.org/pytorch/repo# (optional) If using torch.compile with inductor/triton, install the matching version of triton
# Run from the pytorch directory after cloning
# For Intel GPU support, please explicitly `export USE_XPU=1` before running command.
make triton
  • Install PyTorch
export _GLIBCXX_USE_CXX11_ABI=1
# Only run this if you're compiling for ROCm
python tools/amd_build/build_amd.pyexport CMAKE_PREFIX_PATH="${CONDA_PREFIX:-'$(dirname $(which conda))/../'}:${CMAKE_PREFIX_PATH}"
python setup.py develop
2.2 源码编译安装 torch_npu 插件

源码物理机编译

编译安装适用于进行算子适配开发、CANN版本与PyTorch兼容适配场景,PyTorch 2.1.0

  • 安装依赖
apt-get install -y patch build-essential libbz2-dev libreadline-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev liblzma-dev m4 dos2unix libopenblas-dev git 
apt-get install -y gcc==10.2.0 cmake==3.18.0
  • 编译生成torch_npu插件的二进制安装包
# 下载对应PyTorch版本分支代码
git clone -b v2.1.0-6.0.rc3 https://gitee.com/ascend/pytorch.git 
cd pytorch# 编译生成二进制安装包
# 指定Python版本编包方式,以Python3.9为例,其他Python版本请使用--python=3.8、--python3.10或--python3.11
bash ci/build.sh --python=3.9

在编译过程中报错:

在这里插入图片描述

这个报错在v6.0.rc1.alpha002-pytorch2.0.1版本中就存在:

在这里插入图片描述

在 issue 中看到:gcc 版本需要使用10.2.010.5.0 也可

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --config gcc

遇到新的报错:

在这里插入图片描述

看来只能用 docker 了

  • 安装pytorch/dist目录下生成的插件torch_npu包,如果使用非root用户安装,需要在命令后加--user
# 用户根据实际情况更改命令中的torch_npu包名
pip3 install --upgrade 

docker

  • 下载torch_npu源码
git clone https://gitee.com/ascend/pytorch.git -b v2.1.0-6.0.rc3 --depth 1  
  • 构建镜像
cd pytorch/ci/docker/ARM
docker build -t manylinux-builder:v1 .
  • 进入Docker容器,并将torch_npu源代码挂载至容器内
docker run -it -v /home/HwHiAiUser/code/pytorch:/home/HwHiAiUser/code/pytorch manylinux-builder:v1 bash
  • 编译生成二进制安装包
cd /home/HwHiAiUser/code/pytorch 
bash ci/build.sh --python=3.8
  • 在运行环境中安装生成的插件torch_npu包,如果使用非root用户安装,需要在命令后加–user
# 请用户根据实际情况更改命令中的torch_npu包名
pip3 install --upgrade dist/torch_npu-2.1.0.post8-cp39-cp39-linux_aarch64.whl
2.3 验证成功安装

验证是否安装成功,可执行如下命令:

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

显示如下类似信息证明PyTorch框架与插件安装成功:

tensor([[-0.6066,  6.3385,  0.0379,  3.3356],[ 2.9243,  3.3134, -1.5465,  0.1916],[-2.1807,  0.2008, -1.1431,  2.1523]], device='npu:0')
http://www.dtcms.com/wzjs/433558.html

相关文章:

  • 电子商务网站建设商城网站站长推荐入口自动跳转
  • 智能手机网站开发谷歌关键词查询工具
  • 网络推广对产品销售的重要性汕头seo排名收费
  • 自适应网站如何做移动适配线上营销策略
  • 互助网站建设搜索引擎优化自然排名
  • 女孩做网站工作辛苦吗域名服务器查询
  • 网站建设属于哪类税率南昌seo排名扣费
  • 局域网内用自己电脑做网站app香港账号
  • 保山市城乡建设局网站最近新闻
  • 网站建设的基本知识搜索引擎推广排名
  • 营销网站开发渠道有哪些网站营销方案模板
  • 诸暨网站制作微信怎么推广
  • 海宁网站建设朝阳seo
  • 新疆建设职业技术学院校园网站软文广告经典案例分析
  • 泉州网站建设工作室百度浏览器极速版
  • 网站建设开发服务费怎么做分录关键词歌词图片
  • 枣庄市建设项目环评备案网站宁波seo在线优化哪家好
  • 企业贷款河南企业站seo
  • 百度关键词优化专家郑州seo顾问外包公司
  • 域名注册网站推荐推广网
  • 专业做旗袍花的网站是什么网站百度指数的搜索指数代表什么
  • 使用帝国备份王搬迁织梦网站营销型制作网站公司
  • 这么做网站百度客服投诉中心
  • 做视频哪个网站素材好app开发公司推荐
  • 成都网站优化网怎么做公众号
  • 房地产市场营销谷歌seo是什么职业
  • 做化妆品注册和注册的网站吗今天宣布疫情最新消息
  • wordpress post pageseo软件定制
  • 提供经营性网站备案百度导航最新版本
  • 简易企业网站深圳seo网站推广方案