Weird error on training the model on multi label classification task. (Please help)
#18
by
vigneshwar472
- opened
I was training vit base on MLRS net dataset (https://huggingface.co/datasets/vigneshwar472/MLRS-Net-for-modelling). It is a multilabel classification task.
I will also share the kaggle kernel.
https://www.kaggle.com/code/vigneshwar472/multilabel-classification
I got this error when I run the last cell(training model).
RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/opt/conda/lib/python3.10/site-packages/torch/nn/parallel/parallel_apply.py", line 85, in _worker
output = module(*input, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/transformers/models/vit/modeling_vit.py", line 867, in forward
loss = loss_fct(logits, labels)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/loss.py", line 725, in forward
return F.binary_cross_entropy_with_logits(input, target,
File "/opt/conda/lib/python3.10/site-packages/torch/nn/functional.py", line 3195, in binary_cross_entropy_with_logits
return torch.binary_cross_entropy_with_logits(input, target, weight, pos_weight, reduction_enum)
RuntimeError: result type Float can't be cast to the desired output type Long
This error is kinda weird. I am not understanding where to resolve and what to resolve.
Please help me