annotated-transformer icon indicating copy to clipboard operation
annotated-transformer copied to clipboard

Epoch Training: Help

Open ludwigwittgenstein2 opened this issue 3 years ago • 1 comments

Not sure, what is wrong? Any suggestions

/usr/local/lib/python3.7/dist-packages/torch/nn/reduction.py:42: UserWarning: size_average and reduce args will be deprecated, please use reduction='sum' instead. warnings.warn(warning.format(ret)) /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:20: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform.

TypeError Traceback (most recent call last) in () 9 model.train() 10 run_epoch(data_gen(V, 30, 20), model, ---> 11 SimpleLossCompute(model.generator, criterion, model_opt)) 12 13 model.eval()

10 frames in forward(self, x) 7 8 def forward(self,x): ----> 9 mean = x.mean(-1, keepdmin=True) 10 std=x.std(-1, keepdim=True) 11 return self.a_2 * (x-mean)/(std+self.eps)+self.b_2

TypeError: mean() received an invalid combination of arguments - got (int, keepdmin=bool), but expected one of:

  • (*, torch.dtype dtype) didn't match because some of the keywords were incorrect: keepdmin
  • (tuple of ints dim, bool keepdim, *, torch.dtype dtype)
  • (tuple of names dim, bool keepdim, *, torch.dtype dtype)

ludwigwittgenstein2 avatar Jun 20 '22 21:06 ludwigwittgenstein2

----> 9 mean = x.mean(-1, keepdmin=True) keepdmin is a typo, the correct argument is keepdim

pengzhangzhi avatar Jul 13 '22 12:07 pengzhangzhi