When I try to import FastLanguageModel from unsloth in Google Colab(https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen2.5_(7B)-Alpaca.ipynb) after setting the environment variable UNSLOTH_USE_MODELSCOPE to 1 using %env UNSLOTH_USE_MODELSCOPE=1, I get the following error:
NameError Traceback (most recent call last)
in <cell line: 0>()
----> 1 from unsloth import FastLanguageModel
2 import torch
3 max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!
4 dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
5 load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
3 frames
/usr/local/lib/python3.11/dist-packages/unsloth/models/_utils.py in
1245 USE_MODELSCOPE = os.environ.get("UNSLOTH_USE_MODELSCOPE", "0") == "1"
1246 if USE_MODELSCOPE:
-> 1247 if importlib.util.find_spec("modelscope") is None:
1248 raise ImportError(f'You are using the modelscope hub, please install modelscope by pip install modelscope -U')
1249 pass
NameError: name 'importlib' is not defined
It seems that importlib is not defined in the context where unsloth is trying to use it, specifically when UNSLOTH_USE_MODELSCOPE is set to 1.
When I try to import FastLanguageModel from unsloth in Google Colab(https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen2.5_(7B)-Alpaca.ipynb) after setting the environment variable UNSLOTH_USE_MODELSCOPE to 1 using %env UNSLOTH_USE_MODELSCOPE=1, I get the following error: