0

I am using Google Colab and I would like to use my custom libraries / scripts, that I have stored on my local machine. My current approach is the following:

# (Question 1)
from google.colab import drive
drive.mount("/content/gdrive")

# Annoying chain of granting access to Google Colab
# and entering the OAuth token.

And then I use:

# (Question 2)
!cp /content/gdrive/My\ Drive/awesome-project/*.py .

Question 1: Is there a way to avoid the mounting of the drive entriely? Whenever the execution context changes (e.g. when I select "Hardware Acceleration = GPU", or when I wait an hour), I have to re-generate and re-enter the OAuth token.

Question 2: Is there a way to sync files between my local machine and my Google Colab scripts more elegently?

Partial (not very satisfying answer) regarding Question 1: I saw that one could install and use Dropbox. Then you can hardcode the API Key into the application and mounting is done, regardless of whether or not it is a new execution context. I wonder if a similar approach exists based on Google Drive as well.

r0f1
  • 1,533
  • 1
  • 19
  • 31

1 Answers1

1

If your code isn't secret, you can use git to sync your local codes to github. Then, git clone to Colab with no need for any authentication.

korakot
  • 24,489
  • 13
  • 84
  • 114