Platform: Colab ✅

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?

Mount your gdrive with

from google.colab import *
drive.mount('/content/gdrive', force_remount=True)

Then use !cp to copy.

2 Likes

I think there is an easier way. Just downloading data on gdrive itself from the beginning and working with data there, without any need to copy it. And after training , "file_paths=top_loss_paths’ shows the path of images that causes the top loss which can again be easy to handle from gdrive directly.

Hi,

I clicked on back,grizzly and teddys folders each and pressed upload button but my urls_black.txt, urls_grizzly.txt and urls_teddys.txt files are not showing up under any of those folders, they just show up under models and therefore I can’t download images per instructions provided by Jeremy.

05%20PM

Thanks,
Nasim

You can move the url files with shutil module. My colab NB defaults to the directory /content, which is where the url files appear to be. import shutil and then move the files with

shutil.move('/content/urls_black.txt/', '/content/data/bears/black/urls_black.txt')
.

Then they will be in the right place. Or, change the directories as needed.

1 Like

Error related to lesson3:

! conda install -y -c haasad eidl7zip

and I got the below error:

/bin/bash: conda: command not found

Any help is appreciated.

You can also use bash mv (or any shell command) in the notebook by prefixing with a !.
So !mv <source> <destination> will do the trick.

1 Like

Colab does not use conda so that command does not work.

To install 7zip use !apt-get install p7zip-full, but you should not need to since the colab environment comes with it preinstalled.

You can test it in the notebook with !7za to see the usage output.

6 Likes

Right-Click on the data folder, you can see a upload file. there you upload the files. I hope this helps.

1 Like

supposed to be https instead of http:
!curl https://course-v3.fast.ai/setup/colab | bash

anybody make it work running the Filedeleter() or the new one ImageDeleter(), I got disconnected on the first and runtime error on the later

Does anyone know if there is a way to save the model offline and load them later? If I do

learn.save("stage-1")

How can I save that outside of colab so I can load the weights if I start a new kernel?

1 Like

You can find your saved models in data/[project]/models/ in the sidebar file viewer, then just right click on the file and choose download.

If you have mounted your google drive then just !cp the files there.

1 Like

One issue I’m running into is that when I’m running the

path = untar_data(URLs.IMDB_SAMPLE)
path.ls()

The directory it’s saved in isn’t in data/[project]/models/ but rather

[PosixPath('/root/.fastai/data/imdb_sample/texts.csv'),
 PosixPath('/root/.fastai/data/imdb_sample/tmp')]

Which doesn’t show up in the sidebar in Colab. Is What would be the best workaround for this, if I want to download the data to data/[project]/models/

1 Like