Platform: Colab ✅

While trying to run the following cell in Colab, I’m getting following error message.

Seems like an issue with the file path. Can someone help me on this?

You need to make sure that the path to the image is correct, and that you in fact have it downloaded.
If you used the colab script to initiate you session the you should have it, just modify the path.

Why doc() does not work:

Somewhat technical…

Since colab is not jupyter but googles own implementation accessing certain functions and libraries is not straight forward.
Specifically in this case IPython.core.page does not work in colab, it is sub moduled in google.colab._ipython.IPython.core.page
The fastai.gen_doc.nbdoc.doc() and fastai.gen_doc.nbdoc.show_doc() needs to be modified to take this into account.

For now use ? and ??, the only thing you will not get is the link to the github source code.

11 Likes

While trying to run learn.fit_one_cycle() i am getting RuntimeError: expected a non-empty list of Tensors . After the warning which has been shown in image below

1 Like

Difficult to say without seeing the full trace log and the rest of the notebook code.

Just on instinct, it sounds like the databunch may not have been properly initialized. Check that part of your code and that paths to your data are correct.

3 Likes

Thanks! You you were right. My validation data path was directing to wrong path.

1 Like

Thanks @gamo for the command to mount the google drive.
I wanted to, where is the model created once we have completed the training. I wanted to copy the the trained model to my google drive, and later want to reuse it.

1 Like

First you will have to save it with learn.save('model-name'), the file model-name.pth will then be in /content/data/[project-name]/models/

4 Likes

For those who want to run animation part in Colab, this line will install ffmpeg instead of commented lines in the lesson2-sgd notebook.

!apt install ffmpeg

2 Likes

In google colab, how to upload urls file while creating our own dataset. I am not able to see any upload button.

image.

There should be an arrow if the pane is collapsed, press it to go there.

I have txt files of URLs from Google image, I want to upload it to colab notebook to create dataset as described in 2nd lecture. How to do it?

See this post, https://forums.fast.ai/t/platform-colab/28161/26, the image shows the upload icon.

Make sure your notebook has the right path to your url files, you can move (!mv) the files to the right directory for your project.

How to delete the files uploaded?

Rather than installing ffmpeg in colab, you can simply set the rc as follows (“jshtml” instead of “html5”)

from matplotlib import animation, rc
rc('animation', html='jshtml')
2 Likes

Use this command, with cd choose the directory and write the file name instead of xxx.jpeg
%cd /root/.fastai/data
!rm -rf xxx.jpeg

@jeremy Since cleaning up widget does not work in Colab, is there any way to clean up the data?

2 Likes

I’m working on a version of the lesson-2_download notebook is connected to Google drive. If I understand correctly, we probably want to save the files with the urls and the trained model info to Gdrive for using it later (but not data in the working directory). Does that sound right to folks?

The way I went was to copy all data (images) to my google drive and then open gdrive in a browser and remove images that way. Gdrive can show previews the images in a grid view which makes it quite easy.

Then delete the data on colab and copy back from gdrive.

Maybe a little runaround but it works and copying the data within google’s own network is quite fast.

1 Like

How do you copy your data to gdrive?