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
No compile
Daniel Han630e4258e6b3
diff --git a/unsloth/models/rl.py b/unsloth/models/rl.pyindex 7b363d8fc18..d53c9606d2b 100644--- a/unsloth/models/rl.py+++ b/unsloth/models/rl.py@@ -112,12 +112,12 @@ class Unsloth{RLConfig_name}({RLConfig_name}):"""{__RLConfig_doc__}"""- sampling_params: Optional[Any] = field(+ vllm_sampling_params: Optional[Any] = field(default = None,metadata = {{'help': 'vLLM SamplingParams'}},)def __init__({RLConfig_arguments},- sampling_params = None,+ vllm_sampling_params = None,**kwargs,):{RLConfig_extra_args}diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.pyindex b2501c94fc7..b9ba34726ad 100644--- a/unsloth/models/rl_replacements.py+++ b/unsloth/models/rl_replacements.py@@ -188,8 +188,8 @@ def grpo_trainer__get_per_token_logps(function_name, function):# For transformers<=4.48, logits_to_keep argument isn't supported, so here we drop logits ourselves.# See https://github.com/huggingface/trl/issues/2770logits = logits[:, -logits_to_keep:]- return logits- # return selective_log_softmax(logits, input_ids) # compute logprobs for the input tokens+ # return logits+ return selective_log_softmax(logits, input_ids) # compute logprobs for the input tokenspasspass@@ -199,7 +199,7 @@ passRL_FUNCTIONS["grpo_trainer"].append(grpo_trainer__get_per_token_logps)grpo_compute_loss = RL_REPLACEMENTS["grpo_compute_loss"]-RL_PRE_ITEMS["grpo_trainer"].append(inspect.getsource(grpo_compute_loss))+# RL_PRE_ITEMS["grpo_trainer"].append(inspect.getsource(grpo_compute_loss))# Edit _get_per_token_logps to handle mixed precisiondef grpo_trainer_compute_loss(function_name, function):@@ -245,7 +245,7 @@ def grpo_trainer_compute_loss(function_name, function):function = inspect.getsource(compute_loss)return functionpass-RL_FUNCTIONS["grpo_trainer"].append(grpo_trainer_compute_loss)+# RL_FUNCTIONS["grpo_trainer"].append(grpo_trainer_compute_loss)# https://github.com/huggingface/trl/blob/main/trl/trainer/grpo_trainer.py#L356# TRL warns if batch size is not a multiple of num_generations -> fix this.