Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions docs/source/best_of_n.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Best of N sampling: Alternative ways to get better model output without RL based fine-tuning

> [!WARNING]
> Best-of-N sampling is deprecated and will be removed in TRL 0.25.0.

Within the extras module is the `best-of-n` sampler class that serves as an alternative method of generating better model output.
As to how it fares against the RL based fine-tuning, please look in the `examples` directory for a comparison example

Expand Down
9 changes: 9 additions & 0 deletions trl/extras/best_of_n_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import warnings
from typing import Any, Callable, Optional, Union

import torch
Expand Down Expand Up @@ -42,8 +43,16 @@ class BestOfNSampler:
generation_config ([`~transformers.GenerationConfig`], *optional*):
Generation config passed to the underlying model's `generate` method. See
[`~transformers.GenerationConfig`] for more details.

<Deprecated version="0.24.0">

`BestOfNSampler` is deprecated and will be removed in version 0.25.

</Deprecated>
"""

warnings.warn("`BestOfNSampler` is deprecated and will be removed in TRL 0.25.", FutureWarning, stacklevel=2)

def __init__(
self,
model: PreTrainedModelWrapper,
Expand Down
Loading