I’ve also been trying to process the Titanic kaggle dataset. However, when I get to the part where I try and run a prediction on the test dataset I get an error.
pred_test=m.predict(True)
RuntimeError Traceback (most recent call last)
in ()
----> 1 pred_test=m.predict(True)
~/fastai/courses/dl1/fastai/learner.py in predict(self, is_test, use_swa)
355 dl = self.data.test_dl if is_test else self.data.val_dl
356 m = self.swa_model if use_swa else self.model
–> 357 return predict(m, dl)
358
359 def predict_with_targs(self, is_test=False, use_swa=False):
~/fastai/courses/dl1/fastai/model.py in predict(m, dl)
219
220 def predict(m, dl):
–> 221 preda,_ = predict_with_targs_(m, dl)
222 return to_np(torch.cat(preda))
223
~/fastai/courses/dl1/fastai/model.py in predict_with_targs_(m, dl)
231 if hasattr(m, ‘reset’): m.reset()
232 res = []
–> 233 for *x,y in iter(dl): res.append([get_prediction(m(*VV(x))),y])
234 return zip(*res)
235
~/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
355 result = self._slow_forward(*input, **kwargs)
356 else:
–> 357 result = self.forward(*input, **kwargs)
358 for hook in self._forward_hooks.values():
359 hook_result = hook(self, input, result)
~/fastai/courses/dl1/fastai/column_data.py in forward(self, x_cat, x_cont)
116 x = self.emb_drop(x)
117 if self.n_cont != 0:
–> 118 x2 = self.bn(x_cont)
119 x = torch.cat([x, x2], 1) if self.n_emb != 0 else x2
120 for l,d,b in zip(self.lins, self.drops, self.bns):
~/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
355 result = self._slow_forward(*input, **kwargs)
356 else:
–> 357 result = self.forward(*input, **kwargs)
358 for hook in self._forward_hooks.values():
359 hook_result = hook(self, input, result)
~/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py in forward(self, input)
35 return F.batch_norm(
36 input, self.running_mean, self.running_var, self.weight, self.bias,
—> 37 self.training, self.momentum, self.eps)
38
39 def repr(self):
~/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/nn/functional.py in batch_norm(input, running_mean, running_var, weight, bias, training, momentum, eps)
1011 raise ValueError(‘Expected more than 1 value per channel when training, got input size {}’.format(size))
1012 f = torch._C._functions.BatchNorm(running_mean, running_var, training, momentum, eps, torch.backends.cudnn.enabled)
-> 1013 return f(input, weight, bias)
1014
1015
RuntimeError: running_mean should contain 2 elements not 1
Anyone have any ideas? For a bit of background I just adapted the Rossman example from dl1 courses. I’ve been able to build a model so I’m not sure what I’m doing wrong.
If it’s helpful here is my notebook on github.