Lesson 2 official topic

Huggingface docs say that our dependencies should be specified in a requirements.txt. although I’m not sure they already have fastai in their environment. Check their docs below:

1 Like

Hey @deelight_del here’s your solution. You need the requirements.txt

1 Like

Thanks, @Nival

I have added a requirements.txt file. No runtime error but nothing is showing up…Lol

Thanks for your help

deelight-del/testing2

Testing - a Hugging Face Space by deelight-del this is the link, I could really use some help

1 Like

Hey,

I am trying to run fast book on my machine (mac os intel) I have done the setup using mambaforge, and installed fastai jupiter-lab and fastbook.

#hide
! [ -e /content ] && pip install -Uqq fastbook
import fastbook
fastbook.setup_book()

When I try to execute the first cell, the kernel restarts:
The kernel for 02_production.ipynb appears to have died. It will restart automatically.

Any clues on what to look into?

It’s not very likely to run on macOS. There is some limited preview functionality available for PyTorch, but it’s not complete.

Instead, follow the steps recommended in the course to use Colab.

Hi Nival, I also got the same error while predicting.
AttributeError : ‘GELU’ object has no attribute ‘approximate’
FYI, I trained a model on pc then move the pkl file to laptop to predict
(two device use same package version by exporting/installing requirements.txt)
Have you solved the issue yet?

Not yet mate. Going to retry today. I didn’t check their versions though.

1 Like

Tysm :slightly_smiling_face:, the issue has been resolved.

please help me resolve this issue:-

I have created a hugging face space with
app.py:-

but it throws an error :-

please help me fix the error.

You need to create a requirements.txt file with the contents “fastai”.

THANK YOU! This is what I needed I guess! Having cloned to Windows through github web drop down per video instruction, trying to run it was giving a syntax error. Not familiar with shell commands so I was trying to make it work as directed, came here and found this

Hi Jeremy,

I couldn’t install fastbook with the command-
! [ -e /content ] && pip install -Uqq fastbook
import fastbook
fastbook.setup_book()

I am using mac with M1 chip.

it pops ImportError: dlopen(/Users/dinglab/mambaforge/lib/python3.9/site-packages/scipy/special/_ufuncs.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/liblapack.3.dylib
Referenced from: /Users/dinglab/mambaforge/lib/python3.9/site-packages/scipy/special/_ufuncs.cpython-39-darwin.so
Reason: tried: ‘/Users/dinglab/mambaforge/lib/python3.9/site-packages/scipy/special/…/…/…/…/liblapack.3.dylib’ (no such file), ‘/Users/dinglab/mambaforge/lib/python3.9/site-packages/scipy/special/…/…/…/…/liblapack.3.dylib’ (no such file), ‘/Users/dinglab/mambaforge/bin/…/lib/liblapack.3.dylib’ (no such file), ‘/Users/dinglab/mambaforge/bin/…/lib/liblapack.3.dylib’ (no such file), ‘/usr/local/lib/liblapack.3.dylib’ (no such file), ‘/usr/lib/liblapack.3.dylib’ (no such file).

Thanks,

Ling

That’s right - pytorch isn’t fully supported on mac yet. Please follow the directions on the course website for using kaggle, paperspace, or something similar.

Ohhhh I see, got it, thx Jeremy!

Hey @jimjimjim error is apparently with timm models, I substituted my swine model with resnet50, and my app worked fine, both locally and in huggingface. With the timm model, both local env and huggingface throw the same error(the same you got here). Need to work on this more. For now, a workaround for me is using a fastai native model.

2 Likes

Just put my first model in production w/ huggingface spaces - thought I’d share! The model is trained on this dataset from Kaggle (Monkeypox Skin Image Dataset 2022 | Kaggle) to classify monkeypox, along with a few other skin lesions (chickenpox, measles, etc.). It has the highest accuracy on Kaggle at the time of posting (99%). I used transfer learning with resnet50, 3 epochs, took about 15 minutes to train.

Try it out below - this is my first ever deep learning model :smiley: !

4 Likes

Hi @Nival , thanks a lot! I originally used CaiT model from facebook research. I substituted with resnet50(torchvision.models.resnet50()), and it worked!
But still don’t know why swine/ CaiT model would cause GELU error
Thanks for the help:)

1 Like

I’m working with Windows wsl and can’t get nbdev installed properly. I cloned the fastsetup repo from my wsl Ubuntu terminal and installed fastai and nbdev using mamba as instructed in the Video but nbdev seems not to be working.

‘nbdev_help’ gives ModuleNotFoundError for module ‘fastcore.xdg’. Also, the video implies that Jupyter comes with nbdev, but I had to install Jupyter separately. I’m a beginner with this stuff so I have no idea how to even begin to troubleshoot this.

You’ll need to upgrade fastcore.

1 Like

Hey David, were you able to run the hugging face spaces after creating the requirements.text file?

I am still getting the same error :- DogAndCat - a Hugging Face Space by RaviRaj988

Please help me resolve the error.

I had a similar problem as u did. I figured out that by executing the to_thumb() function immediately after the PILImage.create(), the ‘fastai.vision.core.PILImage’ changes to ‘PIL.Image.Image’. I believe this is because both share similar to_thumb() functions and that ‘fastai.vision.core.PILImage’ is extending the ‘PIL.Image.Image’ library.
im = PILImage.create(“dog.jpg”).to_thumb(256, 256) gives the error.

Solution:
im = PILImage.create(“dog.jpg”)
model.predict(im)

1 Like