-
Notifications
You must be signed in to change notification settings - Fork 349
Description
i am trying to run simple PETS dataset training.
when i use the following simple learner with label smooth:
learn = cnn_learner(dbunch, resnet34, metrics=[accuracy, top_k_accuracy], loss_func=LabelSmoothingCrossEntropy()) learn.fit_one_cycle(4)
i get the following error immediately when the training starts:
File "...\fastai2\layers.py", line 254, in forward
return loss*self.eps/c + (1-self.eps) * F.nll_loss(log_preds, target, reduction=self.reduction)
File "D:\Anaconda3\envs\torch_conda\lib\site-packages\torch\nn\functional.py", line 1824, in nll_loss
ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: Expected object of scalar type Long but got scalar type Int for argument #2 'target'
if i use CrossEntropyLossFlat loss instead, i get an error at the validation phase:
File "...\fastai2\metrics.py", line 76, in accuracy
return (pred == targ).float().mean()
File "...\fastai2\torch_core.py", line 176, in _f
res = getattr(super(TensorBase, self), fn)(*args, **kwargs)
RuntimeError: Expected object of scalar type Int but got scalar type Long for argument #2 'other'
Thanks