Skip to content

Remove TrainingArguments import from experimental trainers#5290

Open
albertvillanova wants to merge 1 commit intohuggingface:mainfrom
albertvillanova:fu-5257-5274
Open

Remove TrainingArguments import from experimental trainers#5290
albertvillanova wants to merge 1 commit intohuggingface:mainfrom
albertvillanova:fu-5257-5274

Conversation

@albertvillanova
Copy link
Member

@albertvillanova albertvillanova commented Mar 16, 2026

Remove TrainingArguments import from experimental trainers.

This PR refactors multiple experimental trainer configuration files to remove direct dependencies on transformers.TrainingArguments and instead rely on the project's own _BaseConfig for managing valid dictionary fields. This change improves modularity and reduces external coupling across the configuration classes.

Follow-up to:

Changes

Dependency and configuration updates:

  • Removed the import of TrainingArguments from all experimental config files (BCOConfig, CPOConfig, KTOConfig, OnlineDPOConfig, ORPOConfig) to eliminate unnecessary dependency.
  • Changed the assignment of _VALID_DICT_FIELDS in each config class to use _BaseConfig._VALID_DICT_FIELDS instead of TrainingArguments._VALID_DICT_FIELDS, ensuring consistency and reducing external dependency.

Note

Low Risk
Low risk refactor that only changes how experimental configs derive _VALID_DICT_FIELDS; runtime impact should be limited to argument/dict field validation if _BaseConfig._VALID_DICT_FIELDS differs from TrainingArguments in a given transformers version.

Overview
Removes the TrainingArguments import from several experimental trainer config modules (BCOConfig, CPOConfig, KTOConfig, OnlineDPOConfig, ORPOConfig).

Each config now sets _VALID_DICT_FIELDS based on _BaseConfig._VALID_DICT_FIELDS (plus model_init_kwargs) rather than TrainingArguments._VALID_DICT_FIELDS, reducing direct coupling to transformers in these experimental configs.

Written by Cursor Bugbot for commit c2e93cc. This will update automatically on new commits. Configure here.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

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

Successfully merging this pull request may close these issues.

2 participants