Skip to content

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.

default num_chunks == -1

Daniel Han3a0fb3874408
diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py
index 0207f1c9bf9..f6b3fdbf32e 100644
--- a/unsloth/models/rl.py
+++ b/unsloth/models/rl.py
@@ -127,12 +127,12 @@ class Unsloth{RLConfig_name}({RLConfig_name}):
metadata = {{'help': 'vLLM SamplingParams'}},
)
unsloth_num_chunks : Optional[int] = field(
- default = 1,
- metadata = {{'help': 'Chunk size to reduce memory usage'}},
+ default = -1,
+ metadata = {{'help': 'Chunk size to reduce memory usage. -1 is most efficient.'}},
)
def __init__({RLConfig_arguments},
vllm_sampling_params = None,
- unsloth_num_chunks = 1,
+ unsloth_num_chunks = -1,
**kwargs,
):
{RLConfig_extra_args}
diff --git a/unsloth/models/rl_replacements.py b/unsloth/models/rl_replacements.py
index 5d6201dd229..23b31172fd5 100644
--- a/unsloth/models/rl_replacements.py
+++ b/unsloth/models/rl_replacements.py
@@ -177,7 +177,7 @@ def grpo_trainer__get_per_token_logps(function_name, function):
if function_name != "_get_per_token_logps": return function
def _get_per_token_logps(self, model, input_ids, attention_mask, logits_to_keep):
- if self.args.unsloth_num_chunks != 1: return None
+ return None # Unsloth efficient GRPO
if not hasattr(self, '_autocast_dtype'):
self._autocast_dtype = torch.float16 if os.environ.get('ACCELERATE_MIXED_PRECISION', 'fp16') == 'fp16' else torch.bfloat16
with torch.amp.autocast(device_type = 'cuda', dtype = self._autocast_dtype):