I am not sure what is causing this error. I am trying to run your notebook as is. As I understand I am doing exactly same things as you. So it should work without modification i guess. Could it be pytorch version is different? my local fast.ai version is the latest git pull.
this cell from your notebook:
learn = get_learner(wrn_22(), 512)
learn.lr_find(wds=1e-4);
learn.sched.plot(n_skip_end=1)
gives this error:
TypeError Traceback (most recent call last)
in ()
1 learn = get_learner(wrn_22(), 512)
----> 2 learn.lr_find(wds=1e-4);
3 learn.sched.plot(n_skip_end=1)
~/fastai/courses/dl2/fastai/learner.py in lr_find(self, start_lr, end_lr, wds, linear, **kwargs)
328 layer_opt = self.get_layer_opt(start_lr, wds)
329 self.sched = LR_Finder(layer_opt, len(self.data.trn_dl), end_lr, linear=linear)
–> 330 self.fit_gen(self.model, self.data, layer_opt, 1, **kwargs)
331 self.load(‘tmp’)
332
~/fastai/courses/dl2/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()
~/fastai/courses/dl2/fastai/model.py in fit(model, data, n_epochs, opt, crit, metrics, callbacks, stepper, swa_model, swa_start, swa_eval_freq, **kwargs)
148
149 if not all_val:
–> 150 vals = validate(model_stepper, cur_data.val_dl, metrics)
151 stop=False
152 for cb in callbacks: stop = stop or cb.on_epoch_end(vals)
~/fastai/courses/dl2/fastai/model.py in validate(stepper, dl, metrics)
209 else: batch_cnts.append(len(x))
210 loss.append(to_np(l))
–> 211 res.append([f(preds.data, y) for f in metrics])
212 return [np.average(loss, 0, weights=batch_cnts)] + list(np.average(np.stack(res), 0, weights=batch_cnts))
213
~/fastai/courses/dl2/fastai/model.py in (.0)
209 else: batch_cnts.append(len(x))
210 loss.append(to_np(l))
–> 211 res.append([f(preds.data, y) for f in metrics])
212 return [np.average(loss, 0, weights=batch_cnts)] + list(np.average(np.stack(res), 0, weights=batch_cnts))
213
~/fastai/courses/dl2/fastai/metrics.py in accuracy(preds, targs)
8 def accuracy(preds, targs):
9 preds = torch.max(preds, dim=1)[1]
—> 10 return (preds==targs).float().mean()
11
12 def accuracy_thresh(thresh):
~/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/tensor.py in eq(self, other)
358
359 def eq(self, other):
–> 360 return self.eq(other)
361
362 def ne(self, other):
TypeError: eq received an invalid combination of arguments - got (torch.LongTensor), but expected one of:
- (int value)
didn’t match because some of the arguments have invalid types: (torch.LongTensor)
- (torch.cuda.LongTensor other)
didn’t match because some of the arguments have invalid types: (torch.LongTensor)