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