diff --git a/pyproject.toml b/pyproject.toml index 84d6d86d93..decc0e9f5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,7 @@ huggingfacenotorch = [ ] huggingface = [ "unsloth[huggingfacenotorch]", - "unsloth_zoo>=2025.12.6", + "unsloth_zoo>=2025.12.7", "torchvision", "unsloth[triton]", ] @@ -523,7 +523,7 @@ colab-ampere-torch220 = [ "flash-attn>=2.6.3 ; ('linux' in sys_platform)", ] colab-new = [ - "unsloth_zoo>=2025.12.6", + "unsloth_zoo>=2025.12.7", "packaging", "tyro", "transformers>=4.51.3,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3,!=4.53.0,!=4.54.0,!=4.55.0,!=4.55.1,!=4.57.0,<=4.57.3", diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 9929277719..abc8380562 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.12.8" +__version__ = "2025.12.9" __all__ = [ "SUPPORTS_BFLOAT16", diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py index 31316e45b7..4ea36519d9 100644 --- a/unsloth/models/rl.py +++ b/unsloth/models/rl.py @@ -812,8 +812,13 @@ def _patch_trl_rl_trainers(trainer_file = "grpo_trainer"): if "dataset_num_proc" in call_args: num_proc_check = ( "if dataset_num_proc is None:\n" - " from multiprocessing import cpu_count\n" - " dataset_num_proc = min(max(cpu_count()+4, 2), 64)\n" + " import psutil\n" + " dataset_num_proc = min(max(psutil.cpu_count()+4, 2), 64)\n" + " memory_gb_left = psutil.virtual_memory().available / (1024**3)\n" + " if memory_gb_left <= 4: dataset_num_proc = 1 # Too risky, so set to 1\n" + " elif memory_gb_left <= 6: dataset_num_proc = min(2, dataset_num_proc)\n" + " elif memory_gb_left <= 10: dataset_num_proc = min(4, dataset_num_proc)\n" + " elif memory_gb_left <= 14: dataset_num_proc = min(6, dataset_num_proc)\n" ) extra_args += num_proc_check