Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colab - automatic authentication of connection to google drive, persistent per-notebook

I'm looking for a way to automate the authentication process when connecting a colab-session to my google drive.

I'd prefer to use the built-in tools for this one, instead of PyDrive.

In short: have the following cell run without having to manually authenticate by logging in and copying the password from the dialogue

from google.colab import drive
drive.mount('/content/drive/')
like image 820
Marius Brataas Avatar asked Oct 15 '18 00:10

Marius Brataas


People also ask

How do I permanently mount a drive in Google Colab?

Automatically mounting to your Drive files is now supported for Colab notebooks which aren't shared by multiple people. To enable this for a notebook, create a new Drive notebook, open the file browser, and click the 'Mount Drive' button.

What are the disadvantages of Google Colab?

Limited Space & Time: The Google Colab platform stores files in Google Drive with a free space of 15GB; however, working on bigger datasets requires more space, making it difficult to execute. This, in turn, can hold most of the complex functions to execute.

How long can I use Google colab GPU?

Colab Pro and Pro+ limit sessions to 24 hours.


Video Answer


1 Answers

Automatically mounting to your Drive files is now supported for Colab notebooks which aren't shared by multiple people.

To enable this for a notebook, create a new Drive notebook, open the file browser, and click the 'Mount Drive' button.

enter image description here

You'll see a permissions dialog like so:

enter image description here

After you complete the permissions once, you'll see your Drive mounted in the file browser.

enter image description here

Better still, if you reload the notebook later and reconnect, your Drive will mount automatically with no more drive.mount copy/paste required. Your Drive files will just be there.

like image 140
Bob Smith Avatar answered Oct 18 '22 01:10

Bob Smith