Fastai-V3-GCP(Google Cloud Platform) 配置筆記

來源:簡書
作者:adi0229
時(shí)間:2020-06-17
2625
在Google Cloud Platform谷歌云上配置完成之后,咱們就擁有交互式編程筆記「JupyterNotebook」環(huán)境,配有GPU硬件圖形加速器,以調(diào)動(dòng)充分的「算力」,來學(xué)習(xí)fast.ai的深度學(xué)習(xí)(煉丹)技術(shù)。

1592376863(1).png

在Google Cloud Platform谷歌云上配置完成之后,咱們就擁有交互式編程筆記「JupyterNotebook」環(huán)境,配有GPU硬件圖形加速器,以調(diào)動(dòng)充分的「算力」,來學(xué)習(xí)fast.ai的深度學(xué)習(xí)(煉丹)技術(shù)。

傳送門:fastai官方GCP服務(wù)配置教程https://course.fast.ai/start_gcp.html

07.09更新:國內(nèi)朋友可以試試->易學(xué)智能https://course.fast.ai/start_easyaiforum.html

步驟1:創(chuàng)建你的賬戶

前往官網(wǎng)https://cloud.google.com/,創(chuàng)建新賬戶。

價(jià)格與性能

·潛在的坑:盡管有300美元的初始額度,但我們需要開啟賬單(Billing)功能,綁定信用卡或借記卡,等候幾個(gè)工作日之后激活它。

Potential roadblock:Even though GCP provides a$300 initial credit,you must enable billing to use it.You can put a credit card or a bank account but the latter will take several days for the activation.

·比如,結(jié)算的坑:你在GoogleClound里運(yùn)行虛擬鏡像的項(xiàng)目,需要連接至你的賬單賬號(hào)。導(dǎo)航到billing dashboard,點(diǎn)擊「...」菜單,選擇「更改賬單賬號(hào)」。

The project on which you are going to run the image needs to be linked with your billing account.For this navigate to the billing dashboard,click the‘…’menu and choose‘change billing account’.

步驟2:安裝Google命令行工具

筆者使用的是macOS系統(tǒng),進(jìn)行了如下操作命令:

1592377028(1).png

與報(bào)錯(cuò)不期而遇:連接Google的SDK服務(wù)失敗,端口443,操作超時(shí)

1592377170(1).png

查看官網(wǎng)文檔

https://cloud.google.com/sdk/docs/quickstart-macos

在準(zhǔn)備工作中的第二條,赫然寫著

確保您的系統(tǒng)上安裝了Python 2.7:

python-V

1592377196(1).png

1592377245(1).png

系統(tǒng)反饋,我當(dāng)前使用的是Python3.6.8版本使用pyenv模塊,創(chuàng)建一個(gè)python2.7.x的虛擬環(huán)境?

警告:Python2.7要在2020年1月時(shí)被“廢黜”。

1592377269(1).png

1592377294(1).png

1592377321(1).png

激活所創(chuàng)建的虛擬環(huán)境

1592377382(1).png

1592377413(1).png

提示是否繼續(xù)時(shí),輸入y

https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&response_type=code&client_id=32555940559.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&access_type=offline

這時(shí),瀏覽器會(huì)自動(dòng)打開授權(quán)頁面,請授權(quán)你的谷歌云平臺(tái)賬號(hào)。

452087-a2788523a39908a5.jpg

452087-b811896795b62ac2.jpg

452087-574aafb20baec52c.jpg

1592377570(1).png

Project IDs must be 6-30 characters(lowercase ASCII,digits,or

hyphens)in length and start with a lowercase letter.fastai

WARNING:Project creation failed:HttpError accessing<https://cloudresourcemanager.googleapis.com/v1/projects?alt=json>:response:<{'status':'409','content-length':'119','x-xss-protection':'1;mode=block','x-content-type-options':'nosniff','transfer-encoding':'chunked','vary':'Origin,X-Origin,Referer','server':'ESF','-content-encoding':'gzip','cache-control':'private','date':'Sun,27 Jan 2019 16:39:11 GMT','x-frame-options':'SAMEORIGIN','alt-svc':'quic=":443";ma=2592000;v="44,43,39"','content-type':'application/json;charset=UTF-8'}>,content<{

    "error":{

       "code":409,

       "message":"Requested entity already exists",

       "status":"ALREADY_EXISTS"

    }

}

>

Please make sure to create the project [fastai] using

       $gcloud projects create fastai

or change to another project using

       $gcloud config set project<PROJECT ID>

1592377607(1).png

https://cloud.google.com/compute/docs/gcloud-compute

至此,谷歌云GCP的SDK配置完畢。

步驟3:創(chuàng)建一個(gè)實(shí)例(Instance)

輸入各種配置指令,比如「IMAGE_FAMILY(鏡像組合)」->"pytorch-latest-gpu",「ZONE」->"us-west1-b"等等。最新操作步驟,請移步查閱https://course.fast.ai/start_gcp.html

1592377655(1).png

Enabling service compute.googleapis.com on project 191131005934...

ERROR:(gcloud.compute.instances.create)FAILED_PRECONDITION:Operation does not satisfy the following requirements:billing-enabled{Billing must be enabled for activation of service''in project'fastai-v3-229916'to proceed.,https://console.developers.google.com/project/fastai-v3-229916/settings}

設(shè)置了結(jié)算賬戶之后,

1592377701(1).png

452087-b076b92ce04eb721.jpg

image.png

452087-79580e4227586702.jpg

452087-f45eabd43e66bd33.jpg

452087-977d3bb5a96ef199.jpg

image.png

步驟3:創(chuàng)建你的示例

452087-cc8a381e7cf98d6c.jpg

再次輸入CLI命令行代碼,創(chuàng)建示例

1592377791(1).png

功夫不負(fù)有心人,創(chuàng)建成功。

1592377855(1).png

452087-977d3bb5a96ef199.jpg

1592377891(1).png

一大串的命令行英文,非常嚇人。

1592377929(1).png

1592377950(1).png

查看GPU,型號(hào)是:Tesla P4

1592377980(1).png

步驟4:接入fast.ai材料,更新工具包

1592378005(1).png

1592378246(1).png

1592378269(1).png

1592378305(1).png

回到控制臺(tái),

452087-18df5a0a3866732d.jpg


452087-03b7032f6edf7ca5.jpg


452087-8cb1d31ca44a15f6.jpg

adi0229(adi0229)~

$pyenv activate google-cli

pyenv-virtualenv:prompt changing will be removed from future release.configure`export PYENV_VIRTUALENV_DISABLE_PROMPT=1'to simulate the behavior.

(google-cli)adi0229(adi0229)~

步驟5:停止實(shí)例運(yùn)行

452087-4e2007a1f888fa4d.jpg

參考資料

https://www.jianshu.com/p/7d720393fea3

https://course.fast.ai/update_gcp.html

https://course.fast.ai/start_gcp.html

立即登錄,閱讀全文
原文鏈接:點(diǎn)擊前往 >
版權(quán)說明:本文內(nèi)容來自于簡書,本站不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。文章內(nèi)容系作者個(gè)人觀點(diǎn),不代表快出海對(duì)觀點(diǎn)贊同或支持。如有侵權(quán),請聯(lián)系管理員(zzx@kchuhai.com)刪除!
優(yōu)質(zhì)服務(wù)商推薦
更多
掃碼登錄
打開掃一掃, 關(guān)注公眾號(hào)后即可登錄/注冊
加載中
二維碼已失效 請重試
刷新
賬號(hào)登錄/注冊
小程序
快出海小程序
公眾號(hào)
快出海公眾號(hào)
商務(wù)合作
商務(wù)合作
投稿采訪
投稿采訪
出海管家
出海管家