From 63cea64a494b1d355035b01bf70abf3f7bedc108 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 16 Oct 2025 05:26:36 -0700 Subject: [PATCH] Update rl.py --- unsloth/models/rl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py index 84ab86dd49..4a548f0000 100644 --- a/unsloth/models/rl.py +++ b/unsloth/models/rl.py @@ -717,7 +717,7 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"): num_proc_check = \ "if dataset_num_proc is None:\n"\ " from multiprocessing import cpu_count\n"\ - " dataset_num_proc = max(cpu_count()+4, 2)\n" + " dataset_num_proc = min(max(cpu_count()+4, 2), 64)\n" extra_args += num_proc_check pass