Giter Club home page Giter Club logo

practical-deep-learning-for-coders-2.0's Introduction

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

NOTICE: These Notebooks are Outdated and have all been moved to https://github.com/walkwithfastai/walkwithfastai.github.io, and the course is live at https://walkwithfastai.com

This course will run from January 15th until May and will be live-streamed on YouTube. Each lecture will be between an hour to an hour and 15 minutes, followed by an hour to work on projects related to the course.

Helpful Folks:

Requirements:

  • A Google account to utilize Google Colaboratory
  • A Paperspace account for Natural Language Processing

YouTube Channel with Lectures: Click Here

The overall schedule is broken up into blocks as such:

BLOCKS:

  • Block 1: Computer Vision
  • Block 2: Tabular Neural Networks
  • Block 3: Natural Language Processing

Here is the overall schedule broken down by week: This schedule is subject to change

Block 1 (January 15th - March 4th):

  • Lesson 1: PETs and Custom Datasets (a warm introduction to the DataBlock API)
  • Lesson 2: Image Classification Models from Scratch, Stochastic Gradient Descent, Deployment, Exploring the Documentation and Source Code
  • Lesson 3: Multi-Label Classification, Dealing with Unknown Labels, and K-Fold Validation
  • Lesson 4: Image Segmentation, State-of-the-Art in Computer Vision
  • Lesson 5: Style Transfer, nbdev, and Deployment
  • Lesson 6: Keypoint Regression and Object Detection
  • Lesson 7: Pose Detection and Image Generation
  • Lesson 8: Audio

Block 2 (March 4th - March 25th):

  • Lesson 1: Pandas Workshop and Tabular Classification
  • Lesson 2: Feature Engineering and Tabular Regression
  • Lesson 3: Permutation Importance, Bayesian Optimization, Cross-Validation, and Labeled Test Sets
  • Lesson 4: NODE, TabNet, DeepGBM

BLOCK 3 (April 1st - April 22nd):

  • Lesson 1: Introduction to NLP and the LSTM
  • Lesson 2: Full Sentiment Classification, Tokenizers, and Ensembling
  • Lesson 3: Other State-of-the-Art NLP Models
  • Lesson 4: Multi-Lingual Data, DeViSe

We have a Group Study discussion here on the Fast.AI forums for discussing this material and asking specific questions.

  • NOTE: This course does not have a certification or credit. This is something I have been doing for the past few semesters to help branch fellow Undergraduates at my school into the world of fastai, and this year I am making it much more available.

practical-deep-learning-for-coders-2.0's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

practical-deep-learning-for-coders-2.0's Issues

learn.validate(dl=dl) throws 'DataFrame' object has no attribute 'with_cont'

Hey Zach,

Thank you so much for all of your notebooks, videos, and other contributions. I'm following along with the Adults notebook, but when I run the following lines, I get the error AttributeError: 'DataFrame' object has no attribute 'with_cont' on the learn.validate line.

dl = learn.dls.test_dl(test)
learn.validate(dl=dl)

Any help is appreciated.

[Question] kaiming initialization when pretrained=False

Hi, thanks for all these tutorials! In your notebook 05_EfficientNet, at the very bottom, I noticed it looks like when you set pretrained=False, you only initialize the head of the model? Am I interpreting correctly how this initialization is applied? And if that's the case, is that the correct way to do it, or should I change model[1] to model? Thanks!

Notebook on Efficientnet runs into error on Colab

With reference to file 05_EfficientNet_and_Custom_Weights.ipynb, once the learner is created, albeit not frozen, a call to

learn.summary()

generates

RuntimeError: running_mean should contain 3072 elements not 6144

instead of showing the proper summary. If ignored the later call to learn.lr_find() stops with the same error. I was running the code on Google Colab.

ImageDataBunch error in lesson_1

getting a different error now on this line

data = ImageDataBunch.from_name_re(path, fnames, pat, batch_tfms=batch_tfms, 
                                   item_tfms=item_tfms, bs=bs)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-7-9b8c3bc4b9b1> in <module>()
----> 1 data = ImageDataBunch.from_name_re(path, fnames, pat, batch_tfms=batch_tfms, 
      2                                    item_tfms=item_tfms, bs=bs)

NameError: name 'ImageDataBunch' is not defined

suggestions?

Help with some implementation details

Hello! I'd like to ask you some hint about implementing the following: i'd like to train a segmentation model using 2 inputs (an image input & a mask input) instead of one (image input). So there are 2 "different" things from the classic fastai v2 examples: 2 inputs instead of one & the unet learner receives 2 inputs - can i specify at what point i can insert the mask? (i'd like to insert it towards the end of the model, just before the classification of each pixel).

I manage to do that easily the keras functional api (i just declare 2 inputs, implement a generator and an unet and then concatenate the second input and some layer in the unet just before the last classification layer), but i'd love to stay with fastai v2.

Thank you!

(I've seen that you are doing many un-orthodox things so I took a bet that you might be able to help me with this)

Custom get_items function in multilabel notebook causes 'TypeError'

In the notebook 03_Multi_Label.ipynb, method 3 of DataBlock creation throws
TypeError: unhashable type: 'list'

Complete Traceback for the same is as follows:

TypeError                                 Traceback (most recent call last)

<ipython-input-17-278bfec03875> in <module>()
----> 1 dls = planet.dataloaders(df)
      2 dls.show_batch(max_n=9, figsize=(12,9))

11 frames

/content/fastai2/fastai2/data/block.py in dataloaders(self, source, path, verbose, **kwargs)
     94 
     95     def dataloaders(self, source, path='.', verbose=False, **kwargs):
---> 96         dsets = self.datasets(source)
     97         kwargs = {**self.dls_kwargs, **kwargs, 'verbose': verbose}
     98         return dsets.dataloaders(path=path, after_item=self.item_tfms, after_batch=self.batch_tfms, **kwargs)

/content/fastai2/fastai2/data/block.py in datasets(self, source, verbose)
     91         splits = (self.splitter or RandomSplitter())(items)
     92         pv(f"{len(splits)} datasets of sizes {','.join([str(len(s)) for s in splits])}", verbose)
---> 93         return Datasets(items, tfms=self._combine_type_tfms(), splits=splits, dl_type=self.dl_type, n_inp=self.n_inp, verbose=verbose)
     94 
     95     def dataloaders(self, source, path='.', verbose=False, **kwargs):

/content/fastai2/fastai2/data/core.py in __init__(self, items, tfms, tls, n_inp, dl_type, **kwargs)
    259     def __init__(self, items=None, tfms=None, tls=None, n_inp=None, dl_type=None, **kwargs):
    260         super().__init__(dl_type=dl_type)
--> 261         self.tls = L(tls if tls else [TfmdLists(items, t, **kwargs) for t in L(ifnone(tfms,[None]))])
    262         self.n_inp = (1 if len(self.tls)==1 else len(self.tls)-1) if n_inp is None else n_inp
    263 

/content/fastai2/fastai2/data/core.py in <listcomp>(.0)
    259     def __init__(self, items=None, tfms=None, tls=None, n_inp=None, dl_type=None, **kwargs):
    260         super().__init__(dl_type=dl_type)
--> 261         self.tls = L(tls if tls else [TfmdLists(items, t, **kwargs) for t in L(ifnone(tfms,[None]))])
    262         self.n_inp = (1 if len(self.tls)==1 else len(self.tls)-1) if n_inp is None else n_inp
    263 

/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in __call__(cls, x, *args, **kwargs)
     39             return x
     40 
---> 41         res = super().__call__(*((x,) + args), **kwargs)
     42         res._newchk = 0
     43         return res

/content/fastai2/fastai2/data/core.py in __init__(self, items, tfms, use_list, do_setup, as_item, split_idx, train_setup, splits, types, verbose)
    200         if do_setup:
    201             pv(f"Setting up {self.tfms}", verbose)
--> 202             self.setup(train_setup=train_setup)
    203 
    204     def _new(self, items, **kwargs): return super()._new(items, tfms=self.tfms, do_setup=False, types=self.types, **kwargs)

/content/fastai2/fastai2/data/core.py in setup(self, train_setup)
    213 
    214     def setup(self, train_setup=True):
--> 215         self.tfms.setup(self, train_setup)
    216         if len(self) != 0:
    217             x = super().__getitem__(0) if self.splits is None else super().__getitem__(self.splits[0])[0]

/usr/local/lib/python3.6/dist-packages/fastcore/transform.py in setup(self, items, train_setup)
    171         tfms = self.fs[:]
    172         self.fs.clear()
--> 173         for t in tfms: self.add(t,items, train_setup)
    174 
    175     def add(self,t, items=None, train_setup=False):

/usr/local/lib/python3.6/dist-packages/fastcore/transform.py in add(self, t, items, train_setup)
    174 
    175     def add(self,t, items=None, train_setup=False):
--> 176         t.setup(items, train_setup)
    177         self.fs.append(t)
    178 

/usr/local/lib/python3.6/dist-packages/fastcore/transform.py in setup(self, items, train_setup)
     66     def setup(self, items=None, train_setup=False):
     67         train_setup = train_setup if self.train_setup is None else self.train_setup
---> 68         return self.setups(getattr(items, 'train', items) if train_setup else items)
     69 
     70     def _call(self, fn, x, split_idx=None, **kwargs):

/usr/local/lib/python3.6/dist-packages/fastcore/dispatch.py in __call__(self, *args, **kwargs)
     96         if not f: return args[0]
     97         if self.inst is not None: f = MethodType(f, self.inst)
---> 98         return f(*args, **kwargs)
     99 
    100     def __get__(self, inst, owner):

/content/fastai2/fastai2/data/transforms.py in setups(self, dsets)
    200         if self.vocab is None:
    201             vals = set()
--> 202             for b in dsets: vals = vals.union(set(b))
    203             self.vocab = CategoryMap(list(vals), add_na=self.add_na)
    204 

TypeError: unhashable type: 'list'

Learn.sumary() error in 06-Object_detection.ipynb notebook

Hi
in the Practical-Deep-Learning-for-Coders-2.0, in the Computer Vision Folder, notebook 06_Object_detection.ipynb after creating
learner , executing learn.summary() raises an error.
in learn.predict , learn.show_results and learn.get_preds the same error raises.
Please help.
image

Changing header columns in df gives error while forming lm dataloader

This is my first time. So please forgive me if this is totally wrong.
Copy_of_01_Intro.zip

I faced an issue with fastai2 text module. If I change the name of the columns of the imdb dataframe from
['label','text','is_valid'] to ['['label','safe_text','valid_or_not'] using df.columns = df.columns=['label','safe_text','valid_or_not']

Then if I run,
imdb_lm = DataBlock(blocks=TextBlock.from_df('safe_text', is_lm=True),
get_x=ColReader('safe_text'),
splitter=RandomSplitter(0.1))

dls = imdb_lm.dataloaders(df, bs=64, seq_len=72)


AttributeError Traceback (most recent call last)
in ()
----> 1 dls = imdb_lm.dataloaders(df, bs=64, seq_len=72)

13 frames
/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py in getattr(self, name)
5272 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5273 return self[name]
-> 5274 return object.getattribute(self, name)
5275
5276 def setattr(self, name: str, value) -> None:

AttributeError: 'Series' object has no attribute 'safe_text'

Changing the column names is giving an error while trying to build the dataloader

04_TabNet run error

Process:
Create new virtualenv, install jupyter
Run 04_TabNet
At g just after after Graph heading I get following error:

FileNotFoundError Traceback (most recent call last)
~/.virtualenvs/pdlfc2/lib/python3.6/site-packages/pydot.py in create(self, prog, format, encoding)
1914 arguments=arguments,
-> 1915 working_dir=tmp_dir,
1916 )

~/.virtualenvs/pdlfc2/lib/python3.6/site-packages/pydot.py in call_graphviz(program, arguments, working_dir, **kwargs)
135 stdout=subprocess.PIPE,
--> 136 **kwargs
137 )

/usr/lib/python3.6/subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
728 errread, errwrite,
--> 729 restore_signals, start_new_session)
730 except:

/usr/lib/python3.6/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
1363 err_msg += ': ' + repr(err_filename)
-> 1364 raise child_exception_type(errno_num, err_msg, err_filename)
1365 raise child_exception_type(err_msg)

FileNotFoundError: [Errno 2] No such file or directory: 'dot': 'dot'

also the line 2 cells after Hide:

feat_tfmer = [*shared, *specifics]

shared has not been defined at that stage.

Lesson 3 - Cross-Validation for loop typo

The following code in Lesson 3 - Cross-Validation appears in the notebook.

skf = StratifiedKFold(n_splits=10, shuffle=True)
for _, val_idx in kf.split(np.array(train_imgs), train_labels):

However, I believe the for loop iterator should be skf.split(..) instead of kf.split(...) as the n_splits=10 is done for skf in the preceding line.
https://walkwithfastai.com/Cross_Validation

issue with CropSignal in Audio notebook

Hi. The notebooks are very helpful! However, I could not find the following function in this notebook:

CropSignal(1000)

Is it changed to CropTime(1000)?

However, in this case I get:

>>> get_y = lambda x: x.name[0]
>>> 
>>> aud_digit = DataBlock(blocks=(AudioBlock, CategoryBlock),  
...                  get_items=get_audio_files, 
...                  splitter=RandomSplitter(),
...                  item_tfms = item_tfms,
...                  get_y=get_y)
>>> 
>>> dls = aud_digit.dataloaders(path_dig, bs=64)
>>> dls.show_batch(max_n=3)
RuntimeError: stack expects each tensor to be equal size, but got [1, 128, 1076] at entry 0 and [1, 128, 431] at entry 1

Sizes of tensors must match except in dimension 0

Hi @muellerzr , in Lesson_1, on this line
dbunch.show_batch(max_n=9, figsize=(6,7))

I'm getting this error

RuntimeError                              Traceback (most recent call last)
<ipython-input-18-5a9f6693bc49> in <module>()
----> 1 dbunch.show_batch(max_n=9, figsize=(6,7))

12 frames
/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/collate.py in default_collate(batch)
     53             storage = elem.storage()._new_shared(numel)
     54             out = elem.new(storage)
---> 55         return torch.stack(batch, 0, out=out)
     56     elif elem_type.__module__ == 'numpy' and elem_type.__name__ != 'str_' \
     57             and elem_type.__name__ != 'string_':

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 180 and 403 in dimension 2 at /pytorch/aten/src/TH/generic/THTensor.cpp:689

Do you know if something in the API changed? I'm running a copy of your Lesson_1 in a colab. Also, thanks a ton for putting this together.

Tabular 01 Adults will not open

Tabular 01 Adults notebook will not open/preview in github. Brought the file into Google Colab and same issue.

Google Colab error message:
"Notebook loading error
There was an error loading this notebook. Ensure that the file is accessible and try again.
Unexpected token < in JSON at position 1576

https://drive.google.com/drive/?action=locate&id=abcd&authuser=0
Unexpected token < in JSON at position 1576
SyntaxError: Unexpected token < in JSON at position 1576
at JSON.parse ()
at Da.program_ (https://colab.research.google.com/v2/external/external_polymer_binary.js?vrz=colab-20200817-085601-RC01_327067882:1479:6)
at Fa (https://colab.research.google.com/v2/external/external_polymer_binary.js?vrz=colab-20200817-085601-RC01_327067882:19:336)
at Da.next_ (https://colab.research.google.com/v2/external/external_polymer_binary.js?vrz=colab-20200817-085601-RC01_327067882:17:474)
at Ha.next (https://colab.research.google.com/v2/external/external_polymer_binary.js?vrz=colab-20200817-085601-RC01_327067882:20:206)
at b (https://colab.research.google.com/v2/external/external_polymer_binary.js?vrz=colab-20200817-085601-RC01_327067882:20:466)
"

Notebook 3a: Tabular Data: BnDropLin -> LinBnDrop

Notebook 3a: Tabular Data does not run any more in the TabularModel you use BnDropLin. This probaly has moved it is now in local.layers and called LinBnDrop.

No worries. Thanks for putting this stuff out there.

one hot for new data : what to do if new unseen in training data set categories are located in test data

great code thanks
Practical-Deep-Learning-for-Coders-2.0/Tabular Notebooks/02_Bayesian_Optimization.ipynb

only can you clarify what to do with tabular data embedding's if new unseen in training data set categories are located in test data

it is very practicable case when new observation are located in data for prediction

for example feature month has only January and February on train data
but there are march and June in test data?

there is not one hot representation for new data
does it mean new values will be converted to all 0s or code just will crush ?

ClassConfusion won't install in Google Colab

"!pip install fastai2 ClassConfusion" is producing the following error in Google Colab (fastai2 tabular already installed):

Requirement already satisfied: fastai2 in /usr/local/lib/python3.6/dist-packages (0.0.30)
ERROR: Could not find a version that satisfies the requirement ClassConfusion (from versions: none)
ERROR: No matching distribution found for ClassConfusion

Thank you!

TabNet explainability on custom data

Hello, thank you for this repo. I am trying to run the TabNet notebook on a custom data set, have got everything working up to the explainability decorator which fails with this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-37-bfedb2755251> in <module>
----> 1 learn.explain(dl)

<ipython-input-36-c2a2fc0e0447> in explain(x, dl)
      6   for batch_nb, data in enumerate(dl):
      7     with torch.no_grad():
----> 8       out, M_loss, M_explain, masks = x.model(data[0], data[1], True)
      9     for key, value in masks.items():
     10       masks[key] = csc_matrix.dot(value.numpy(), matrix)

~/dev/Practical-Deep-Learning-for-Coders-2.0/.venv-nix/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
    725             result = self._slow_forward(*input, **kwargs)
    726         else:
--> 727             result = self.forward(*input, **kwargs)
    728         for hook in itertools.chain(
    729                 _global_forward_hooks.values(),

TypeError: forward() takes 3 positional arguments but 4 were given

I am reading the docs to better understand how to fix it, if you have any insights/pointers they would be appreciated.

'function' object has no attribute 'sizes'

I add "num_workers=0" to the dataloaders for avoid error" cuda runtime error (801) : operation not supported at ..\torch/csrc/generic/StorageSharing.cpp:247"

_dls = pascal.dataloaders(path/'train',num_workers=0)

but another error occurred which said "AttributeError: 'function' object has no attribute 'sizes'"!

learn.fit_one_cycle(10, slice(1e-5, 1e-4))

AttributeError Traceback (most recent call last)
in
----> 1 learn.fit_one_cycle(10, slice(1e-5, 1e-4))

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastcore\logargs.py in _f(*args, **kwargs)
54 init_args.update(log)
55 setattr(inst, 'init_args', init_args)
---> 56 return inst if to_return else f(*args, **kwargs)
57 return _f

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\callback\schedule.py in fit_one_cycle(self, n_epoch, lr_max, div, div_final, pct_start, wd, moms, cbs, reset_opt)
111 scheds = {'lr': combined_cos(pct_start, lr_max/div, lr_max, lr_max/div_final),
112 'mom': combined_cos(pct_start, *(self.moms if moms is None else moms))}
--> 113 self.fit(n_epoch, cbs=ParamScheduler(scheds)+L(cbs), reset_opt=reset_opt, wd=wd)
114
115 # Cell

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastcore\logargs.py in _f(*args, **kwargs)
54 init_args.update(log)
55 setattr(inst, 'init_args', init_args)
---> 56 return inst if to_return else f(*args, **kwargs)
57 return _f

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in fit(self, n_epoch, lr, wd, cbs, reset_opt)
205 self.opt.set_hypers(lr=self.lr if lr is None else lr)
206 self.n_epoch = n_epoch
--> 207 self._with_events(self._do_fit, 'fit', CancelFitException, self._end_cleanup)
208
209 def _end_cleanup(self): self.dl,self.xb,self.yb,self.pred,self.loss = None,(None,),(None,),None,None

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
--> 155 try: self(f'before
{event_type}') ;f()
156 except ex: self(f'after_cancel
{event_type}')
157 finally: self(f'after_{event_type}') ;final()

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in _do_fit(self)
195 for epoch in range(self.n_epoch):
196 self.epoch=epoch
--> 197 self._with_events(self._do_epoch, 'epoch', CancelEpochException)
198
199 @log_args(but='cbs')

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
--> 155 try: self(f'before
{event_type}') ;f()
156 except ex: self(f'after_cancel
{event_type}')
157 finally: self(f'after_{event_type}') ;final()

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in _do_epoch(self)
189
190 def _do_epoch(self):
--> 191 self._do_epoch_train()
192 self._do_epoch_validate()
193

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in _do_epoch_train(self)
181 def _do_epoch_train(self):
182 self.dl = self.dls.train
--> 183 self._with_events(self.all_batches, 'train', CancelTrainException)
184
185 def _do_epoch_validate(self, ds_idx=1, dl=None):

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
--> 155 try: self(f'before
{event_type}') ;f()
156 except ex: self(f'after_cancel
{event_type}')
157 finally: self(f'after_{event_type}') ;final()

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in all_batches(self)
159 def all_batches(self):
160 self.n_iter = len(self.dl)
--> 161 for o in enumerate(self.dl): self.one_batch(*o)
162
163 def _do_one_batch(self):

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in one_batch(self, i, b)
177 self.iter = i
178 self._split(b)
--> 179 self._with_events(self._do_one_batch, 'batch', CancelBatchException)
180
181 def _do_epoch_train(self):

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
--> 155 try: self(f'before
{event_type}') ;f()
156 except ex: self(f'after_cancel
{event_type}')
157 finally: self(f'after_{event_type}') ;final()

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\fastai2\learner.py in _do_one_batch(self)
164 self.pred = self.model(*self.xb)
165 self('after_pred')
--> 166 if len(self.yb): self.loss = self.loss_func(self.pred, *self.yb)
167 self('after_loss')
168 if not self.training or not len(self.yb): return

D:\Users\fanyo\Anaconda3\envs\fastai2\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),

D:\fastai2.0\nbs\files\Practical-Deep-Learning-for-Coders-2.0-master\Computer Vision\imports\metrics.py in forward(self, output, bbox_tgts, clas_tgts)
147 def forward(self, output, bbox_tgts, clas_tgts):
148 bbox_preds, clas_preds = output
--> 149 sizes = self.model.sizes
150 if self._change_anchors(sizes): self._create_anchors(sizes, clas_preds.device)
151 n_classes = clas_preds.size(2)

AttributeError: 'function' object has no attribute 'sizes'

TypeError: object of type 'int' has no len()

Hi, I am running the following notebook but getting:
https://github.com/muellerzr/Practical-Deep-Learning-for-Coders-2.0/blob/master/Computer%20Vision/06_Object_Detection.ipynb

>>> ratios = [1/2,1,2]
>>> scales = [1,2**(-1/3), 2**(-2/3)]
>>> crit = RetinaNetFocalLoss(scales=scales, ratios=ratios)
>>> def _retinanet_split(m): return L(m.encoder,nn.Sequential(m.c5top6, m.p6top7, m.merges, m.smoothers, m.classifier, m.box_regressor)).map(params)
... learn = Learner(dls, arch, loss_func=crit, splitter=_retinanet_split)
>>> 
>>> learn.freeze()
>>> 
>>> learn.summary()
TypeError: object of type 'int' has no len()
learn.lr_find()

/pytorch/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [0,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/pytorch/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [1,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/pytorch/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [2,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/pytorch/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [3,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/pytorch/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [4,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/pytorch/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [5,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/pytorch/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [6,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/pytorch/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [0,0,0], thread: [7,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.

Much time for ShapInterpretation

Hi. Thanks for the interesting and useful notebooks. However, why ShapInterpretation requires a lot of time for processing? For example, for the Adult dataset? And is this the expected behavior?

34%|███▎      | 43/128 [06:01<11:53,  8.39s/it]

default path is a hidden folder

When using the untar_data function by default the data are downloaded In ~/.fastai/data
I think it creates issues to have these data downloaded in a hidden folder for beginners because we cannot find the data using the explorer and this creates a massive hidden folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.