From eca377477cf4f4ee8d455042fab255ff9af487ef Mon Sep 17 00:00:00 2001 From: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com> Date: Wed, 15 Oct 2025 09:07:18 +0200 Subject: [PATCH] Fix docstrings with Sphinx deprecated directive --- trl/extras/dataset_formatting.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/trl/extras/dataset_formatting.py b/trl/extras/dataset_formatting.py index 2ae6f5092a..ff3832b3e1 100644 --- a/trl/extras/dataset_formatting.py +++ b/trl/extras/dataset_formatting.py @@ -43,9 +43,12 @@ def conversations_formatting_function( return a callable function that takes in a "messages" dataset and returns a formatted dataset, based on the tokenizer apply chat template to the dataset along with the schema of the list of functions in the tools list. - .. deprecated:: 0.24.0 - `conversations_formatting_function` is deprecated and will be removed in version 0.27. Please use - `tokenizer.apply_chat_template()` directly instead. + + + `conversations_formatting_function` is deprecated and will be removed in version 0.27. Please use + `tokenizer.apply_chat_template()` directly instead. + + """ warnings.warn( "`conversations_formatting_function` is deprecated and will be removed in TRL 0.27. " @@ -73,9 +76,12 @@ def instructions_formatting_function(tokenizer: AutoTokenizer): return a callable function that takes in an "instructions" dataset and returns a formatted dataset, based on the tokenizer apply chat template to the dataset - .. deprecated:: 0.24.0 - `instructions_formatting_function` is deprecated and will be removed in version 0.27. Please use - `tokenizer.apply_chat_template()` directly instead. + + + `instructions_formatting_function` is deprecated and will be removed in version 0.27. Please use + `tokenizer.apply_chat_template()` directly instead. + + """ warnings.warn( "`instructions_formatting_function` is deprecated and will be removed in TRL 0.27. " @@ -121,9 +127,12 @@ def get_formatting_func_from_dataset( Returns: Callable: Formatting function if the dataset format is supported else None - .. deprecated:: 0.24.0 - `get_formatting_func_from_dataset` is deprecated and will be removed in version 0.27. Please use - `tokenizer.apply_chat_template()` directly instead. + + + `get_formatting_func_from_dataset` is deprecated and will be removed in version 0.27. Please use + `tokenizer.apply_chat_template()` directly instead. + + """ warnings.warn( "`get_formatting_func_from_dataset` is deprecated and will be removed in TRL 0.27. "