- 登錄GoogleDriver(需要科學上網)
- 新建colaboratory
設置爲gpu版本
3.連接Google drive
首先在單元格中輸入並執行以下命令:
!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
輸入ls命令,若drive文件夾已列出則說明連接成功
4.訓練神經網絡
在GitHub上獲取源碼
運行代碼
- 服務器一次性只能使用12h
- cola可以直接執行python命令,而bash命令則要在之前加個感嘆號“!”