日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

02_tensorflow2环境安装、CUDA 10.1 和CUDnn 7.6.5 版本安装、https://tensorflow.google.cn/overview中概述翻译

發布時間:2024/9/27 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 02_tensorflow2环境安装、CUDA 10.1 和CUDnn 7.6.5 版本安装、https://tensorflow.google.cn/overview中概述翻译 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、新手入門

1.1 安裝tensorflow環境

1、安裝了Anaconda,進入Anaconda Prompt:

關于安裝Anaconda的博文參考:python安裝、anaconda安裝、pycharm安裝

2、檢測anaconda環境是否安裝成功:conda --version

(base) C:\Users\toto>conda --version conda 4.7.12

3、檢測目前安裝了哪些環境變量:

(base) C:\Users\toto>conda info --envs # conda environments: # base * D:\installed\Anaconda3

4、執行以下命令(下面的可能不需要執行,下面是看網上博文資料得出的):

(base) C:\Users\toto>conda info --envs # conda environments: # base * D:\installed\Anaconda3

5、先看看有哪些tensorflow的版本可以安裝。
在Anaconda Prompt(Anaconda3)中輸入:

pip install tensorflow==3.0

發現會出現如下錯誤:

(base) C:\Users\toto>pip install tensorflow==3.0 ERROR: Could not find a version that satisfies the requirement tensorflow==3.0 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 1.15.3, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.1.1, 2.2.0rc0, 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0) ERROR: No matching distribution found for tensorflow==3.0(base) C:\Users\toto>

出現上面錯誤的原因是,筆者安裝的時候,壓根兒都沒有tensorflow3.0版本的,通過打印出的可選版本,可以知道最高版本是2.2.0

可以通過以下命令安裝tensorflow:

(base) C:\Users\toto>pip install tensorflow==2.2.0 --default-timeout=1000 -i https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: tensorflow==2.2.0 in d:\installed\anaconda3\lib\site-packages (2.2.0) Requirement already satisfied: absl-py>=0.7.0 in d:\installed\anaconda3\lib\site-packages (from tensorflow==2.2.0) (0.9.0) Requirement already satisfied: astunparse==1.6.3 in d:\installed\anaconda3\lib\site-packages (from xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Requirement already satisfied: pyasn1>=0.1.3 in d:\installed\anaconda3\lib\site-packages (from rsa<4.1,>=3.1.4->google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.8) Requirement already satisfied: oauthlib>=3.0.0 in d:\installed\anaconda3\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.1.0) Requirement already satisfied: more-itertools in d:\installed\anaconda3\lib\site-packages (from zipp>=0.5->importlib-metadata; python_version < "3.8"->markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (7.2.0)(base) C:\Users\toto>

6、看tensorflow官網,安裝命令是:

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

如果在上面過程中出現了如下錯誤:

Script file 'D:\Anaconda3\Scripts\pip-script.py' is not present

解決辦法是:

easy_install pip

要注意的是,上面的過程一定要保證網絡比較好,否則資料下載的很慢。

最后執行以下命令:

(base) C:\Users\toto>python Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf 2020-05-25 21:24:40.485797: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2020-05-25 21:24:40.495018: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. >>> tf.__version__ '2.2.0' >>>

發現上面輸出的內容是:2.2.0,也就是tensorflow 2.2.0版本

如果上面的過程還是出現了:HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out 這種問題。解決辦法:
https://blog.csdn.net/chengyq116/article/details/93651619
原因是:

安裝超時

網絡原因導致的安裝超時,重新下載。

設置超時時間延長后重新下載。
下載命令后添加參數 --default-timeout=1000,時間可以自定義。
pip install 默認超時時間是 15s,在安裝的過程中可能會超時。我們在執行命令時,可顯式指定超時時間。

--default-timeout=1000

更換安裝源。
清華大學開源軟件鏡像 https://mirrors.tuna.tsinghua.edu.cn/

https://pypi.tuna.tsinghua.edu.cn/simple sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scipy sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-learn

豆瓣開源鏡像

https://pypi.douban.com/simple sudo pip install -i https://pypi.douban.com/simple scipy sudo pip3 install -i https://pypi.douban.com/simple scikit-learn

下載離線包,使用 pip install ******.whl 安裝。

然后再執行:

pip --default-timeout=1000 install tensorflow==2.2.0 -i https://pypi.tuna.tsinghua.edu.cn/simple (對于tensorflow2.x CPU的和GPU的包都在此中,1.x的cpu的和gpu的包是分開的)

2 CUDA 10.1 和CUDnn 7.6.5 版本安裝

TensorFlow 2.2.0 版本依賴:

Python 3.7:官方下載頁面(3.7.7 版)
CUDA 10.1:官方下載頁面
CUDnn 7.6.5:官方頁面,下載需要注冊一個開發者賬戶

2.1 CUDA下載

(1)、選擇Windows > x86_64 > 10 > exe(local)

(2)、下載后是一個exe文件,讀者自行安裝即可,不要修改其中的路徑信息,完全使用默認路徑安裝即可。
安裝過程會出現(另外網友的安裝方式是:https://www.cnblogs.com/arxive/p/11198420.html):







(3)、接著是下載和安裝對應的cuDNN文件。下載地址為:(https://developer.nvidia.com/rdp/cudnn-archive)
在這個里面,選擇window10相關的。在這個過程中,提示注冊一個用戶,那就按照它的提示進行注冊即可。

最后,下載到的軟件包:

(4)解壓cuDNN,直接將其解壓到CUDA安裝目錄即可。如下圖所示:
即路徑:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1

3 TensorFlow綜述

TensorFlow是一個端到端的開源的機器學習平臺。

TensorFlow可以讓初學者和專家容易的創建機器學習模塊,閱讀下面的章節可以開始學習。

Tutorials
這里面包含了端到端的示例來告訴您如何使用TensorFlow,具體:

guide
Guides中解釋了TensorFlow中的這些概念和組件。

2.1.1 For beginners(初學者)

最好的起點是用戶友好的順序(Sequential)API。您可以通過將構建塊連接在一起來創建模型。運行下面的"Hello World"例子。接著閱讀 tutorials以學習更多。

import tensorflow as tf mnist = tf.keras.datasets.mnist(x_train, y_train),(x_test, y_test) = mnist.load_data() x_train, x_test = x_train / 255.0, x_test / 255.0model = tf.keras.models.Sequential([tf.keras.layers.Flatten(input_shape=(28, 28)),tf.keras.layers.Dense(128, activation='relu'),tf.keras.layers.Dropout(0.2),tf.keras.layers.Dense(10, activation='softmax') ])model.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['accuracy'])model.fit(x_train, y_train, epochs=5) model.evaluate(x_test, y_test)

輸出:

2020-05-26 19:38:16.347823: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2020-05-26 19:38:16.360988: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 2020-05-26 19:38:46.447461: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll 2020-05-26 19:38:48.037471: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1 coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 178.99GiB/s 2020-05-26 19:38:48.044844: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2020-05-26 19:38:48.053003: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found 2020-05-26 19:38:48.060887: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found 2020-05-26 19:38:48.068320: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found 2020-05-26 19:38:48.076245: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found 2020-05-26 19:38:48.083698: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found 2020-05-26 19:38:48.091561: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found 2020-05-26 19:38:48.092104: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... 2020-05-26 19:38:48.155358: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2020-05-26 19:38:48.791458: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x19c132f21d0 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-05-26 19:38:48.792138: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version 2020-05-26 19:38:48.831546: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix: 2020-05-26 19:38:48.831961: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] Epoch 1/5 1875/1875 [==============================] - 3s 2ms/step - loss: 0.2933 - accuracy: 0.9151 Epoch 2/5 1875/1875 [==============================] - 3s 2ms/step - loss: 0.1411 - accuracy: 0.9582 Epoch 3/5 1875/1875 [==============================] - 3s 1ms/step - loss: 0.1038 - accuracy: 0.9685 Epoch 4/5 1875/1875 [==============================] - 3s 2ms/step - loss: 0.0883 - accuracy: 0.9725 Epoch 5/5 1875/1875 [==============================] - 3s 2ms/step - loss: 0.0744 - accuracy: 0.9758 313/313 [==============================] - 0s 1ms/step - loss: 0.0777 - accuracy: 0.9763

2.1.2 For experts (專家)

子類話的API為高級研究提供了一個按運行定義的接口,為您的模型創建一個類,然后命令式地寫向前傳。輕松創建自定義層、激活函數,和訓練循環(training loops)。運行下面的"Hello World"示例。可以通過訪問tutorials學習更多的內容

class MyModel(tf.keras.Model):def __init__(self):super(MyModel, self).__init__()self.conv1 = Conv2D(32, 3, activation='relu')self.flatten = Flatten()self.d1 = Dense(128, activation='relu')self.d2 = Dense(10, activation='softmax')def call(self, x):x = self.conv1(x)x = self.flatten(x)x = self.d1(x)return self.d2(x) model = MyModel()with tf.GradientTape() as tape:logits = model(images)loss_value = loss(logits, labels) grads = tape.gradient(loss_value, model.trainable_variables) optimizer.apply_gradients(zip(grads, model.trainable_variables))

2.1.3 TensorFlow和Keras之間的關系

TensorFlow的高級API基于Keras API標準,用于定義和訓練神經網絡。Keras支持快速原型設計、最先進的研究和生產——所有這些都具有用戶友好的api
Read the Keras Guide for TensorFlow 2

3 常見問題解決

一步一步的探索,以幫助你的項目
初學者的第一個神經網絡程序

專家的生成對抗網絡

專家的神經網絡機器翻譯NMT

4 tensorflow社區

TensorFlow on GitHub

在Stack Overflow上問問題

參與社區討論

打個賞唄,您的支持是我堅持寫好博文的動力

總結

以上是生活随笔為你收集整理的02_tensorflow2环境安装、CUDA 10.1 和CUDnn 7.6.5 版本安装、https://tensorflow.google.cn/overview中概述翻译的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 日本成人小视频 | 狠狠五月婷婷 | 影音先锋中文字幕资源 | 成人福利视频网站 | 日韩中文字幕一区二区三区四区 | 黄色一级一级 | 亚洲欧美另类国产 | 草的我好爽 | 国产一级影片 | 美女黄色小视频 | 五月天激情小说 | 香蕉久久综合 | 天堂在线视频免费 | 亚洲免费高清视频 | 我爱我色成人网 | 黄色av网站在线观看 | 国产精品国产三级国产aⅴ原创 | 九色论坛| 毛片a片免费观看 | 在线观看免费观看 | 日本福利一区二区三区 | 中国女人做爰视频 | 无限资源日本好片 | 欧美 日韩 国产 精品 | 色网网站 | 色七七桃花影院 | 老妇女av | 中文字幕第8页 | 成人亚洲在线 | 99久久99久久精品国产片桃花 | 欧美一级特黄视频 | 久久七 | 成人午夜视频免费在线观看 | 欧美精品一区二区三区久久久竹菊 | 亚洲免费网站在线观看 | 久久中文在线 | 伊人小视频 | 人人射人人干 | 日日干天天操 | 天海翼一二三区 | 欧洲一二三区 | 日韩xx视频 | 午夜一二区 | 果冻传媒18禁免费视频 | 国产精品一区二区无码免费看片 | 国精产品一区二区三区 | 久久激情婷婷 | 精品中文字幕av | 好吊色网站 | 午夜福利123| 男人天堂网在线 | 中文字幕35页 | 91精品国产自产在线观看 | 中文字幕美女 | 视频在线观看电影完整版高清免费 | 国产xxxx在线 | 国产肉体ⅹxxx137大胆 | 久久久国产一区二区 | 日韩福利一区二区三区 | 国产精品成人久久 | 日韩精品xxx | 久久av一区二区 | 久操亚洲 | 潘金莲一级淫片aaaaa | 亚洲第一色在线 | 亚洲三级色 | 丁香激情综合 | 91成人福利 | 欧美天天性影院 | 90岁老太婆乱淫 | 捆绑少妇玩各种sm调教 | 亚洲涩情 | 精品不卡在线 | 成人一区二区三区仙踪林 | 亚洲色图激情小说 | 中文字幕a级片 | 亚洲欧美激情在线 | 超碰香蕉| 日本久久网站 | 亚洲加勒比在线 | 久久久久亚洲视频 | 日本天堂影院 | 欧美性生活网站 | 国产一级高清 | 男女视频免费 | 日韩国产精品一区二区三区 | 91久久综合精品国产丝袜蜜芽 | 中文在线字幕免费观 | 最新免费av | 欧美日韩在线播放视频 | 亚洲精品男人的天堂 | 日韩在线视频播放 | 国产精品久久久久久一区二区三区 | 成人免费视频一区 | 人人看人人爽 | 久久国产精品无码一区二区 | 草久在线 | 96国产在线 | 免费吸乳羞羞网站视频 |