Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
PatchRL
Daniel Han5e69427fdaa9
diff --git a/unsloth/models/__init__.py b/unsloth/models/__init__.pyindex c52d14f4028..3478dfc31a0 100644--- a/unsloth/models/__init__.py+++ b/unsloth/models/__init__.py@@ -20,3 +20,4 @@ from .mistral import FastMistralModelfrom .qwen2 import FastQwen2Modelfrom .dpo import PatchDPOTrainer, PatchKTOTrainerfrom ._utils import is_bfloat16_supported+from .rl import PatchRLdiff --git a/unsloth/models/rl.py b/unsloth/models/rl.pyindex efe2d33e01f..2aa8f026597 100644--- a/unsloth/models/rl.py+++ b/unsloth/models/rl.py@@ -13,14 +13,15 @@# limitations under the License.__all__ = [- "patch_rl",+ "PatchRL",]-from trl.models.utils import unwrap_model_for_generation-from contextlib import contextmanager+def PatchRL(FastLanguageModel):-def patch_rl(FastLanguageModel):+ from trl.models.utils import unwrap_model_for_generation+ from contextlib import contextmanager+@contextmanagerdef unsloth_unwrap_model_for_generation(model, *args, **kwargs):FastLanguageModel.for_inference(model)