./envname/lib/python3.6/site-packages/torch/nn/parallel/_functions.py:61: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.
warnings.warn('Was asked to gather along dimension 0, but all '
/pytorch/torch/csrc/utils/python_argparser.cpp:756: UserWarning: This overload of add is deprecated:
add(Number alpha, Tensor other)
Consider using one of the following signatures instead:
add(Tensor other, , Number alpha)
Traceback (most recent call last):████████████████████████████████████████████████████████████████████| 100.00% [13183/13183 50:49<00:00]19:11:06]
File "trainClassifier.py", line 75, in
learner.fit(args.num_train_epochs, args.learning_rate, validate=True)
File "./envname/lib/python3.6/site-packages/fast_bert/learner_cls.py", line 422, in fit
results = self.validate()
File "./envname/lib/python3.6/site-packages/fast_bert/learner_cls.py", line 544, in validate
all_logits, all_labels
File "./envname/lib/python3.6/site-packages/fast_bert/metrics.py", line 38, in accuracy_thresh
return ((y_pred > thresh) == y_true.bool()).float().mean().item()
File "./envname/lib/python3.6/site-packages/torch/tensor.py", line 28, in wrapped
return f(args, **kwargs)
RuntimeError: The size of tensor a (5) must match the size of tensor b (210916) at non-singleton dimension 1
I am getting this error on running the code -
./envname/lib/python3.6/site-packages/torch/nn/parallel/_functions.py:61: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector. warnings.warn('Was asked to gather along dimension 0, but all ' /pytorch/torch/csrc/utils/python_argparser.cpp:756: UserWarning: This overload of add is deprecated: add(Number alpha, Tensor other) Consider using one of the following signatures instead: add(Tensor other, , Number alpha) Traceback (most recent call last):████████████████████████████████████████████████████████████████████| 100.00% [13183/13183 50:49<00:00]19:11:06] File "trainClassifier.py", line 75, in
learner.fit(args.num_train_epochs, args.learning_rate, validate=True)
File "./envname/lib/python3.6/site-packages/fast_bert/learner_cls.py", line 422, in fit
results = self.validate()
File "./envname/lib/python3.6/site-packages/fast_bert/learner_cls.py", line 544, in validate
all_logits, all_labels
File "./envname/lib/python3.6/site-packages/fast_bert/metrics.py", line 38, in accuracy_thresh
return ((y_pred > thresh) == y_true.bool()).float().mean().item()
File "./envname/lib/python3.6/site-packages/torch/tensor.py", line 28, in wrapped
return f( args, **kwargs)
RuntimeError: The size of tensor a (5) must match the size of tensor b (210916) at non-singleton dimension 1
Code is -
Environment: Version: 1.7.1