I am using google-colaboratory GPU to train NN models. My python/pytorch code is stored in google-drive. I am able to mount my drive in colaboratory and train models. But any python code changes in the "my drive" is not updated to google-colaboratory even after rebooting my PC and start all again.
To clear the google-colaboratory cache I tried :
!google-drive-ocamlfuse -cc
But it does not work:
/bin/bash: google-drive-ocamlfuse: command not found
How to clean this cache and avoid waiting hours before my code being taken into account by google-colaboratory ? Thanks in advance
PS : the method I used to mount:
from google.colab import drive
drive.mount('/content/drive/')
Since a Colab notebook is hosted on Google's cloud servers, there's no direct access to files on your local drive (unlike a notebook hosted on your machine) or any other environment by default. However, Colab provides various options to connect to almost any data source you can imagine.
Once you have completed verification, go to the CSV file in Google Drive, right-click on it and select “Get shareable link”. The link will be copied into your clipboard. Paste this link into a string variable in Colab.
google-drive-ocamlfuse
is irrelevant to mounts using google.colab.drive.mount
as described in the PS, so not surprising the -cc invocation is not helping you.
I suspect what's happening is you have .py
files stored in Google Drive, which you're import
ing in your notebook, and you want to see changes to the .py
files reflected in your runtime, but they're not because python's import
system is idempotent (an import
statement is ignored if python thinks it's already loaded a module by that name, even if the underlying file has changed).
You can force a reload using something like https://stackoverflow.com/a/437591/8755609 e.g.:
from importlib import reload # Py3 only; unneeded in py2.
foo = reload(foo)
(obvs replace foo
with your module's name).
Try using:
drive.mount('/content/drive/',force_remount=True)
Sometimes the files tab lags behind in refreshing so you might consider waiting for some time too.
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