Prentice Hall Science Explorer Reading Graphic Organizer
10 tricks for a better Google Colab experience
Colab is a great tool for coding. I apply information technology very frequently, for a big set up of tasks, from traditional Machine Learning to Deep Learning applications using PyTorch, TensorFlow or OpenCV. With Google Colab, creating and sharing notebooks is intuitive and unproblematic 😃
Here are 10 tips and tricks I gathered over time that will help y'all to get the most out of Google Colab.
Table of content:
- Save time with keyboard shortcuts
- Mountain your Google Drive to Colab
- Run bash commands
- Upload / download files
- Activate GPU and TPU
- Link Colab to GitHub
- Stop Colab from disconnecting
- Display dataframes equally interactive tables
- Apply TensorBoard with Colab
- Modify display mode
1. Salvage TIME WITH KEYBOARD SHORTCUTS
You lot can admission all the shortcuts selecting "Tools" → "Keyboard Shortcuts".
But here is a choice of my top v:
- Disengage final action (inside a jail cell): ctrl + m + z
- Discover and replace: ctrl + k + h
- Insert lawmaking prison cell above: ctrl + thousand + a
- Insert code cell below: ctrl + m + b
- Delete prison cell: ctrl + yard + d
Be certain to cheque out other shortcuts and customize your favourite ones!
2. MOUNT YOUR GOOGLE DRIVE TO COLAB
This feature is useful to get access to files that are stored on your Google Drive. It is also the perfect fashion to save your models and data. To do and then, just enter the post-obit code snippet:
from google.colab import drive
drive.mountain('/content/gdrive')
The cell will return the post-obit:
Click on the link, give Google Colab access to your Drive, and recall the authority lawmaking. Paste it, and you're done!
You are now able to access your Google Drive files under:
/content/gdrive/My Drive/
Employ the batch comand !cd
or the "Files" panel on the left.
3. RUN Bash COMMANDS
Bash commands can be run past prefixing the control with '!'.
Example:
- Download dataset from the spider web with
!wget <ENTER URL>
- Install libraries with
!pip install <LIBRARY>
or!apt-go install <LIBRARY>
- Run an existing .py script with
!python script.py
- Clone a git repository with
!git clone <REPOSITORY URL>
4. UPLOAD / DOWNLOAD FILES
To upload a file (or several) from your computer, run:
from google.colab import files
files.upload()
To download a file, run:
from google.colab import files
files.download('path/to/your/file')
Another style to do this is to utilize the file explorer on the left panel, with drags & drops.
⚠️ Be aware the files will disapear as presently every bit you lot leave Google Colab.
5. Activate GPU AND TPU
The default hardware of Google Colab is CPU. However you lot can enable GPU (and fifty-fifty TPU) support for more computationally enervating tasks similar Deep Learning.
Click on: "Runtime" → "Change runtime type" → "Hardware accelerator". Then select the desired hardware.
You tin can easily cheque if the GPU is enabled by executing the following lawmaking:
import tensorflow as tf
tf.examination.gpu_device_name()
6. LINK COLAB TO GITHUB
Open a GitHub file under Colab:
To open a notebook hosted on GitHub, in that location are 3 options:
- Go to https://colab.research.google.com switch to the GitHub tab and enter the URL of the notebook
- The notebook carries an "Open in Colab" badge, which allows y'all to open it directly on Google Colab.
The markdown code to insert into the README.md file is:
[![Open up In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.enquiry.google.com/github/googlecolab/colabtools/blob/primary/notebooks/colab-github-demo.ipynb)
- Use "Open in Colab" Chrome extension. After installation, whenever you notice a Jupyter notebook in GitHub, click the icon of the plugin and it volition open in Colab.
Salvage a Colab notebook in a GitHub repository:
Follow: "File" → "Save a re-create in GitHub". In one case that is clicked it volition ask for the authorization of your git business relationship. Finally, you will exist able to save the collaboratory notebook into the repository of your choice.
7. Finish COLAB FROM DISCONNECTING
Disconnection due to idleness:
This is a large drawback of Google Colab, and I'yard sure a lot of you lot encountered this issue at least once. You make up one's mind to take a break, but when you're back your notebook is disconnected!
Actually, Google Colab automatically disconnects the notebook if we go out information technology idle for more than thirty minutes. 🕑
Open up your Chrome DevTools by pressing F12 or ctrl+shift+i on Linux and enter the following JavaScript snippet in your console:
office KeepClicking(){
console.log("Clicking");
document.querySelector("colab-connect-button").click()
}
setInterval(KeepClicking,60000)
This function makes a click on the connect-button every sixty seconds. Thus, Colab thinks that the notebook is not idle and you don't have to worry about being asunder!
Disconnection while a task is running:
First, be aware that when you connect to a GPU, you are given a maximum of 12 hours at a time on the Cloud Machine.
Sometimes information technology happens that you're existence asunder, fifty-fifty within this 12-hour time lapse. As explained in Colab's FAQ: "Colaboratory is intended for interactive utilize. Long-running background computations, specially on GPUs, may be stopped." 😕
viii. DISPLAY DATAFRAMES AS INTERACTIVE TABLES
Colab includes an extension that renders pandas dataframes into interactive tables that tin can be filtered, sorted, and explored dynamically.
Enable this extension with %load_ext google.colab.data_table
and disable information technology with %unload_ext google.colab.data_table
9. USE TENSORBOARD WITH COLAB
TensorBoard is a tool for providing the measurements and visualizations needed during a Deep Learning workflow. It tin be used direct inside Colab. 📉 📈
Start by loading the TensorBoard notebook extension:
%load_ext tensorboard
Once your model is created, showtime TensorBoard within the notebook using:
%tensorboard --logdir logs
For more than details, delight bank check the Tensorflow tutorial on that topic.
10. CHANGE Display Way
Dark mode: a lot of people adopt this manner because is more relaxing for their optics. You can activate it following "Tools" → "Settings" → "Theme".
For cats & dogs lovers: yes, in that location is a Kitty and a Corgi style. Get to "Tools" → "Settings" → "Miscellaneous". Here, yous can select the mode, and you will see your cats and dogs strolling on your screen! 😹 🐶
Source: https://towardsdatascience.com/10-tips-for-a-better-google-colab-experience-33f8fe721b82
0 Response to "Prentice Hall Science Explorer Reading Graphic Organizer"
Post a Comment