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

🚨🚨🚨Deprecate evaluation_strategy to eval_strategy🚨🚨🚨 #30190

Merged
merged 8 commits into from
Apr 18, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/transformers/training_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import math
import os
import warnings
from dataclasses import asdict, dataclass, field, fields
from dataclasses import InitVar, asdict, dataclass, field, fields
from datetime import timedelta
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -203,7 +203,7 @@ class TrainingArguments:
Whether to run predictions on the test set or not. This argument is not directly used by [`Trainer`], it's
intended to be used by your training/evaluation scripts instead. See the [example
scripts](https://github.com/huggingface/transformers/tree/main/examples) for more details.
evaluation_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"no"`):
evaluation_strategy (or eval_strategy) (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"no"`):
The evaluation strategy to adopt during training. Possible values are:

- `"no"`: No evaluation is done during training.
Expand Down Expand Up @@ -737,6 +737,10 @@ class TrainingArguments:
default="no",
metadata={"help": "The evaluation strategy to use."},
)
eval_strategy: InitVar[Union[IntervalStrategy, str]] = field(
default=None,
metadata={"help": "Alias for `evaluation_strategy`."},
)
prediction_loss_only: bool = field(
default=False,
metadata={"help": "When performing evaluation and predictions, only returns the loss."},
Expand Down Expand Up @@ -1393,6 +1397,10 @@ def __post_init__(self):
if self.disable_tqdm is None:
self.disable_tqdm = logger.getEffectiveLevel() > logging.WARN

# Deal with alias
if self.eval_strategy is not None:
self.evaluation_strategy = self.eval_strategy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to deal with both evaluation_strategy and eval_strategy being set (even if very unlikely)


if isinstance(self.evaluation_strategy, EvaluationStrategy):
warnings.warn(
"using `EvaluationStrategy` for `evaluation_strategy` is deprecated and will be removed in version 5"
Expand Down
Loading