这篇文章主要介绍“jetson nx配置pytorch的问题如何解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“jetson nx配置pytorch的问题如何解决”文章能帮助大家解决问题。
jetson nx 配置pytorch
环境情况: 系统jetpack 5.0.2 --ubuntu20.04 配置流程 安装miniconda(流程省略)conda create -n pytorch python=3.8 安装pytorch
sudo apt-get -y update;
sudo apt-get -y install autoconf bc build-essential g -8 gcc-8 clang-8 lld-8 gettext-base gfortran-8 iputils-ping libbz2-dev libc -dev libcgal-dev libffi-dev libfreetype6-dev libhdf5-dev libjpeg-dev liblzma-dev libncurses5-dev libncursesw5-dev libpng-dev libreadline-dev libssl-dev libsqlite3-dev libxml2-dev libxslt-dev locales moreutils openssl python-openssl rsync scons python3-pip libopenblas-dev;
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
conda activate pytorch
pip3 install cython
添加环境变量
export path=/usr/local/cuda/bin:$path
export ld_library_path=/usr/local/cuda/lib64:$ld_library_path
export cuda_root=/usr/local/cuda
export torch_install=https://developer.download.nvidia.cn/compute/redist/jp/v51/pytorch/torch-1.14.0a0 44dac51c.nv23.02-cp38-cp38-linux_aarch74.whl
python3 -m pip install --upgrade pip; python3 -m pip install aiohttp numpy=='1.19.4' scipy=='1.5.3'; python3 -m pip install --upgrade protobuf; python3 -m pip install --no-cache $torch_install
torchvision pip install torchvision
测试结果
>>> import torch >>> print(torch.__version__) >>> print('cuda available: ' str(torch.cuda.is_available())) >>> print('cudnn version: ' str(torch.backends.cudnn.version())) >>> a = torch.cuda.floattensor(2).zero_() >>> print('tensor a = ' str(a)) >>> b = torch.randn(2).cuda() >>> print('tensor b = ' str(b)) >>> c = a b >>> print('tensor c = ' str(c)) >>> import torchvision >>> print(torchvision.__version__)
配合repvgg的部署 pip install opencv-contrib-python
pip install matplotlib
pip install torchvision
其他问题
报错:
importerror: cannot import name ‘pillow_version’ from ‘pil’ (/home/jiajie/anaconda3/envs/py35/lib/python3.7/site-packages/pil/init.py)
解决:pip index versions pillow
or conda search pillow
pip3 install pillow==6.2.0
警告:
userwarning: failed to load image python extension:
warn(f"failed to load image python extension: {e}")
解决:
没解决,据说是pytorch版本太高,或者是pytorch与torchvision版本不契合
pytorch版本与jetpack的选择
安装pytorch 中第7步,不同版本的jetpack需要根据情况修改版本,
https://developer.download.nvidia.com/compute/redist/jp
选择指定的版本以后复制网页url后替换第7步
关于“jetson nx配置pytorch的问题如何解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注本站行业资讯频道,小编每天都会为大家更新不同的知识点。