transformers - 💡(How to fix) Fix Feature request: Support evaluation every N epochs in TrainingArguments [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
huggingface/transformers#45308Fetched 2026-04-09 07:50:50
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
commented ×1labeled ×1mentioned ×1subscribed ×1
RAW_BUFFERClick to expand / collapse

Feature request

Currently, Trainer supports evaluation strategies:

  • "epoch": evaluate every epoch
  • "steps": evaluate every N steps

However, there is no built-in way to evaluate every N epochs (e.g., every 5 epochs).

This is particularly useful when:

  • evaluation is computationally expensive
  • running large-scale training
  • benchmarking periodically instead of every epoch

Suggested API:

  • Add parameter like eval_epochs (int)
  • Or extend eval_strategy="epoch" to support frequency

Example: eval_strategy="epoch" eval_epochs=5 # evaluate every 5 epochs

Currently, this requires custom Trainer overrides or callbacks.

Motivation

Your contribution

extent analysis

TL;DR

Add an eval_epochs parameter to the Trainer's evaluation strategy to support evaluating every N epochs.

Guidance

  • Introduce a new parameter eval_epochs as an integer to specify the evaluation frequency in epochs.
  • Extend the existing eval_strategy="epoch" to accept an additional eval_epochs parameter for custom evaluation intervals.
  • Update the Trainer's logic to respect the eval_epochs parameter when eval_strategy is set to "epoch".
  • Consider adding input validation to ensure eval_epochs is a positive integer.

Example

trainer = Trainer(
    eval_strategy="epoch",
    eval_epochs=5,  # Evaluate every 5 epochs
    # ... other parameters ...
)
``

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING