深度学习工程实现框架调研
郝伟 2022/08/11
两个最流行的框架 PyTorch 和 TensorFlow,在阅读了以下文章后:
可以得到初步的结论:
所以作为当前深度学习从研究和人员配置情况来考虑,暂时先使用PyTorch进行相关研究认证,等对深度学习有足够了解后,根据实际项目需求再考虑迁移至 TensorFlow框架上。
需要安装Anaconda https://www.anaconda.com/ (不是必需,但是比较易用)
教程 https://anaconda.cloud/getting-started
安装 CUDA https://blog.csdn.net/m0_45447650/article/details/123704930
需要安装以下两个组件,可以参考:非常详细的安装过程(真的非常详细)
安装指南 https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#introduction
conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch -c conda-forge PS C:\Users\hao> conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch -c conda-forge Collecting package metadata (current_repodata.json): done Solving environment: done ==> WARNING: A newer version of conda exists. <== current version: 4.12.0 latest version: 4.13.0 Please update conda by running $ conda update -n base -c defaults conda WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(143): Could not remove or rename C:\Users\hao\anaconda3\pkgs\pytorch-1.12.1-py3.9_cuda11.3_cudnn8_0.tar.bz2. Please remove this file manually (you may need to reboot to free file handles) ## Package Plan ## environment location: C:\Users\hao\anaconda3 added / updated specs: - cudatoolkit=11.7 - pytorch - torchaudio - torchvision The following packages will be downloaded: package | build ---------------------------|----------------- conda-4.13.0 | py39hcbf5309_1 1.0 MB conda-forge cudatoolkit-11.7.0 | ha6f8bbd_10 965.6 MB conda-forge libuv-1.44.2 | h8ffe710_0 362 KB conda-forge python_abi-3.9 | 2_cp39 4 KB conda-forge pytorch-1.12.1 | py3.9_cpu_0 133.6 MB pytorch pytorch-mutex-1.0 | cpu 3 KB pytorch torchaudio-0.12.1 | py39_cpu 3.5 MB pytorch torchvision-0.13.1 | py39_cpu 6.2 MB pytorch ------------------------------------------------------------ Total: 1.08 GB The following NEW packages will be INSTALLED: cudatoolkit conda-forge/win-64::cudatoolkit-11.7.0-ha6f8bbd_10 libuv conda-forge/win-64::libuv-1.44.2-h8ffe710_0 python_abi conda-forge/win-64::python_abi-3.9-2_cp39 pytorch pytorch/win-64::pytorch-1.12.1-py3.9_cpu_0 pytorch-mutex pytorch/noarch::pytorch-mutex-1.0-cpu torchaudio pytorch/win-64::torchaudio-0.12.1-py39_cpu torchvision pytorch/win-64::torchvision-0.13.1-py39_cpu The following packages will be UPDATED: conda pkgs/main::conda-4.12.0-py39haa95532_0 --> conda-forge::conda-4.13.0-py39hcbf5309_1 Proceed ([y]/n)? y Downloading and Extracting Packages torchaudio-0.12.1 | 3.5 MB | ############################################################################ | 100% pytorch-mutex-1.0 | 3 KB | ############################################################################ | 100% python_abi-3.9 | 4 KB | ############################################################################ | 100% libuv-1.44.2 | 362 KB | ############################################################################ | 100% conda-4.13.0 | 1.0 MB | ############################################################################ | 100% cudatoolkit-11.7.0 | 965.6 MB | ###### cudatoolkit-11.7.0 | 965.6 MB | ###### cudatoolkit- 8% cudatoolkit-11.7.0 | 965.6 MB | ########
https://pytorch.org/tutorials/
创建NVidia账号: hwaust@hotmail.com, me2022 (创建过程还需要填写资料和调研,好麻烦)
PS C:\Users\hao> nvidia-smi
Wed Aug 10 12:23:15 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 511.81 Driver Version: 511.81 CUDA Version: 11.6 |
|-------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... WDDM | 00000000:01:00.0 On | N/A |
| N/A 44C P8 14W / N/A | 2280MiB / 6144MiB | 3% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1820 C+G N/A |
| 0 N/A N/A 1904 C+G ...ekyb3d8bbwe\YourPhone.exe N/A |
| 0 N/A N/A 3020 C+G ...m\XMP\Program\APlayer.exe N/A |
| 0 N/A N/A 13052 C+G C:\Windows\explorer.exe N/A |
| 0 N/A N/A 13460 C+G ...icrosoft VS Code\Code.exe N/A |
| 0 N/A N/A 14840 C+G ...bbwe\Microsoft.Photos.exe N/A |
| 0 N/A N/A 17136 C+G ...8bbwe\WindowsTerminal.exe N/A |
| 0 N/A N/A 19276 C+G ...cal\Feishu\app\Feishu.exe N/A |
| 0 N/A N/A 22280 C+G ...n1h2txyewy\SearchHost.exe N/A |
| 0 N/A N/A 26252 C+G ...y\ShellExperienceHost.exe N/A |
| 0 N/A N/A 27680 C+G ...293.47\msedgewebview2.exe N/A |
| 0 N/A N/A 28792 C+G ...cw5n1h2txyewy\LockApp.exe N/A |
| 0 N/A N/A 30728 C+G ...in7x64\steamwebhelper.exe N/A |
| 0 N/A N/A 35032 C+G ...2txyewy\TextInputHost.exe N/A |
| 0 N/A N/A 37956 C+G ...tracted\WechatBrowser.exe N/A |
| 0 N/A N/A 40208 C+G ...ge\Application\msedge.exe N/A |
| 0 N/A N/A 45860 C+G ...artMenuExperienceHost.exe N/A |
| 0 N/A N/A 46828 C+G ...al\Programs\Veee\Veee.exe N/A |
| 0 N/A N/A 53808 C+G ...d\runtime\WeChatAppEx.exe N/A |
| 0 N/A N/A 54168 C+G ...n\Application\Maxthon.exe N/A |
| 0 N/A N/A 58744 C+G ...lPanel\SystemSettings.exe N/A |
+-----------------------------------------------------------------------------+
PS C:\Users\hao>
PS C:\Users\hao> conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch -c conda-forge Collecting package metadata (current_repodata.json): failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/pytorch/win-64/current_repodata.json> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. 'https://conda.anaconda.org/pytorch/win-64'
PS C:\Users\hao> conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch -c conda-forge
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\hao\anaconda3
added / updated specs:
- cudatoolkit=11.7
- pytorch
- torchaudio
- torchvision
The following packages will be downloaded:
package | build
---------------------------|-----------------
pytorch-1.12.1 | py3.9_cpu_0 133.6 MB pytorch
torchvision-0.13.1 | py39_cpu 6.2 MB pytorch
"By downloading and using the CUDA Toolkit conda packages, you accept the terms and conditions of the CUDA End User License Agreement (EULA): https://docs.nvidia.com/cuda/eula/index.html"
done
PS C:\Users\hao>