Google Colab Free GPU Tutorial
6. Changing Working Directory
Normally when you run this code:
!ls
You probably see datalab and drive folders.
Therefore you must add drive/app before defining each filename.
To get rid of this problem, you can simply change the working directory. (In this tutorial I changed to app folder) with this simple code:
import os
os.chdir("drive/app")
After running code above, if you run again
!ls
You would see app folder content and don’t need to add drive/app all the time anymore.
7. “No backend with GPU available
“ Error Solution
If you encounter this error:
Failed to assign a backend
No backend with GPU available. Would you like to use a runtime with no accelerator?
Try again a bit later. A lot of people are kicking the tires on GPUs right now, and this message arises when all GPUs are in use.
8. How to Clear Outputs of All Cells
Follow Tools>>Command Palette>>Clear All Outputs
9. “apt-key output should not be parsed (stdout is not a terminal)” Warning
If you encounter this warning:
Warning: apt-key output should not be parsed (stdout is not a terminal)
That means authentication has already done. You only need to mount Google Drive:
!mkdir -p drive
!google-drive-ocamlfuse drive
10. How to Use Tensorboard with Google Colab?
I recommend this repo:
11. How to Restart Google Colab?
In order to restart (or reset) your virtual machine, simply run:
!kill -9 -1
12. How to Add Form to Google Colab?
In order not to change hyperparameters every time in your code, you can simply add form to Google Colab.
For instance, I added form which contain learning_rate
variable and optimizer
string.
13. How to See Function Arguments?
To see function arguments in TensorFlow, Keras etc, simply add question mark (?) after function name:
Now you can see original documentation without clicking TensorFlow website.
14. How to Send Large Files From Colab To Google Drive?
15. How to Run Tensorboard in Google Colab?
If you want to runt Tensorboard in Google Colab, run the code below.
You can track your Tensorboard logs with created ngrok.io URL. You will find the URL at the end of output.
Note that your Tensorboard logs will be save to tb_logs dir. Of course, you can change the directory name.
After that, we can see the Tensorboard in action! After running the code below, you can track you Tensorboard logs via ngrok URL.
Tensorboard :)
Conclusion
I think Colab will bring a new breath to Deep Learning and AI studies all over the world.
If you found this article helpful, it would mean a lot if you gave it some applause