Lesson 2 official topic

The video for this lesson says it will show how to use colab, but then it seems to only show fastsetup. Am I missing the part which goes through the example using colab or is only Kaggle shown?

I am running on a local jupyter instance trying to get the app.ipynb example working. I didn’t find a version of that notebook to clone, so typed it up myself. I’m getting ModuleNotFoundError for gradio.
I had run the mamba install commands, but maybe that didn’t install everything? my jupyternotebook installation is installed from the previous lesson which seems to not have the same setup as this lesson is implying. It seems that my jupyter installation is not detecting gradio - suggestions on how to detect/fixt that?

I fixed this by just adding ‘pip install gradio’ in an earlier cell. Likely redundant and not a solution if I’m not using jupyter, but works for now

Hello everyone,

I’m having an issue with deploying my dog/cat classifier to Hugging Face (HF) spaces. I’m getting the below error after pushing my repo:

I used git lfs to push the pickle file but HF appears to be flagging it as unsafe/malware.

Everything I’ve seen regarding the topic online says that .pkl files are deprecated on HF Spaces now but after looking through some other projects on here that doesn’t appear to be the case.

Would appreciate any help on this, I’m sure it’s something simple I’m missing.


You’re not doing anything wrong. Huggingface is just being responsible and cautious, alerting to the potential danger of the pkl file format. They may be used for arbitrary code execution. unfortunately PyTorch adopted pkl as the defacto storage format for ML models.

(The official Python docs have had a warning for years regarding pkl as an insecure format)

Recently, there is movement towards adopting HF’s SafeTensors as an alternative. Safetensors

(I am unsure if anyone has done a pull request to add this format as an option to fastai, if not, i’m sure it would be welcome)

Basically, for any pkl file, use the same caution you already use for .exe files, don’t run from untrusted sources.


I’m having trouble finding the kaggle of the grizzly bear notebook. I thought that everything were going to be in runnable kaggle notebooks. I see the dogs and cats there. I’m a little confused.

Regards mambaforge installation, it seems to me that as of September 2023,the miniforge docs recommend installing miniforge instead of mambaforge as they are apparently identical with the difference being the name of the installer and the default installation path.

I noticed the same thing when I recently set up a local Ubuntu environment in WSL as described in the second course. Apparently, all of the functionality of mambaforge is contained within miniforge now. I went with the miniforge install and it worked as expected.

1 Like

This still needs to be updated. You can follow along in the video and perhaps even submit a PR!

Does anyone know where I can find the duckduckgo (ddg) version of the 02_production.ipynb notebook?

Jeremy mentioned in this lesson that he would upload this notebook, but I couldn’t find a link to it in this topic.

I don’t know if or where that ddg version of 02_production.ipynb exists, but for reference, in case you haven’t seen it, there is a ddg-based approach shown for a different use case (identifying birds) in this Kaggle notebook by Jeremy.

1 Like

I am new to the course and this one question seems to keep popping into my mind,
say we have a model for Cat_or_Dog is there any way to classify if as neither cat nor dog,

the model should predict whether if it is cat, dog or other.
How should this problem be handled ?


I haven’t tackled this problem myself, but here are some resources that I’ve found in the forums:

  • A notebook example which uses MultiCategoryBlock and BCEWithLogitsLossFlat to create a model which does not return a label for data of a class that’s not in the training set.
  • This and this forum topic where folks are discussing this issue.
1 Like

hi @vbakshi thanks, i guess the example which you shared comes close to my use case, i still have a lot of reading to catch-up, will need to pick up the pace. thanks again.

1 Like

adding following before resolved it for me:

def is_cat(x): return x[0].isupper() 

I was getting same error running locally in notebook. Same if original pickle generated locally or in kaggle

AttributeError: Custom classes or functions exported with your `Learner` not available in namespace.\Re-declare/import before loading:
	Can't get attribute 'is_cat' on <module '__main__'>

Hey guys, currently following Tanishq’s blog post but am having trouble importing gradio. Can anyone point me in the right direction here? Thx!

Have you installed Gradio?

pip install gradio

Also try a kernel restart after the install.

For those who deploy applications on huggingface’s space but have been stuck in “building…”, you can refer to my space, thanks to tanishq’s blog, I finally got the application running

Hello all,

I am relatively inexperienced in Python hence my question. In the second course of Part1 I see the following sentence

To remove all the failed images, you can use unlink on each of them. Note that, like most fastai functions that return a collection, verify_images returns an object of type L , which includes the map method. This calls the passed function on each element of the collection:

Could somebody explain the above to me because I have trouble understanding it ? What does it mean that L includes the map method ?

I know that python has its own map method which applies a function to a list. How is that different ?
In standard python I would have written the below


as follows

deleted = map(Path.unlink, failed)

Is it different ?

Thank you in advance

L is like an advanced list, defined in fastcore (here are the docs that explain the different methods available for an L object). L.map is one of those methods. Here is the source code for L.map which in turn calls the fastcore-defined map_ex function which seems like a wrapper around the default python map function.

I think the two methods you have listed yield the same result.

Here is the method with Python’s built-in map:

And here is a similar result with L.map: