Skip to content

Commit 19d2f97

Browse files
Deprecate BestOfNSampler (#4291)
Co-authored-by: behroozazarkhalili <ermiaazarkhalili> Co-authored-by: Behrooz Azarkhalili <[email protected]>
1 parent 31caf64 commit 19d2f97

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/source/best_of_n.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Best of N sampling: Alternative ways to get better model output without RL based fine-tuning
22

3+
> [!WARNING]
4+
> Best-of-N sampling is deprecated and will be removed in TRL 0.25.0.
5+
36
Within the extras module is the `best-of-n` sampler class that serves as an alternative method of generating better model output.
47
As to how it fares against the RL based fine-tuning, please look in the `examples` directory for a comparison example
58

trl/extras/best_of_n_sampler.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import warnings
1516
from typing import Any, Callable, Optional, Union
1617

1718
import torch
@@ -42,8 +43,16 @@ class BestOfNSampler:
4243
generation_config ([`~transformers.GenerationConfig`], *optional*):
4344
Generation config passed to the underlying model's `generate` method. See
4445
[`~transformers.GenerationConfig`] for more details.
46+
47+
<Deprecated version="0.24.0">
48+
49+
`BestOfNSampler` is deprecated and will be removed in version 0.25.
50+
51+
</Deprecated>
4552
"""
4653

54+
warnings.warn("`BestOfNSampler` is deprecated and will be removed in TRL 0.25.", FutureWarning, stacklevel=2)
55+
4756
def __init__(
4857
self,
4958
model: PreTrainedModelWrapper,

0 commit comments

Comments
 (0)