[FreeGPU]colab用法详解 妈妈再也不用担心我们买不起显卡租不起服务器啦

colaboratory = Jupyter + GPU

Following these steps, you are able to enjoy GPU service for FREE.

1. Register a google account

2. Login to Google Drive

3. New folder(take a name whether you like) 


4. Right-click the folder-Open with-Connect more apps  



5. find "Colaboratory" and connect

6. create ipynb under the new folder


7. Edit-Notebook settings

 

(This style really recalls jupyter, but jupyter don't have a GPU...)

8. select GPU


Tips: Remember these steps. Each time you establish a new py file, you need to set the GPU again.

9. Test GPU?

 

Further, I am curious about which type of GPU google offered.


Tesla K80 ON Amazon-$2800.


10. Now you can enjoy a $2800-GPU for FREE.

Tips: As you know, you need to pip/conda many computation packages.

11. Authorized to use these packages.

run these codes in colab:

!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}
click the link and get the verification code.


now access successfully


Next part is my personal demands. If any question, you can turn help to StackOverflow-google-colaboratory

12. Install Xgboost to compete with kaggle players. 

!pip install -q xgboost==0.4a30 (this is a lower edition)
!apt-get -qq install -y graphviz && pip install -q pydot

Xgboost works perfectly

13. Install pytorch package.(I think the kernel is tensorflow)

!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.3.0.post4-{platform}-linux_x86_64.whl torchvision

Test the famous dataset-mnist.


I meet some File Path problem.In colab, we'd better use the GetFullPath like "drive/foldername/filename".

14. We easily get access to Stack Overflow to modify our codes.


15.Through these installs, apparently, the packages are stored in our google cloud. Files the same as packages are saved to the cloud. So we just need a computer to transfer these files to cloud and put down our codes on colab.Then, colab help to read the data and use 2800$-GPU to run our neural network program.

I am a newcomer to colab. Now pycharm seems out of date compared with colab. Especially, when we are not easy to get a GPU. And why not share this ide with our friends? There remain many great usages in this fantastic plug-in unit. If there are any errors, please correct me.

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值