https://d2l.ai/chapter_appendix-tools-for-deep-learning/colab.html
Using a GPU . Using a GPU is as simple as switching the runtime in Colab. Specifically, click Runtime -> Change runtime type -> Hardware Accelerator -> GPU
and your Colab instance will automatically be backed by GPU compute.
from https://cs231n.github.io/setup-instructions/#installing-packages
Some normal operations
Run:
Pause:
Move( move your mouse to top right corner of any cells):
Has run:
Hasn’t run:
Restart(Ctrl+M):
Add code&text (move your mouse to middle of top or bottom edge of existing cells):
Another way (just add a cell below you are running):
Delete:
Find(Ctrl+G):
Switch code to md or reversely
Keyboard shortcuts(Ctrl+M H):
[colab]read img: No such file: solved
git clone whole repo(include /img
):
-
Create a new notebook
- Mount it to your google Drive
- Create a new folder:
name it d2l-en
:
- git clone : reference
%cd drive/My Drive/d2l-en
!git clone https://github.com/d2l-ai/d2l-en-colab.git
!git clone https://github.com/d2l-ai/d2l-pytorch-colab.git
!git clone https://github.com/d2l-ai/d2l-tensorflow-colab.git
The result is
mxnet repo: GitHub - d2l-ai/d2l-en-colab: Automatically Generated Notebooks for Colab
pytorch repo:GitHub - d2l-ai/d2l-pytorch-colab: Automatically Generated Notebooks for Colab
tensorflow repo:GitHub - d2l-ai/d2l-tensorflow-colab: Automatically Generated Notebooks for Colab
Delete a folder:
import shutil
shutil.rmtree('/content/drive/My Drive/d2l-en', ignore_errors=True)
An issue I have: Still can’t open .ipynb file in my drive
read img
mount
run:
from google.colab import drive
drive.mount('/content/drive')
cd drive/My Drive/d2l-en/d2l-en-colab
!ls
!pwd
%cd drive/My Drive/d2l-en
%cd d2l-en-colab
imread
..img
instead of .img
My code: colab or github
It applies to any imread
or ·file control· if you have the matching repo to framework.
@mli, @astonzhang, @goldpiggy
Maybe you can get some help for all colab code to aviod this issue from 1:19:
PyTorch is already installed. Both the CPU and GPU should work: pytorch-latest-cpu
pytorch-latest-gpu
For more details on using PyTorch on Google Cloud, see:
https://cloud.google.com/deep-learning-vm/docs/images
from https://github.com/rmunro/pytorch_active_learning
!pip show d2l