Error in learn.fit() lesson 1


(Rahul Khapre) #1

I tried to use the code in lesson 1 to art-images-drawings-painting-sculpture-engraving dataset from kaggle.I made sufficient changes to the code for it to work right.But the learn.fit() method shows this error.Please help


epoch trn_loss val_loss accuracy


AttributeError Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
55 try:
—> 56 return getattr(obj, method)(*args, **kwds)
57

AttributeError: ‘list’ object has no attribute ‘round’

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
in ()
9 )
10 learn = ConvLearner.pretrained(arch, data, precompute=True, tmp_name=TMP_PATH, models_name=MODEL_PATH)
—> 11 learn.fit(0.01,3)

/opt/conda/lib/python3.6/site-packages/fastai/learner.py in fit(self, lrs, n_cycle, wds, **kwargs)
285 self.sched = None
286 layer_opt = self.get_layer_opt(lrs, wds)
–> 287 return self.fit_gen(self.model, self.data, layer_opt, n_cycle, **kwargs)
288
289 def warm_up(self, lr, wds=None):

/opt/conda/lib/python3.6/site-packages/fastai/learner.py in fit_gen(self, model, data, layer_opt, n_cycle, cycle_len, cycle_mult, cycle_save_name, best_save_name, use_clr, use_clr_beta, metrics, callbacks, use_wd_sched, norm_wds, wds_sched_mult, use_swa, swa_start, swa_eval_freq, **kwargs)
232 metrics=metrics, callbacks=callbacks, reg_fn=self.reg_fn, clip=self.clip, fp16=self.fp16,
233 swa_model=self.swa_model if use_swa else None, swa_start=swa_start,
–> 234 swa_eval_freq=swa_eval_freq, **kwargs)
235
236 def get_layer_groups(self): return self.models.get_layer_groups()

/opt/conda/lib/python3.6/site-packages/fastai/model.py in fit(model, data, n_epochs, opt, crit, metrics, callbacks, stepper, swa_model, swa_start, swa_eval_freq, **kwargs)
158
159 if epoch == 0: print(layout.format(*names))
–> 160 print_stats(epoch, [debias_loss] + vals)
161 ep_vals = append_stats(ep_vals, epoch, [debias_loss] + vals)
162 if stop: break

/opt/conda/lib/python3.6/site-packages/fastai/model.py in print_stats(epoch, values, decimals)
171 def print_stats(epoch, values, decimals=6):
172 layout = “{!s:^10}” + " {!s:10}" * len(values)
–> 173 values = [epoch] + list(np.round(values, decimals))
174 print(layout.format(*values))
175

/opt/conda/lib/python3.6/site-packages/numpy/core/fromnumeric.py in round_(a, decimals, out)
3380 around : equivalent function; see for details.
3381 “”"
-> 3382 return around(a, decimals=decimals, out=out)
3383
3384

/opt/conda/lib/python3.6/site-packages/numpy/core/fromnumeric.py in around(a, decimals, out)
3005
3006 “”"
-> 3007 return _wrapfunc(a, ‘round’, decimals=decimals, out=out)
3008
3009

/opt/conda/lib/python3.6/site-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
64 # a downstream library like ‘pandas’.
65 except (AttributeError, TypeError):
—> 66 return _wrapit(obj, method, *args, **kwds)
67
68

/opt/conda/lib/python3.6/site-packages/numpy/core/fromnumeric.py in _wrapit(obj, method, *args, **kwds)
44 except AttributeError:
45 wrap = None
—> 46 result = getattr(asarray(obj), method)(*args, **kwds)
47 if wrap:
48 if not isinstance(result, mu.ndarray):

AttributeError: ‘float’ object has no attribute ‘rint’


(David P Eisenberg) #2

I am having the exact same problem in the PASCAL VOC notebook for lesson 8


(David P Eisenberg) #3

FYI, there is a more active forum page looking into this issue.

Some people seem to have gotten something to work, but I haven’t yet. If you get your system working, please let me know


(David P Eisenberg) #4

I got the learn.fit() function to work by deprecating numpy. It looks like the newest version of numpy causes problems. downgrade to numpy 1.15.1

!pip intall numpy==1.15.1


Unfamiliar Error when Running learn.fit()
(ashis) #5

Is any one facing this as well:-