huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
134.02k stars 26.8k forks source link

ValueError: The model did not return a loss from the inputs, only the following keys: logits. For reference, the inputs it received are input_ids,attention_mask,pixel_values,aspect_ratio_ids,aspect_ratio_mask,cross_attention_mask #34392

Open youky860423 opened 2 days ago

youky860423 commented 2 days ago

System Info

ValueError: The model did not return a loss from the inputs, only the following keys: logits. For reference, the inputs it received are input_ids,attention_mask,pixel_values,aspect_ratio_ids,aspect_ratio_mask,cross_attention_mask

Who can help?

No response

Information

Tasks

Reproduction

  1. Call trainer.train();
  2. system return error for no logits

Expected behavior

successfully running forward and compute loss

zucchini-nlp commented 1 day ago

Hey, you need to provide labels to get the loss calculated