I am coding Neural Network models and trainings are long to run so I would like to go doing something else then go back as soon as the cell has finished running.
There is already a way to track this since the Tab Icon is grey when busy then yellow when done. But I can't find something abut audio notifications.
4. Get Notified of completed cell executions. Colab can notify you of completed executions even if you switch to another tab, window, or application. You can enable it via Tools → Settings → Site → Show desktop notifications (and allow browser notifications once prompted) to check it out.
Unfortunately, Colab is not short for Collaboration. Colab notebooks can be shared with other users and opened by multiple users at a time. If one person makes a change, the others will be able to see the change after a short delay.
I'm sorry then You'd think so, but this is often not the case. Also, the greater point is share what you've done so people who want to help don't have to redo what you did. Adding an audio notification when a cell completes is a two-liner. For example,
10 tricks for a better Google Colab experience. Undo last action (inside a cell): ctrl + m + z. Find and replace: ctrl + m + h. Insert code cell above: ctrl + m + a. Insert code cell below: ctrl + m + b. Delete cell: ctrl + m + d.
You can also download the audio file to your Google Colab file system with !wget URL and then play the sound from Colab by using the local filename. For some reason, it neither works when Colab is in background or when I switch to another tab in the same window.
I had found some ways get notified at some target lines in the notebook, say after training is completed. One is the colab browser notification feature, can be checked to true in settings. Other one is an audio solution, you just add these 2 lines of code found here to get an alarm when the code executes at any line in a cell.
Adding an audio notification when a cell completes is a two-liner. For example,
# Play an audio beep. Any audio URL will do.
from google.colab import output
output.eval_js('new Audio("https://upload.wikimedia.org/wikipedia/commons/0/05/Beep-09.ogg").play()')
Here's an example notebook: https://colab.research.google.com/drive/1jrEy5V7FjzAq8Ydg22E1L72xZYsEQWlM
Edit: Colab now includes a setting that will deliver a browser notification when execution completes in the background. You can enable it in the settings like so:
The announcement is here: https://twitter.com/GoogleColab/status/1291775273692614659
Google Colab is built on top of Jupyter Notebook, so this code will work:
import IPython
display(IPython.display.Audio(url="https://yoursound.com/sound.mp3", autoplay=True))
A bug that I've found is that if my web browser (Chrome) window is minimized into the dock on my Mac OS computer, the sound does not play. However, it will play in other circumstances, such as when the window is open but not in the foreground.
You can find useful audio of English words like "done" or "complete" for alerts. Use an online dictionary that has audible pronunciations (e.g. Google or Dictionary.com), search for the word you want, use your web browser's "Inspect" tool to look at the HTML source, and then search in the HTML for "mp3".
Here are some that I like:
https://static.sfdict.com/audio/C07/C0702600.mp3
https://ssl.gstatic.com/dictionary/static/pronunciation/2019-10-21/audio/do/done_en_us_1.mp3
https://ssl.gstatic.com/dictionary/static/sounds/20180430/complete--_us_1.mp3
You can also download the audio file to your Google Colab file system with !wget URL
and then play the sound from Colab by using the local filename.
I created a python module that reminds developers on Telegram application after code execution. I guess, you can also run it in Colab. It might be more helpful than making sound. All you need is carrying your mobile phone.
Pypi link: https://pypi.org/project/devreminder/
Github link: https://github.com/cagataygulten/devreminder
Example:
In [1]>>
from devreminder import DevReminder
import time
In [2]>>
remind = DevReminder(1932126911,False,0)
In [3]>>
remind.me("Example")
time.sleep(6)
Output:
Please follow README file for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With