Compare TensorFlow and pytorch:
PyTorch is more suitable for rapid prototyping in research, hobbyists, and small projects, while TensorFlow is more suitable for large-scale scheduling, especially when considering cross-platform and embedded scheduling operations.
This article installs three mainstream deep learning frameworks.
The own system is Windows7, available for personal testing
Installation link reference:
https://blog.csdn.net/colourful_sky/article/details/78524382
Please follow the above link to install, the problems and solutions are as follows, the installation has been successful:
1. Open a command prompt:
win+R, enter cmd
2. Compile the CUDA sample program
Reference link:
https://mp.weixin.qq.com/s?__biz=MzI4MzgwMzQ1MQ%3D%3D&chksm=eb846bc6dcf3e2d0e60635c9b272a64af882d6eee82091793a9f060a0b46475335dce4b78edc&idx=1&mid=2247483794&scene=21&sn=5a7eb0d88a6b4a862a031e9e48049ce4
3. Update pip:
python -m pip install --upgrade pip
4.tensorflow Could not find 'cudart64_90.dll'
This problem is caused by the inconsistency of the current version of TensorFlow and cuda, which may be too high or low.
You can download TensorFlow 1.4 to run:
pip3 install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.4.0-cp35-cp35m-win_amd64.whl
5. Install pytorch after doing all the sections in the article:
Reference: https://zhuanlan.zhihu.com/p/26871672
conda install -c peterjc123 pytorch cuda80
6. Every time you start Spyder, you need to activate the TensorFlow environment:
activate tensorflow-gpu
Enter Spyder in this environment.
Use the following code to return to the root environment when not in use:
deactivate
Appendices can be ignored:
The library may be missing when running the super-resolution reconstruction code, and the following error will occur, which can be installed in advance here. The following installations are required to activate the TensorFlow virtual environment:
1.ImportError: No module named PIL error
pip install Pillow
2.ImportError: No module named 'matplotlib'
pip install matplotlib
3.ImportError: No module named 'torchnet'
install git,
conda install git
首先得Make sure you have PyTorch installed, then do:
pip install git+https://github.com/pytorch/tnt.git@master
It should be ok, update:
pip install --upgrade git+https://github.com/pytorch/tnt.git@master
4.ImportError: No module named 'torchvision'
pip install torchvision
5. Progress bar:
pip install tqdm
6. visdom visualization tool installation
pip install visdom
start the server
Start the server (probably in screen
or tmux
in):
python -m visdom.server
It can now be accessed by visiting http://localhost:8097
or 127.0.0.1:8097
browser Visdom
, or specifying your own host address.
7. Before opening Spyder in the TensorFlow environment, a dialog box that cannot be started always pops up:
Solution:
After activating the TensorFlow virtual environment, use pip uninstall spyder or conda uninstall spyder to uninstall, then be sure to delete the corresponding virtual environment C:\Users\Users\Anaconda3\envs\tensorflow-gpu\Lib\site-packages Various files of Spyder, pip install spyder for reinstallation. It is successful to run here.
In the future, you need to do this regardless of uninstalling the TensorFlow virtual environment.