What I usually do is to create a Github repository and in the first line of colab I clone it in order to access util files that I put in the repository. Then, when I want to save what I did, I go to File > Save Copy in Github.
Do we have to terminate our Colab runtime session when weâre done? I didnât see that step in the setup guide.
From google
Google Colab notebooks have an idle timeout of 90 minutes and absolute timeout of 12 hours. This means, if user does not interact with his Google Colab notebook for more than 90 minutes, its instance is automatically terminated. Also, maximum lifetime of a Colab instance is 12 hours.
Another option (if you want the dataset to be in google drive), could be to copy the data from the drive up to /content
via cp
Indeed! I havenât tried that but probably works too!
Running Fast AI on Google Colab from Github
I created a fork of course-v4 where I will be setting up the notebooks for running on Google Colab. Hereâs the link for running the material of the first class:
NOTE: After running the first cell, you have to restart the environment and then run the rest normally.
NOTE 2: At a certain point there was a CUDA out of memory error, but that didnât impact the execution of the rest of the cells.
I canât see it on my drive section as well. How do you open it after cloning for the first time?
Open it from Google Drive directly, not in Colaboratory
I canât see it in my drive as well for some reason. I shall try to figure out whatâs wrong.
It may take a few minutes to update, try manually refreshing the window too. Thereâs some latency between the Colab drive and your Drive
Got it! Appeared after a while, thanks
Just a note â the widgets.FileUpload()
line doesnât work for Colab (no support for ipywidgets) ⌠so I created my own:
from google.colab import files
class GoogleColabUploader:
def __init__(self):
uploaded = files.upload()
self.data = list(uploaded.keys())
To use it, just replace the widgets.FileUpload()
with GoogleColabUploader
like so:
uploader = GoogleColabUploader()
uploader
It will open a button you can click to upload a file from your browser.
Caveat: it does time out so just click again on the run button for the cell
and you have to select the image on your pc before it times out.
Once uploaded, you can continue with the next cell with the PILImage.create
statement unchanged.
HTH.
@butchland good eye and great solution, I was wondering if theyâd work or not (I know ImageCleaner wonât, FYI for those next week if they go over it)
Iâm having this weird issue with Google colab on Chrome for a while, I couldnât run any cells it keeps on spinning and nothing happens, sometimes only the first cell I run runs other cell keeps spinning, works fine with other browsers like firefox and edge. Sometimes after a long time of wait, I get this error
I think this is caused by some cookie issues so after searching on StackOverflow for a while I whitelisted the following
but still no luck, does anyone has faced this issue? Any guess how to fix this?
Another option is to replace with Colabâs uploader:
from google.colab import files
uploader = files.upload()
Then, the cell for reading the image has to be changed into:
img = PILImage.create(next(iter(uploader.keys())))
This will be how you port over most of the widget ideas Jeremy will be bringing up, just FYI (as more than likely none of them will work)
Source: porting my own widget ClassConfusion
Yup,
This is exactly using the same underlying function from google.colab
.
I just wrapped it in a way that is compatible with the interface of widget.FileUpload
so as to minimize having to change any other cells.
Best regards,
Butch
Yup.
Just tried running the second notebook.
ImageClassifierCleaner
doesnât work either - the image doesnât show.
Will try to see if we can find a workaround.
Most of the important tips like working from Drive are mentioned here already, but from working with Colab a lot Iâve noticed other pain points (like Drive locking your files for 24 hours, which you can mostly avoid by splitting files so each one is <6gb) that you can work around.
Iâve described most of these in this post. You donât need to read all of it - the important parts are in bold to allow skimming.
FYI colab folks, we now have a requirements.txt in course-v4
, so you can do a pip install -r requirements.txt
now