-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[ORPO] Move ORPOTrainer to experimental #4480
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
base: main
Are you sure you want to change the base?
Conversation
- Move ORPOTrainer and ORPOConfig to trl.experimental.orpo - Add deprecation warnings in trl.trainer with removal planned for TRL 0.29.0 - Update imports in tests, examples, and documentation - Maintain backward compatibility through deprecation stubs Fixes #4465
|
nice, you'll need to replace all |
docs/source/orpo_trainer.md
Outdated
| [[autodoc]] ORPOTrainer | ||
| - train | ||
| - save_model | ||
| - push_to_hub | ||
|
|
||
| ## ORPOConfig | ||
|
|
||
| [[autodoc]] ORPOConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to update this as well
[[autodoc]] experimental.orpo.ORPOTrainer
[[autodoc]] experimental.orpo.ORPOConfig
| from .orpo_config import ORPOConfig | ||
| from .orpo_trainer import ORPOTrainer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to revert this change, otherwise from trl import ORPOTrainer won't work anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you move this file to tests/experimental
trl/trainer/orpo_trainer.py
Outdated
|
|
||
| from ..data_utils import maybe_apply_chat_template, maybe_extract_prompt | ||
| from .base_trainer import BaseTrainer | ||
| from ..experimental.orpo import ORPOTrainer as ExperimentalORPOTrainer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| from ..experimental.orpo import ORPOTrainer as ExperimentalORPOTrainer | |
| from ..experimental.orpo import ORPOTrainer as _ORPOTrainer |
for consistency
trl/trainer/orpo_trainer.py
Outdated
|
|
||
| if is_wandb_available(): | ||
| import wandb | ||
| class ORPOTrainer(ExperimentalORPOTrainer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| class ORPOTrainer(ExperimentalORPOTrainer): | |
| class ORPOTrainer(_ORPOTrainer): |
|
there are some tests in |
| from ..base_trainer import BaseTrainer | ||
| from .orpo_config import ORPOConfig | ||
| from ..utils import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| from ..base_trainer import BaseTrainer | |
| from .orpo_config import ORPOConfig | |
| from ..utils import ( | |
| from ...trainer.base_trainer import BaseTrainer | |
| from .orpo_config import ORPOConfig | |
| from ...trainer.utils import ( |
|
|
||
| import numpy as np | ||
| import pandas as pd | ||
| import torch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
torch import should remain, some type hints need it
- Restore ORPO imports in trl/trainer/__init__.py for backward compatibility - Fix deprecation stub naming from ExperimentalORPOTrainer to _ORPOTrainer - Add torch import to deprecation stub for type hints - Fix relative import paths in trl/experimental/orpo/orpo_trainer.py - Update autodoc references to experimental.orpo.ORPOTrainer - Update all documentation references to use experimental namespace - Move ORPO test from test_trainers_args.py to experimental/test_trainers_args.py
|
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. |
- Remove unused 'import os' and 'import warnings' from trl/experimental/orpo/orpo_trainer.py - Remove unused 'from typing import Any' from trl/trainer/orpo_trainer.py
Summary
This PR moves
ORPOTrainerandORPOConfigfromtrl.trainertotrl.experimental.orpoas part of the TRL V1 refactoring effort.Changes
ORPOTrainerandORPOConfigtotrl.experimental.orpotrl.trainerwithFutureWarning(removal planned for TRL 0.29.0)tests/test_orpo_trainer.py)examples/scripts/orpo.py)docs/source/orpo_trainer.md,docs/source/_toctree.yml)trl.trainerexportsTesting
Fixes #4465
Contributes to #4374