วิธีติดตั้ง Tensorflow 2.0 GPU ใน Windows 10
บทความนี้เป็นการทดสอบการติดตั้ง Tensorflow 2.0 GPU ใน Windows 10 กับเครื่องคอมพิวเตอร์โน๊ตบุ๊คที่มี Geforce GTX 1050 (Series 10) ติดมาด้วยมาเริ่มกันเลยดีกว่า
ก่อนอื่นสิ่งที่จะต้องดาวน์โหลด และติดตั้งก็คือ
- Anaconda 3.7!
- CUDA 10.1(cuda_10.1.105_418.96_win10.exe)!
- cuDNN Library for Windows 10!
- Visual Studio Community 2017!
ให้ติดตั้ง NVIDA ตาม Tensorflow Guideline พวก Cuda และกำหนด Environment ให้เรียบร้อย โดยเฉพาะ System path แล้วเข้า Anaconda Prompt
ใช้ Anaconda สร้าง Environment ใหม่ กำหนด python 3.5+ ขึ้นไป ในที่นี้ลองกำหนดเป็น python 3.6 ผมตั้งชื่อ Environment ว่า "tf2gpu"
คำสั่ง
conda create -n tf2gpu python=3.6 pip
ซึ่งถ้าไปดูที่ Folder ที่เราติดตั้ง จะพบ Environment ที่เราพึ่งสร้างครับ
(อันนี้ Path เครื่องผม C:\Anaconda3\envs)
ทีนี้เราก็เข้าไปใน Environment ใหม่ที่พึ่งสร้าง (ผมตั้งชื่อไว้คือ "tf2gpu")
คำสั่ง
conda activate tf2gpu
ติดตั้ง tensorflow-gpu==2.0.0-alpha0
คำสั่ง
pip install tensorflow-gpu==2.0.0-alpha0
ติดตั้ง cuDNN cudatoolkit numba
คำสั่ง
conda install cudnn cudatoolkit numba
ติดตั้ง Jupyter Notebook สำหรับทดสอบ
คำสั่ง
conda install -c anaconda jupyter
เสร็จแล้วทดสอบด้วยคำสั่ง
import tensorflow as tf
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
ถ้าเห็น Device ขึ้นเป็น GeForce GTX 1050 แสดงว่าติดตั้งสมบูรณ์แล้ว
สุดท้าย
ถ้าลองเปรียบเทียบกับคำสั่งเดียวกัน ในกรณีที่เรา ติดตั้งแบบปกติ
pip install tensorflow==2.0.0-alpha0
จะประมวลผลจาก CPU จะแสดงผลลัพธ์ดังนี้

หากเนื้อหามีส่วนไหนผิดพลาด รบกวนแจ้งได้ครับ
เขียนโดย ณัฐพงศ์ พันธุศิลป์








Congratulations @ninegolfy! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOPDo not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Congratulations @ninegolfy! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!