You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] NameError: name 'psutil' is not defined in UnslothSFTTrainer._prepare_dataset (Windows environment) #3777
Traceback (most recent call last):
...
File "...\unsloth_compiled_cache\UnslothSFTTrainer.py", line 1114, in _prepare_dataset
dataset_num_proc = max(psutil.cpu_count()+4, 2)
NameError: name 'psutil' is not defined
Thank you for your assistance. When I followed your advice and tested it in Google Colab, I didn't encounter the NameError: name 'psutil' is not defined error. Based on this, I suspect the issue was related to environment configuration.
Activity
Sneakr commentedon Dec 25, 2025
Hi, there's been users with similar error recently that noticed it was environment issues. Can you please test this and verify if it's running or if there's something wrong with your environment/versions. https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/gpt-oss-(20B)-Fine-tuning.ipynb
midorin-Linux commentedon Dec 26, 2025
Thank you for your assistance. When I followed your advice and tested it in Google Colab, I didn't encounter the
NameError: name 'psutil' is not definederror. Based on this, I suspect the issue was related to environment configuration.chenzhongxiang commentedon Dec 27, 2025
I found that using the
SFTConfigprovided bytrlas theargsparameter forSFTTrainer, which works without issues.fix(trainer): import psutil to prevent NameError in _prepare_dataset (#…
fix(trainer): import psutil to prevent NameError in _prepare_dataset (u…