Technical Overview
Recent updates to the Hugging Face transformers library (v4.46+) officially deprecated and subsequently removed the evaluation_strategy parameter in favor of eval_strategy. Conversely, environments pinned to older stable versions of transformers (e.g., v4.22.x) do not recognize eval_strategy and will throw immediate initialization exceptions.
Affected Modules
- File:
src/train.py
- Target Class:
Seq2SeqTrainingArguments (Line 111-138)
Detailed Traceback / Context
When running on legacy runtimes:
TypeError: __init__() got an unexpected keyword argument 'eval_strategy'
When running on modern runtimes with deprecated keys:
FutureWarning: The 'evaluation_strategy' argument is deprecated and will be removed in a future version, use 'eval_strategy' instead.
Acceptance Criteria
- Zero-Crash Execution: The training pipeline initializes seamlessly across both legacy (v4.22.0) and modern (v4.48+) environments.
- Behavioral Parity: Validation evaluation steps occur at the designated
save_steps and eval_steps regardless of which underlying key is utilized.
- No Hardcoding: The script must dynamically inspect the environment rather than using hardcoded try-except blocks that swallow other valid parameters.
Proposed Implementation Approach
Implement a dynamic parameter mapping layer inside the argument dictionary definition prior to class instantiation:
import inspect
from transformers import Seq2SeqTrainingArguments
eval_param = "eval_strategy" if hasattr(Seq2SeqTrainingArguments, "eval_strategy") else "evaluation_strategy"
training_args_dict = {
# ... other standard arguments
eval_param: "steps",
}
training_args = Seq2SeqTrainingArguments(**training_args_dict)
Severity & Priority
- Severity: High (Blocks startup on mismatching environments)
- Priority: P1
Technical Overview
Recent updates to the Hugging Face
transformerslibrary (v4.46+) officially deprecated and subsequently removed theevaluation_strategyparameter in favor ofeval_strategy. Conversely, environments pinned to older stable versions oftransformers(e.g., v4.22.x) do not recognizeeval_strategyand will throw immediate initialization exceptions.Affected Modules
src/train.pySeq2SeqTrainingArguments(Line 111-138)Detailed Traceback / Context
When running on legacy runtimes:
When running on modern runtimes with deprecated keys:
Acceptance Criteria
save_stepsandeval_stepsregardless of which underlying key is utilized.Proposed Implementation Approach
Implement a dynamic parameter mapping layer inside the argument dictionary definition prior to class instantiation:
Severity & Priority