question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

parameter `ignore_keys` of `trainer.predict` not accessible in `Trainer` or `TrainingArguments`

See original GitHub issue

🚀 Feature request

The predict and evaluate methods of the Trainer class provide an excellent option of ignore_keys. Here is a small example:

trainer.predict(dataset, ignore_keys=["ner_loss", "cls_loss", "ner_logits", "cls_logits"])

@sgugger

This option is however, not accessible during the normal setup of defining TrainingArguments class nor the Trainer class so the a call to trainer.train() leads to errors during the mid-training evaluation.

Motivation

I am unable to evaluate the model metrics on the validation set during the training to see if makes sense to continue.

Your contribution

I am happy to make a PR if this is seen as a genuine problem. Like always, may be I am missing something.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sguggercommented, May 14, 2021

We could add an argument for this (like ignore_keys_for_eval) yes. Let me know if you want to tackle this!

0reactions
sguggercommented, Jun 26, 2021

Sure! Ping me when you open a PR 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trainer - Hugging Face
predict — Returns predictions (with metrics if labels are available) on a test set. The Trainer class is optimized for Transformers models and...
Read more >
HuggingFace Trainer do predictions - Stack Overflow
I've been fine-tuning a Model from HuggingFace via the Trainer -Class. I went through the Training Process via trainer.train() and also ...
Read more >
Fine-tuning pretrained NLP models with Huggingface's Trainer
We can define the training parameters in the TrainingArguments and Trainer class as well as train the model with a single command. We...
Read more >
Question Answering | transformerlab
This argument is not directly used by :class: ~transformers.Trainer , it's intended to be used by your training/evaluation scripts instead.
Read more >
Huggingface is all you need for NLP and beyond | Jarvislabs.ai
Explore how to use Huggingface Datasets, Trainer, Dynamic Padding, ... which might not get noticed quickly because Deep Learning code is the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found