在google中,GPU似乎只适用于python 2。对于python 3,我已经完成了所有的停止,但都徒劳无功。
!apt-get install -y -qq software-properties-common python-software properties module-init-tools (由于某些原因,我无法获得这行代码格式和下面的rest )。
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
from google.colab import auth
auth.authenticate_user()
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}根据这个博客的指示
在运行3和3之后,我通过上面的1和2连接到运行时。
我一直都在
import tensorflow as tf
tf.test.gpu_device_name()
output: ''以及:
from tensorflow.python.client import device_lib
device_lib.list_local_devices()
output:
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 17193406649657173379]有关于如何连接到GPU运行时的帮助吗?
发布于 2018-04-03 14:30:06
当我使用Colaboratory的GPU时,它从未显示在设备列表中。如果您只是运行一个Tensorflow会话,它将自动使用GPU,除非另有说明。
https://stackoverflow.com/questions/49621652
复制相似问题