Fix stale experimental.kto docstring cross-references in KTOTrainer/KTOConfig#6331
Closed
DaoyuanLi2816 wants to merge 1 commit into
Closed
Conversation
…TOConfig PR huggingface#6175 promoted KTO from `trl.experimental.kto` to the stable `trl.trainer` API, physically moving `kto_trainer.py`/`kto_config.py` and updating the `>>> from trl.experimental.kto import ...` code examples, but left four docstring cross-references pointing at the old experimental path: - `KTOTrainer.__init__`'s `args` param referenced `[`experimental.kto.KTOConfig`]` - its `data_collator` param referenced `[`~experimental.kto.kto_trainer.DataCollatorForUnpairedPreference`]` and `[`~experimental.kto.kto_trainer.DataCollatorForVisionUnpairedPreference`]` - `KTOConfig`'s class docstring referenced `[`experimental.kto.KTOTrainer`]` `trl/experimental/kto/` now contains only a deprecation shim `__init__.py` (the `kto_trainer` submodule was deleted), so the collator references point at a module path that no longer exists, and the KTOConfig/KTOTrainer references resolve only to shim subclasses whose `__post_init__`/`__init__` raise `FutureWarning: ... Update your imports to `from trl import KTOConfig`` — i.e. the stable class's own docstring pointed readers at the exact import path its own code warns against. Update all four to the stable self-referential form, matching DPOTrainer's already-correct pattern (`[`DPOConfig`]`, `[`~trainer.dpo_trainer.DataCollatorForPreference`]`, `Configuration class for the [`DPOTrainer`].`). Docstring-only change, no behavior change; no test applicable.
Contributor
Author
|
Superseded by #6345 (merged just now), which fixes this same stale |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
PR #6175 promoted KTO from
trl.experimental.ktoto the stabletrl.trainerAPI — it movedkto_trainer.py/kto_config.pyand updated the>>> from trl.experimental.kto import ...code examples, but left four docstring cross-references still pointing at the old experimental path.In
KTOTrainer.__init__'s docstring:And in
KTOConfig's class docstring:trl/experimental/kto/now contains only a deprecation shim__init__.py(thekto_trainersubmodule itself was deleted), so:experimental.kto.kto_trainerisn't importable), andKTOConfig/KTOTrainerreferences resolve only to shim subclasses whose__post_init__/__init__raiseFutureWarning: ... Update your imports tofrom trl import KTOConfig``.So the stable class's own docstring points readers at the exact import path its own code warns against.
This PR updates all four references to the stable self-referential form, matching
DPOTrainer's already-correct pattern:and
Docstring-only change, no behavior change.
Before submitting
Note
Low Risk
Documentation-only edits with no code or behavior changes.
Overview
After KTO moved to the stable
trl.trainerAPI, four docstring links still pointed atexperimental.ktopaths that no longer exist or only resolve through deprecation shims.This PR retargets them to match
DPOTrainer/DPOConfig:KTOConfignow references [KTOTrainer];KTOTrainer.__init__references [KTOConfig] and the default collators under [~trainer.kto_trainer.*]. Docstrings only — no runtime or API behavior change.Reviewed by Cursor Bugbot for commit 29942a4. Bugbot is set up for automated code reviews on this repo. Configure here.