From ac725599c79ebc64b9e1ad5898ff5201bbafab64 Mon Sep 17 00:00:00 2001 From: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com> Date: Mon, 1 Dec 2025 20:14:14 +0100 Subject: [PATCH] Raise FutureWarning for classes moved to experimental --- trl/trainer/bco_config.py | 4 +++- trl/trainer/bco_trainer.py | 4 +++- trl/trainer/callbacks.py | 4 +++- trl/trainer/cpo_config.py | 4 +++- trl/trainer/gkd_config.py | 4 +++- trl/trainer/gkd_trainer.py | 4 +++- trl/trainer/judges.py | 32 +++++++++++++++++++++++-------- trl/trainer/nash_md_config.py | 4 +++- trl/trainer/nash_md_trainer.py | 4 +++- trl/trainer/online_dpo_config.py | 4 +++- trl/trainer/online_dpo_trainer.py | 4 +++- trl/trainer/orpo_config.py | 4 +++- trl/trainer/orpo_trainer.py | 4 +++- trl/trainer/ppo_config.py | 4 +++- trl/trainer/ppo_trainer.py | 4 +++- trl/trainer/prm_config.py | 4 +++- trl/trainer/prm_trainer.py | 4 +++- trl/trainer/xpo_config.py | 4 +++- trl/trainer/xpo_trainer.py | 4 +++- 19 files changed, 78 insertions(+), 26 deletions(-) diff --git a/trl/trainer/bco_config.py b/trl/trainer/bco_config.py index 6e22dda6b13..e9cc477dd0c 100644 --- a/trl/trainer/bco_config.py +++ b/trl/trainer/bco_config.py @@ -24,6 +24,8 @@ def __post_init__(self): warnings.warn( "The `BCOConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.bco import BCOConfig`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/bco_trainer.py b/trl/trainer/bco_trainer.py index c98fc320200..c2eb1d651b0 100644 --- a/trl/trainer/bco_trainer.py +++ b/trl/trainer/bco_trainer.py @@ -24,6 +24,8 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `BCOTrainer` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.bco import BCOTrainer`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/callbacks.py b/trl/trainer/callbacks.py index 7951ce8966a..51c39584bf9 100644 --- a/trl/trainer/callbacks.py +++ b/trl/trainer/callbacks.py @@ -271,7 +271,9 @@ def __init__(self, *args, **kwargs): "The `WinRateCallback` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.winrate_callback import WinRateCallback`. The current import path will be removed " "and no longer supported in TRL 0.29. For more information, see " - "https://github.com/huggingface/trl/issues/4223." + "https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/cpo_config.py b/trl/trainer/cpo_config.py index 91df318221d..7f7c4874688 100644 --- a/trl/trainer/cpo_config.py +++ b/trl/trainer/cpo_config.py @@ -24,6 +24,8 @@ def __post_init__(self): warnings.warn( "The `CPOConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.cpo import CPOConfig`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/gkd_config.py b/trl/trainer/gkd_config.py index 8c7a3a46660..eefaecf09a7 100644 --- a/trl/trainer/gkd_config.py +++ b/trl/trainer/gkd_config.py @@ -24,6 +24,8 @@ def __post_init__(self): warnings.warn( "The `GKDConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.gkd import GKDConfig`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/gkd_trainer.py b/trl/trainer/gkd_trainer.py index bf20ed68f6f..4d8f8d41cb8 100644 --- a/trl/trainer/gkd_trainer.py +++ b/trl/trainer/gkd_trainer.py @@ -24,6 +24,8 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `GKDTrainer` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.gkd import GKDTrainer`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/judges.py b/trl/trainer/judges.py index 1cb8fbab77c..cc07bbdfadb 100644 --- a/trl/trainer/judges.py +++ b/trl/trainer/judges.py @@ -29,7 +29,9 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `AllTrueJudge` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.judges import AllTrueJudge`. The current import path will be removed and no " - "longer supported in TRL 0.29." + "longer supported in TRL 0.29.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) @@ -39,7 +41,9 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `BaseBinaryJudge` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.judges import BaseBinaryJudge`. The current import path will be removed and no " - "longer supported in TRL 0.29." + "longer supported in TRL 0.29.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) @@ -49,7 +53,9 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `BaseJudge` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.judges import BaseJudge`. The current import path will be removed and no " - "longer supported in TRL 0.29." + "longer supported in TRL 0.29.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) @@ -59,7 +65,9 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `BasePairwiseJudge` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.judges import BasePairwiseJudge`. The current import path will be removed and no " - "longer supported in TRL 0.29." + "longer supported in TRL 0.29.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) @@ -69,7 +77,9 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `BaseRankJudge` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.judges import BaseRankJudge`. The current import path will be removed and no " - "longer supported in TRL 0.29." + "longer supported in TRL 0.29.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) @@ -79,7 +89,9 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `HfPairwiseJudge` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.judges import HfPairwiseJudge`. The current import path will be removed and no " - "longer supported in TRL 0.29." + "longer supported in TRL 0.29.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) @@ -89,7 +101,9 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `OpenAIPairwiseJudge` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.judges import OpenAIPairwiseJudge`. The current import path will be removed and no " - "longer supported in TRL 0.29." + "longer supported in TRL 0.29.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) @@ -99,6 +113,8 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `PairRMJudge` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.judges import PairRMJudge`. The current import path will be removed and no " - "longer supported in TRL 0.29." + "longer supported in TRL 0.29.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/nash_md_config.py b/trl/trainer/nash_md_config.py index 9da8247f59f..73c17ba441f 100644 --- a/trl/trainer/nash_md_config.py +++ b/trl/trainer/nash_md_config.py @@ -24,6 +24,8 @@ def __post_init__(self): warnings.warn( "The `NashMDConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.nash_md import NashMDConfig`. The current import path will be removed and no " - "longer supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "longer supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/nash_md_trainer.py b/trl/trainer/nash_md_trainer.py index 23aae32b9e5..6ae7e558243 100644 --- a/trl/trainer/nash_md_trainer.py +++ b/trl/trainer/nash_md_trainer.py @@ -24,6 +24,8 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `NashMDTrainer` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.nash_md import NashMDTrainer`. The current import path will be removed and no " - "longer supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "longer supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/online_dpo_config.py b/trl/trainer/online_dpo_config.py index 1c58fc28fc4..39199f8c5dd 100644 --- a/trl/trainer/online_dpo_config.py +++ b/trl/trainer/online_dpo_config.py @@ -25,6 +25,8 @@ def __post_init__(self): "The `OnlineDPOConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.online_dpo import OnlineDPOConfig`. The current import path will be removed and " "no longer supported in TRL 0.29. For more information, see " - "https://github.com/huggingface/trl/issues/4223." + "https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/online_dpo_trainer.py b/trl/trainer/online_dpo_trainer.py index 5416b12639f..625016d3e31 100644 --- a/trl/trainer/online_dpo_trainer.py +++ b/trl/trainer/online_dpo_trainer.py @@ -25,6 +25,8 @@ def __init__(self, *args, **kwargs): "The `OnlineDPOTrainer` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.online_dpo import OnlineDPOTrainer`. The current import path will be removed and " "no longer supported in TRL 0.29. For more information, see " - "https://github.com/huggingface/trl/issues/4223." + "https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/orpo_config.py b/trl/trainer/orpo_config.py index e5f30575fd7..3bc1ef05658 100644 --- a/trl/trainer/orpo_config.py +++ b/trl/trainer/orpo_config.py @@ -24,6 +24,8 @@ def __post_init__(self): warnings.warn( "The `ORPOConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.orpo import ORPOConfig`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/orpo_trainer.py b/trl/trainer/orpo_trainer.py index b91a59eef35..e0baee39487 100644 --- a/trl/trainer/orpo_trainer.py +++ b/trl/trainer/orpo_trainer.py @@ -24,6 +24,8 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `ORPOTrainer` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.orpo import ORPOTrainer`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/ppo_config.py b/trl/trainer/ppo_config.py index e38cd190fe8..2077a626825 100644 --- a/trl/trainer/ppo_config.py +++ b/trl/trainer/ppo_config.py @@ -24,6 +24,8 @@ def __post_init__(self): warnings.warn( "The `PPOConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.ppo import PPOConfig`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/ppo_trainer.py b/trl/trainer/ppo_trainer.py index fb2b94dfa37..f21689c642e 100644 --- a/trl/trainer/ppo_trainer.py +++ b/trl/trainer/ppo_trainer.py @@ -24,6 +24,8 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `PPOTrainer` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.ppo import PPOTrainer`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/prm_config.py b/trl/trainer/prm_config.py index 582977089e8..c76065a0d6b 100644 --- a/trl/trainer/prm_config.py +++ b/trl/trainer/prm_config.py @@ -22,6 +22,8 @@ def __post_init__(self): warnings.warn( "The `PRMConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.xco import PRMConfig`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/prm_trainer.py b/trl/trainer/prm_trainer.py index d9f859f5a31..d6be32ce8ad 100644 --- a/trl/trainer/prm_trainer.py +++ b/trl/trainer/prm_trainer.py @@ -22,6 +22,8 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `PRMTrainer` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.prm import PRMTrainer`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs) diff --git a/trl/trainer/xpo_config.py b/trl/trainer/xpo_config.py index a05cecbfe37..e049c86771e 100644 --- a/trl/trainer/xpo_config.py +++ b/trl/trainer/xpo_config.py @@ -22,6 +22,8 @@ def __post_init__(self): warnings.warn( "The `XPOConfig` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.xco import XPOConfig`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__post_init__() diff --git a/trl/trainer/xpo_trainer.py b/trl/trainer/xpo_trainer.py index c537f886d41..75a3d18997d 100644 --- a/trl/trainer/xpo_trainer.py +++ b/trl/trainer/xpo_trainer.py @@ -22,6 +22,8 @@ def __init__(self, *args, **kwargs): warnings.warn( "The `XPOTrainer` is now located in `trl.experimental`. Please update your imports to " "`from trl.experimental.xpo import XPOTrainer`. The current import path will be removed and no longer " - "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223." + "supported in TRL 0.29. For more information, see https://github.com/huggingface/trl/issues/4223.", + FutureWarning, + stacklevel=2, ) super().__init__(*args, **kwargs)