Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No loss #133

Open
10 tasks
angelusualle opened this issue Mar 18, 2024 · 0 comments
Open
10 tasks

No loss #133

angelusualle opened this issue Mar 18, 2024 · 0 comments

Comments

@angelusualle
Copy link

Information

The problem arises in chapter:

  • Introduction
  • [ x] Text Classification
  • Transformer Anatomy
  • Multilingual Named Entity Recognition
  • Text Generation
  • Summarization
  • Question Answering
  • Making Transformers Efficient in Production
  • Dealing with Few to No Labels
  • Training Transformers from Scratch
  • Future Directions

Describe the bug

I ran the


trainer = Trainer(model=model, args=training_args,
                  compute_metrics=compute_metrics,
                  train_dataset=emotions_encoded["train"],
                  eval_dataset=emotions_encoded["validation"],
                  tokenizer=tokenizer)
trainer.train();

section, and got an error complaining about no loss in the outputs:

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.

Turns out AutoModelForSequenceClassification was expecting labels, not label. so I relabeled:

def relabel(batch):
    return {'labels': batch["label"]}
emotions_encoded = emotions_encoded.map(relabel)
emotions_encoded.column_names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant