|
Hi, I am trying to run some fairly simple examples, but when running the SFTTrainer it's throwing a psutil is not defined deep in the SFTTrainer. The exact same thing happens running locally and using google collab. --> 854 train_dataset = self._prepare_dataset( File ~/code/FineTuning/aviation/unsloth_compiled_cache/UnslothSFTTrainer.py:1026, in _UnslothSFTTrainer._prepare_dataset(self, dataset, processing_class, args, packing, formatting_func, dataset_name) NameError: name 'psutil' is not defined Not sure where to go with this, looks like a dependancy issue within this version? Thanks |
Replies: 3 comments 2 replies
|
Hi I have same problem with you too, It looks like environmental problem. You can access the link to get more information |
|
I was able to find the issue and fix... basically I had to switch from using args = TrainingArguments ( etc etc in my SFTTrainer definition to args = SFTConfig (etc etc. |
|
The Quick fixes: 1. Install psutil pip install psutil2. Check import in your script import psutil # Make sure this is at the top3. Environment isolation issue !pip install psutil
import psutil4. Unsloth dependency mismatch pip install unsloth[all]
# or
pip install unsloth psutil5. Virtual environment check which python
pip list | grep psutilMake sure you're in the right env! Root cause: SFTTrainer uses psutil for memory monitoring during training. It's usually auto-installed but can get missed in some setups. We run into this occasionally at RevolutionAI when spinning up fresh training environments. The explicit pip install always fixes it. Did this solve it? |
I was able to find the issue and fix... basically I had to switch from using args = TrainingArguments ( etc etc in my SFTTrainer definition to args = SFTConfig (etc etc.