[英]How can you use TPU from Google Colab in Tensorflow 2.0?
[英]Can't use GPU on Google Colab for tensorflow 2.0
我正在嘗試在 Google Colab 上使用 GPU 運行我的筆記本,但它沒有為我提供 GPU,但是當我使用 tensorflow 1.15.0 運行筆記本時,GPU 可用。
tf.test.gpu_device_name()
給出 output '/device:GPU:0'
為 tensorflow 1.15.0
但是當我對 tensorflow 2.0.0 執行相同操作時,function 返回''
。
我解決了在 google colab 中安裝的問題
!pip install tensorflow-gpu
和
!pip install tf-nightly
所以現在tf.test.gpu_device_name()
, output 是/device:GPU:0
但是, TensorFlow 自動將其版本191-12升級到2.1.0-dev20191120
嘗試
%tensorflow_version 2.x
import tensorflow as tf
print(tf.__version__)
print(tf.test.gpu_device_name())
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
這是一個與 2.0 相關的錯誤,它與 Colab 上最近的 CUDA 10.1 升級不兼容。
相關的 GitHub 問題是: https://github.com/googlecolab/colabtools/issues/864
根據https://colab.research.google.com/notebooks/gpu.ipynb#scrollTo=oM_8ELnJq_wd
您需要為筆記本啟用 GPU:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.