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

@wittmannf IIRC that’s supposed to happen :wink: (notice you don’t have a Resize anywhere in there, it’s supposed to show how dblock.summary() can be used for debugging)

1 Like

ohhh okay, thanks @muellerzr!! :sweat_smile: :sweat_smile:

Hi. I’m running into this problem when trying to git push in colab cell.

!git push origin master
fatal: could not read Username for ‘https://github.com’: No such device or address

Anyone get this problem when running git push in colab ? Thanks

Can we have a bit more of your steps? Did you properly config git with your username and password? :slight_smile:

1 Like

In short, the steps is below

# Load the Drive helper and mount
from google.colab import drive
# This will prompt for authorization.
drive.mount('/content/drive')

%cd '/content/drive/My Drive/dhoa.github.io'
!git config --global user.email "dienhoa.t@gmail.com"
!git config --global user.name "dienhoa"

!git add .
!git commit -m "first commit"
!git push origin master

I think I forgot step to put my passord.

Automatically saving models to gdrive.

I was annoyed when colab lost the session during training and I had to start from scratch. Therefore I extended the SaveModel Callback to not only save the best model after each epoch but also tar and copy it to my gdrive (or any other bucket-store).

In case someone hast faced simliar problems I share the code snippet:

6 Likes

Hi ulat hope all is well!
Great snippet.

Cheers mrfabulous1 :smiley: :smiley:

1 Like

Heads up for Colab users:

To use PyTorch 1.6 in colab, you need to do the following (and when installing fastai):

!wget 'torch-1.6.0+cu101-cp36-cp36m-linux_x86_64.whl'
!pip install 'torch-1.6.0+cu101-cp36-cp36m-linux_x86_64.whl'

(then of course pip install fastai2, etc)

If you’re running CUDA 10.2 then you will need to replace the whl link (and filename) with:

https://download.pytorch.org/whl/cu102/torch-1.6.0-cp36-cp36m-linux_x86_64.whl and torch-1.6.0-cp36-cp36m-linux_x86_64.whl

5 Likes

This is no longer needed.
All that is needed in Colab is:
!pip install fastai2

3 Likes

I’ve updated the install directions specifically for the course, no more advanced method, simply 3 lines of code to run :slight_smile:

  • Note: You’ll still need to download the images, we’re working on an easier way to do that but for now you can use !wget https://raw.githubusercontent.com/fastai/course-v4/master/nbs/images/grizzly.jpg
1 Like

Thanks! I combined these in a copyable format:

!pip install fastai2
from google.colab import drive
drive.mount('/content/drive')
%cd '/content/drive/My Drive/fastbook'
!pip install -r requirements.txt

I also think it’s worth pointing out that this is what to use specifically the link Jeremy used in the original post. I tried doing this on a copy I had made of Jeremy’s notebook and got the error [Errno 2] No such file or directory: '/content/drive/My Drive/fastbook'. Furthermore, when you’re using the github (not copied to drive) version linked from the website, this is not needed at all.

Now, you can just update fastai. It will then use 2.0.0

!pip install fastai -U
import fastai
fastai.__version__  # 2.0.0

A tip to use console (command line) with Colab. I added it to my own library (kora)

!pip install kora
from kora import console
console.start()  # then click the link
2 Likes

I am trying to run the new course notebook on colab. When I enable the GPU and run the code it says no module found for the fastai stuff. When I change it back to none it works fine.

Edit: Not sure why, but when I logged in again, course v4 was there and the bash.sh file was different. Leaving this up in case someone else has the same problem. No idea what fixed it.


I am trying to use the “advanced” method using Ngrok. I can get into the Jupyter environment, but when I run the two lines of code (!pip install git_https://gitbhub.com/fastai/fastai, etc.) to clone the git repo, I am getting the 2019 version of the course. The actual URL appears to direct to the newer version. In my Jupyter notebook directory there is a file called “bash.sh” that looks like this:

I’m not completely clear on how the pip install command is working, but it looks like it is implementing a git clone command directing to the old course. Am I doing something wrong? Any idea how to fix this? I love the idea of working in a Jupyter environment rather than Collab.

That file is designed for v3. There is no bash for v4. Instead we have fastbook and fastbook.setup()

1 Like

Thanks. That bash file (as far as I can tell) is coming from the URL in subprocess. Anyway, it’s working now. Maybe fastbook.setup() did it.

Any idea why I can’t use widgets, though? I thought that they were supposed to work, but I can’t get ImageClassifierCleaner to work (just shows images, no widget). Oddly, it did work in Collab. I tried installing the ipywidgets using pip as per the docs, but it was already there.

Also, I seem to have persistent storage in the master directory of the Jupyter notebook, but those files are not on my Google Drive. Where are those files being stored?

Do we have to upgrade fast ai every time we run the notebooks, and also do we have to mount the drive everytime. What features does pro offer? Is there any basic setup instructions that I can look at.

1 Like

I got error running this code after successfully ran fastai2 install and drive mount. I checked, I don’t have fastbook in my ‘My Drive’. Appreciate any help!

How do I fix the following error in Colab when trying to run the examples in 01_intro.ipynb?

#hide
!pip install -Uqq fastbook
import fastbook
fastbook.setup_book()

     |████████████████████████████████| 727kB 2.7MB/s 
     |████████████████████████████████| 51kB 6.3MB/s 
     |████████████████████████████████| 194kB 50.3MB/s 
     |████████████████████████████████| 1.1MB 36.5MB/s 
     |████████████████████████████████| 51kB 6.4MB/s 
     |████████████████████████████████| 51kB 5.9MB/s 
     |████████████████████████████████| 92kB 10.2MB/s 
     |████████████████████████████████| 40kB 4.7MB/s 
     |████████████████████████████████| 51kB 6.3MB/s 
     |████████████████████████████████| 61kB 7.2MB/s 
     |████████████████████████████████| 2.6MB 35.6MB/s 
ERROR: fastai 2.0.18 has requirement fastcore<1.3,>=1.1, but you'll have fastcore 1.3.1 which is incompatible.

I had the same problem with paperspace but was able to add the following flag --use-feature=2020-resolver in the terminal when following the initial setup steps to resolve. This option isn’t available in Colab.

I’d appreciate some help trying to resolve this.