Skip to content

Commit ef71732

Browse files
authored
fix(utils): add missing importlib import to fix NameError (#2134)
This commit fixes a NameError that occurs when `importlib` is referenced in _utils.py without being imported, especially when UNSLOTH_USE_MODELSCOPE=1 is enabled. By adding the missing import statement, the code will no longer throw a NameError.
1 parent 33194f1 commit ef71732

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

unsloth/models/_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,7 @@ def __str__ (self): return LOGITS_ERROR_STRING
12431243
except: continue
12441244
pass
12451245

1246+
import importlib
12461247
USE_MODELSCOPE = os.environ.get("UNSLOTH_USE_MODELSCOPE", "0") == "1"
12471248
if USE_MODELSCOPE:
12481249
if importlib.util.find_spec("modelscope") is None:

0 commit comments

Comments
 (0)