Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions unsloth/models/rl.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def unsloth_prediction_step(
from contextlib import nullcontext
from torch.nn import functional as F
import inspect
import psutil
from transformers import DataCollatorForSeq2Seq, DataCollatorForLanguageModeling as TransformersDataCollatorForLanguageModeling
from transformers.training_args import ParallelMode

Expand Down
1 change: 1 addition & 0 deletions unsloth/tokenizer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import numpy as np
import gc
import subprocess
import psutil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While adding import psutil might fix the NameError as the PR title suggests, psutil does not appear to be used directly in this file. To improve maintainability, it would be better to place the import closer to its usage if possible. If it's used indirectly (e.g., via an exec call), a comment explaining this would be very helpful for future developers.


from unsloth_zoo.tokenizer_utils import (
mean_of_trained_tokens,
Expand Down
1 change: 1 addition & 0 deletions unsloth/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import logging
import os
import psutil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the other file, psutil is imported here but seems unused within this file's scope. For code clarity and maintainability, please consider moving this import to where psutil is actually called, or add a comment explaining the necessity of this import at the top level.

import warnings
from dataclasses import dataclass, field
from typing import Optional
Expand Down