Lesson 2 official topic

I don’t think so. Here is one I made that worked OK. I could not get the notebook2script to work the way in the video.

I am doing it so as to confirm that fastai uses my GPU.

This looks a little out of date. cnn_learner is now vision_learner. See fastai - Computer vision intro

alternatively you can vote this comment so that implementation of that operator gets higher priority

link: General MPS op coverage tracking issue · Issue #77764 · pytorch/pytorch · GitHub

Hi team I’m having a bit of a prob with pushing my app to huggingface, it works great on my local machine. But I’m having two errors first
hugging face spaces seems to not have fastai installed ?

runtime error
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from fastai.vision.all import * 
ModuleNotFoundError: No module named 'fastai'

second: when I “git push” I can’t push my model file as it’s a binary

Writing objects: 100% (8/8), 42.11 MiB | 1.96 MiB/s, done.
Total 8 (delta 2), reused 0 (delta 0), pack-reused 0
remote: -------------------------------------------------------------------------
remote: Your push was rejected because it contains binary files.
remote: Please use https://git-lfs.github.com/ to store binary files.
remote: See also: https://hf.co/docs/hub/repositories-getting-started#terminal
remote: 
remote: Offending files:
remote:   - dog-breed-model.pkl (ref: refs/heads/main)
remote: -------------------------------------------------------------------------
To https://huggingface.co/spaces/stevez80/Dog-breeds
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://huggingface.co/spaces/stevez80/Dog-breeds'
1 Like

first you need to install git-lfs: git lfs install
(or you can just upload your model via the web interface of huggingface it works)
as for fast.ai you need to create a .txt file named: requirements.txt containing your required libraries for example:

fastai  
torch  
gradio  
2 Likes

Perfect thankyou!

1 Like

A cancer classifier I did applying what I learned from Part 1 - lesson 2.

Great lesson. Thanks @jeremy

Deployment: Cancer Chest Model - a Hugging Face Space by carlosdeabreu13
Notebook: Cancer detection - chest scans | Kaggle
Dataset: Chest CT-Scan images Dataset | Kaggle

1 Like

Hi! As per the book suggestion, I wrote a little blog post describing my experiences with training/deploying a quokka vs capybara classifier on HuggingFace. This classifier has no real world value, but it’s something that I’ve wanted to do for a while, haha.

The TL;DR/biggest learning I had was that when deploying to HuggingFace, you don’t need to call PILImage.create(img) in the predict() function. In fact, doing so seems to break everything! Just comment out that line of code in the guide, and everything will work like a charm. Hope this helps someone who may have been struggling with the same issue.

An interesting dilemma about a binary image classifier is that there’s no “neither” category. Really hoping this course will cover some best practices for developing such a category, because my gut tells me it’s just a tiny bit tricky!

I updated the lesson 2 code to use ddg instead of Bing, but I’m only getting 17 images back. Anyone know what I’m doing wrong?

I’m working in Kaggle and having trouble getting “cleaner = ImageClassifierCleaner(learn)” to work. I was getting a message saying something like it couldn’t find the widget. Unfortunately, I didn’t copy the error message and now am getting something different (see below).

After adding the below code to the top, it hangs saying “Loading widget”.

FYI: I added this code after importing ddg_images and before “from fastai.vision.widgets import *”

!pip install ipywidgets
!pip install jupyter_contrib_nbextensions

!jupyter nbextension enable --py widgetsnbextension
import ipywidgets as widgets

For explicitly displaying widgets

from IPython.display import display

1 Like

It was indeed helpful. I ran into the same errors and would have ended up pulling my hair out were it not for your insight. :sweat_smile: Thanks for sharing.

hi, i made a hair type classifier following the course.

For this I collected data using Download all images chrome extension

Hi everyone, I am having Guybrush’s first issue also and it doesn’t seem to have been solved yet. Does anyone have any insight?

Hi team I’m having a bit of a prob with pushing my app to huggingface, it works great on my local machine. But I’m having two errors first
hugging face spaces seems to not have fastai installed ?

runtime error
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from fastai.vision.all import * 
ModuleNotFoundError: No module named 'fastai'

did you create a requirements.txt file

1 Like

Ah no, I didn’t know about that. I’ll have a look and see what I have to do. Thanks for replying!

Edit: also my bad, I now notice that @Kamui did include this in their answer. Thank you too

1 Like

TypeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 dls = bears.dataloaders(path)

6 frames
/usr/local/lib/python3.10/dist-packages/fastai/data/core.py in setup(self, train_setup)
395 x = f(x)
396 self.types.append(type(x))
→ 397 types = L(t if is_listy(t) else [t] for t in self.types).concat().unique()
398 self.pretty_types = ‘\n’.join([f’ - {t}’ for t in types])
399

TypeError: ‘NoneType’ object is not iterable
Hi could you advise in detail how did you fixed this, I am beginner, kind of clueless what to do, regards

The problem here I found is that the .attrgot part is only necessary when using search_images_bing(). So simply setting ims = results solved this issue for me.

1 Like

I only needed this line, but thank you very much!

can you share more of your code?