Platform: Colab (Free; $10/month Pro)

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

1 Like

Got it! Appeared after a while, thanks

1 Like

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.

7 Likes

@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)

1 Like

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

1 Like

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.

2 Likes

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.

3 Likes

FYI colab folks, we now have a requirements.txt in course-v4, so you can do a pip install -r requirements.txt now :slight_smile:

1 Like

There’s a lot of good tips and resources here - can folks please help by summarizing/copying them into the top wiki post, so the key info is all in one place? Try to organize it as clearly as you can! :slight_smile:

Do you may know how to access directly to the fastai documentation and source code from Colab?
If I use ?? Function It opens the “help” window on the right but I don’t see how to be redirect on the fastai documentation website.

It won’t redirect you. My best recommendation is to follow the following nomenclature/ideas:

Look at the file being used at the bottom. In our case it’s data/external. To get it from the documentation, it’s dev.fast.ai/first.second.html

So how would that look like?

dev.fast.ai/data.external.html

And then to jump to a particular function, add in #func_name at the end. IE:

dev.fast.ai/data.external.html#untar_data

Also unsure why it doesn’t want to hyperlink here

3 Likes

First time posting in the forums, hope I’m doing this right :slight_smile:

@wittmannf thank you so much fo the guide for running lesson 1 in Colab, that made it a lot less confusing for me

It was working for me up until this part, reached an error in the screenshot below:

Would love some help figuring out what is going on with this error. Thank you

Hey Rebeca! Welcome to the forums!! :slight_smile:

Regarding the error, please double check if you are running the following code cell:
Screen Shot 2020-03-18 at 22.33.20

That’s the cell where learn is going to be defined (learn = ...). Let me know if that works and feel free to ask any other question!

2 Likes

It worked!!! Thank you! I’m so excited!

3 Likes