A Tensor with 66 elements cannot be converted to Scalar

Hi,
Im trying to fine-tune the “NlpHUST/gpt-neo-vi-small” model but when I executed training_output = trainer.train() i got this error:

`> File [d:\App\conda\envs\tipo\Lib\site-packages\transformers\data\data_collator.py:139](file:///D:/App/conda/envs/tipo/Lib/site-packages/transformers/data/data_collator.py:139), in torch_default_data_collator(features)

[135](file:///D:/App/conda/envs/tipo/Lib/site-packages/transformers/data/data_collator.py:135) # Special handling for labels.
[136](file:///D:/App/conda/envs/tipo/Lib/site-packages/transformers/data/data_collator.py:136) # Ensure that tensor is created with the correct type
[137](file:///D:/App/conda/envs/tipo/Lib/site-packages/transformers/data/data_collator.py:137) # (it should be automatically the case, but let’s make sure of it.)
[138](file:///D:/App/conda/envs/tipo/Lib/site-packages/transformers/data/data_collator.py:138) if “label” in first and first[“label”] is not None: → [139](file:///D:/App/conda/envs/tipo/Lib/site-packages/transformers/data/data_collator.py:139) label = first[“label”].item() if isinstance(first[“label”], torch.Tensor) else first[“label”]
[140](file:///D:/App/conda/envs/tipo/Lib/site-packages/transformers/data/data_collator.py:140) dtype = torch.long if isinstance(label, int) else torch.float
[141](file:///D:/App/conda/envs/tipo/Lib/site-packages/transformers/data/data_collator.py:141) batch[“labels”] = torch.tensor([f[“label”] for f in features], dtype=dtype)
Runtime error: a Tensor with 66 elements cannot be converted to Scalar`

I searched for same issue but I found nothing

I’m running with
windows 10
python 3.11.7
torch 2.1.2+cu121
cuda 12.3 (the gpu is rtx2060)
transformers 4.37.1

thanks for help

Summary

This text will be hidden