使用谷歌colab练习深度学习
首先登陆谷歌网盘https://drive.google.com
创建相应文件夹,上传或者创建ipynb文件。右键> More > Colaboratory即可创建。
双击文件,点击上方open with Colaboratory进入colab。
修改python版本及gpu分配在Edit > Notebook settings or Runtime>Change runtime type
添加谷歌网盘依赖并按提示授权
!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}
挂载云盘,这样训练产生的一些文件可以被保存到云盘里
!mkdir -p drive
!google-drive-ocamlfuse drive
其他命令
!wget https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/datasets/Titanic.csv -P drive/app
!pip install -q keras
目前云端配置为
单核志强2.2G
内存13G
显卡k80
参考文章
https://medium.com/deep-learning-turkey/google-colab-free-gpu-tutorial-e113627b9f5d
标签:
colab
ml