深度學習Tensorflow環境配置

基於TensorFlow深度學習的環境需求如下
1、Python

(略)

2、Anaconda

(略)

3、CUDA NVIDIA GPU computing toolkit
https://developer.nvidia.com/cuda-toolkit-archive

4、cuDNN 神經網絡加速庫(要與CUDA版本匹配)
https://developer.nvidia.com/rdp/cudnn-download

注:cuDNN需進行環境變量等配置,請參考其他文檔

5、numpy庫

pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple

注:使用pip安裝出現超時的情況,請更換下載源,如豆瓣等。

6、TensorFlow GPU版

pip install -U tensorflow-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple

注:CUDA,cuDNN,TensorFlow GPU等,可通過Anaconda命令自動安裝,請查詢其他文檔

7、常用Python庫

pip install -U ipython numpy matplotlib pillow pandas -i https://pypi.tuna.tsinghua.edu.cn/simple

8(可選)、TensorFlow運行顯存佔用模式設置,避免顯存大量浪費:***(注意縮進)***

gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
	try:# 設置 GPU 爲增長式佔用
		for gpu in gpus:
			tf.config.experimental.set_memory_growth(gpu, True)
		print('succeed')
	except RuntimeError as e:
		# 打印異常
		print(e)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章