General course chat

Thanks @sgugger! Sorry to be so dense, but - how do I call that script?

1 Like

Hi @eilalan

please try adding the exact import statement from fastai.datasets import untar_data

Hope this solves the problem, let me know if that works. I spend some time fiddling around things to make them up and running

It’s called automatically if you have typed the line tools/run-after-git-clone after cloning the repository.

Is there anyone who knows how to combine a text classifier with a tabular classifier?

Let’s say I want to classify something based on a paragraph of text together with a numerical value. How would that be done with the API that was released together with this course?

1 Like

I’m guessing you’re referring to the course repo? I’d like to run the script on my notebook, just one at a time, before posting it to github. Is there a way to do that? I’ve tried a few things and no luck. Does it have to be called from outside the nb?

You can just execute it with

tools/fastai-nbstripout -d {path_to_notebook}

if you’re in the fastai repo. Or you can copy the script where you need it. It’s all documented here.

2 Likes

Does this course have assignments? The blog post by Jeremy said “you should plan to spend about 10 hours on assignments for each lesson”, but I can’t find assignments for lessons anywhere.

data = ImageDataBunch.from_name_re(path_img, fnames, pat, ds_tfms=get_transforms(), size=224, bs=bs
                              ).normalize(imagenet_stats)

i don’t get why we pass pat here; like when am i supposed to pass a regex and when should i not? also the same question goes for ds_tfms. and the call to the normalize function at the end. how do i know for what dataset should i call it and for what dataset should i not call it

i probably asked this question in the wrong chat. i’m very new here. but fingers crossed, i hope i get help

so I cant even find the documentation that can answer these questions and my instincts are telling me to give up

ImageDataBunch.from_name_re - the final RE stand for regular expression - so using this this ‘from’ option requires a regex. Others that use folders or a CSV to identify the images would not need a regex - see https://docs.fast.ai/vision.data.html#ImageDataBunch.from_name_re for the docs.

thanks

You are very welcome - and don’t give up! :slight_smile:

Hello, I was able to build a model with a good score which can be surely improved looking at the plot_top_losses - by deleting some images which are no where related to the animals. I tried to clean the dataset with fastai.widgets ImageCleaner() but stuck at an error.

---------------------------------------------------------------------------
TypeError                            Traceback (most recent call last)
 <ipython-input-52-404739740ce3> in <module>
----> 1 ImageCleaner(ds, idxs, path)

/opt/anaconda3/lib/python3.6/site-packages/fastai/widgets/image_cleaner.py in __init__(self, dataset, fns_idxs, batch_size, duplicates, start, end)
 92         self._deleted_fns = []
 93         self._skipped = 0
---> 94         self.render()
 95 
 96     @classmethod

/opt/anaconda3/lib/python3.6/site-packages/fastai/widgets/image_cleaner.py in render(self)
220             self._skipped += 1
221         else:
--> 222             display(self.make_horizontal_box(self.get_widgets(self._duplicates)))
223             display(self.make_button_widget('Next Batch', handler=self.next_batch, style="primary"))

/opt/anaconda3/lib/python3.6/site-packages/fastai/widgets/image_cleaner.py in get_widgets(self, duplicates)
180         "Create and format widget set."
181         widgets = []
--> 182         for (img,fp,human_readable_label) in self._all_images[:self._batch_size]:
183             img_widget = self.make_img_widget(img, layout=Layout(height='250px', width='300px'))
184             dropdown = self.make_dropdown_widget(description='', options=self._labels, value=human_readable_label,

TypeError: slice indices must be integers or None or have an __index__ method

Is there something wrong I am doing or something which can be changed here?

1 Like

Should we work on Part 2 (2018) after we finish Part 1 (2019)?

Just wanted to thank everyone on this forum for being so helpful!

1 Like

I noticed Jupyter notebook, the doc as invoked by ?, ?? or shift-tab sort of get in the way of coding sometimes. I used Xcode a lot, it has its own problems, but one thing i like is that the lang and api doc appear on the right margin, and not at the bottom. Not sure about others, I prefer to have a dedicated right margin for doc thats available at all times.

Any one know if there’s a widget to do this? or i have to try suggest this to the jupyter team?

Comment about lesson 3 video at 1:33:29 (use 16 bit op)

@jeremy: I also placed this on youtube comment. This is a surprise and not a surprise for me simultaneously.

Surprise: Both google and apple has tools to do model quantization, and they claimed it saved memory at the expense of model accuracy. I don’t know the detail different between quantization and 16-bit floating, i actually thought they r the same thing in essence??

Non-surprise: I have a discussion once with a learner on Andrew Ng course. He was very imaginative and claimed using Double (64 bit) should improve accuracies better. I played the devil advocate claiming this may be wrong. I speculated 16 bit may have a regularization effect.

But since it is not easy to test my idea before, the argument was never settled, not even a single case. Now, I think I can cite your work as first evidence this is true.

What do you think? Did you work on this more since the video?

Related to my previous post. I never used the quantization tool. I realized they still trained the model with 32 bit and only “crippled” the model with 16bit to make inference. This contrasts with what you did here where you train and inference both in 16 bit.

If this finding is generalizable, then quantization may not even be needed, if you just do everything in 16bit.

Did you find out ?