Pytorch源码安装(附加可能出现的问题解决)

版权声明:要转随便转,如果能加上原文的链接就感谢各位了。( ⊙ o ⊙ ) https://blog.csdn.net/Hungryof/article/details/78187512

源码安装

一般源码安装就用anaconda,诡异的是,一般情况下按照官网的方法:

export CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" # [anaconda root directory]

# Install basic dependencies
conda install numpy pyyaml mkl setuptools cmake gcc cffi

# Add LAPACK support for the GPU
conda install -c soumith magma-cuda80 # or magma-cuda75 if CUDA 7.5

然后git clone一下pytorch源码

git clone --recursive https://github.com/pytorch/pytorch

进入pytorch文件夹,然后直接install

python setup install

大部分情况就搞定了。

问题一

cmake: /xxx/libstdc++.so.6: version 'GLIBCXX_3.4.20' not found (required by cmake) 
cmake: /xxx/libstdc++.so.6: version 'CXXABI_1.3.9' not found (required by cmake)
cmake: /xxx/libstdc++.so.6: version 'GLIBCXX_3.4.21' not found (required by cmake)

解决方法

conda remove cmake gcc
sudo apt-get install cmake gcc

如果编译时卡了

python setup.py clean
python setup.py install

程序问题(与标题无关,需移除)

RuntimeError: cudaEventSynchronize in future::wait: device-side assert triggered

这个问题很诡异。。如果你用的是BCECriterion(),然后你的网络最后一层不是sigmoid,就会出这个错误。因为BCECriterion的期望输入是[0,1]。不加sigmoid很可能会出现输入不满足这个条件,至于为什么会是这个错误,那真不得而知。

猜你喜欢

转载自blog.csdn.net/Hungryof/article/details/78187512
今日推荐