1 Configuration Issues
(1). For computers equipped with a GPU and a need for deep learning, set up a usable and clean deep learning environment.
(2). Configure with Anaconda3 + CUDA10.0 + CuDNN + Pytorch1.2 + Pycharm.
(3). Resolve the issue of not being able to use the torchvision library in Pytorch.
2 Setup Process
(1). Install Anaconda. Download according to your computer’s requirements, extract the installation package, and follow the instructions step by step to complete the installation. Verify if the installation is successful and create a virtual environment for future configuration.
# Create virtual environment: (enter in cmd terminal) conda create -n Pytorch_GPU python=3.7& |
(2). Install CUDA10.0 and cuDNN (must correspond to your Pytorch==1.2.0 version).
-
. Find the suitable version on the official website for download and installation.
-
. Find the installation location and extract cuDNN.
(3). Install Pytorch.
-
. Activate and enter the virtual environment prepared in Anaconda.
activate Pytorch_GPU
2). Download and install Pytorch. Open the Pytorch official website at: https://pytorch.org/.
You can also download the wheel (https://download.pytorch.org/whl/torch_stable.html).
(4) Connect Pycharm with Anaconda.
-
. Set the relevant environment; there are many tutorials available online.
-
. Verify that Pytorch is configured successfully.
(5). Issue with torchvision.
When importing torchvision, an error occurred, but it was found that the torchvision package is in the library.
Found the solution online.
Locate the error path C:\Users\Public\Anaconda3\Lib\site-packages\PIL, open the __init__.py file, and replace the line from PIL import Image, ImageOps, ImageEnhance,PILLOW_VERSION with from PIL import Image, ImageOps, ImageEnhance, __version__.
3 Conclusion
1. Pay attention to the compatibility issues between various software versions.
2. The latest version of CUDA no longer requires configuring Cudnn for acceleration.
3. For the missing module issue when importing torchvision, changing the import module name in __init__.py file will resolve it.