2018年3月21日星期三

使用Google免费GPU

初次安装参考https://medium.com/deep-learning-turkey/google-colab-free-gpu-tutorial-e113627b9f5d

1)获得验证码
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!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}

2)挂载Google drive
!mkdir -p drive
!google-drive-ocamlfuse drive

3)设置默认工作文件夹
import os
os.chdir("drive/APP")

4)查看GPU
from tensorflow.python.client import device_lib
device_lib.list_local_devices()







没有评论:

发表评论

Failed to find TIFF library

ImportError: Failed to find TIFF library. Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|.. 解决方法: ...