Google Colab教程

参考Github仓库
Colab is a Google’s free cloud service which will let you run your deep learning or machine learning models in cloud.

Creating New Colab Notebook

  • open your Google Drive
  • create a new notebook via Right click -> More
    ->Colaboratory

In mainland china, you may need to using proxy:

Brook Tools :
Cofigeration:
Server IP :
Server Port:
Server Pwd:
Server Protocol: Brook
File Dir: manual select Brook.exe dir
And then click run:
Test:
SOCKS5 :127.0.0.1:1080

GPU Setting:

Edit ->Notebook settings or Runtime -> Change runtime type and select GPU as Hardware accelerator

RAM Info

!cat /proc/meminfo

CPU Info

!cat /proc/cpuinfo

Install Libraries

# !pip install or !apt-get install

!pip3 install tensorflow [==1.8]
!pip3 install keras
!pip3 install torch [ torchvision]
!apt-get install python-numpy python-scipy

Pip3 and pip distinctions

Using ‘pip3’ means install package for python 3.x
Or you can using ‘pip’ to install package for python 2.x
downloading lib dir : python3.x/site-packages or python2.x/site-packages

When python3 or python somefile.py, you can only using python3.x or python 2.x packages, so as to avoid lib conflicts.

Play in Kaggle

In Jupyter Notebook or Google Colab, we can using Kaggle API make submittions on Kaggle competions
Notices: ONLY for kaggle API version > 1.5.0 and ONLY support Python 3.

!pip install kaggle --upgrade

Kaggle-API

Cloning Github Repo to Google Colab

!git clone https://github.com/xxxrepos

Mount your Google Drive

from google.colab import drive
drive.mount('/content/drive/')

Check your Folder Data

!ls Drive/test

Upload code from your system

from google.colab import files
uploaded = files.upload()

Make zip file of your Data

from google.colab import files
import zipfile
import sys
foldername = 'your folder or filename'
zipfile.ZipFile('Drive/'+foldername +'.zip', 'w', zipfile.ZIP_DEFLATED)

Downloading the data from the colab

from google.colab import files
files.download('Drive/test.zip')

Summary

个人总结一下,其实在Google Colab 的诸多操作就是Linux 命令,它使用编辑器的就是Jupyter Notebook,不熟悉JN的同学希望每行都练一练以及多熟悉熟悉Linux命令行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值