Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
move use_modelscope to _utils (#1938)
Kareem7a1199cf0bfd
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.pyindex 03eb21f4ebc..25fa7880998 100644--- a/unsloth/models/_utils.py+++ b/unsloth/models/_utils.py@@ -25,6 +25,7 @@ __all__ = ["__version__","HAS_FLASH_ATTENTION","HAS_FLASH_ATTENTION_SOFTCAPPING",+ "USE_MODELSCOPE","platform_system","patch_tokenizer","get_statistics",@@ -1271,3 +1272,10 @@ for j, function in enumerate(functions):try: exec(f"EMPTY_LOGITS.{function} = raise_{j}", globals(), locals())except: continuepass++USE_MODELSCOPE = os.environ.get("UNSLOTH_USE_MODELSCOPE", "0") == "1"+if USE_MODELSCOPE:+ if importlib.util.find_spec("modelscope") is None:+ raise ImportError(f'You are using the modelscope hub, please install modelscope by `pip install modelscope -U`')+ pass+passdiff --git a/unsloth/models/loader.py b/unsloth/models/loader.pyindex 800c016cc8b..6eee360d25f 100644--- a/unsloth/models/loader.py+++ b/unsloth/models/loader.py@@ -12,7 +12,12 @@# See the License for the specific language governing permissions and# limitations under the License.-from ._utils import is_bfloat16_supported, HAS_FLASH_ATTENTION, HAS_FLASH_ATTENTION_SOFTCAPPING+from ._utils import (+ is_bfloat16_supported,+ HAS_FLASH_ATTENTION,+ HAS_FLASH_ATTENTION_SOFTCAPPING,+ USE_MODELSCOPE,+)from .granite import FastGraniteModelfrom .llama import FastLlamaModel, loggerfrom .mistral import FastMistralModel@@ -36,14 +41,6 @@ passfrom huggingface_hub import HfFileSystemimport importlib.util-# [TODO] Move USE_MODELSCOPE to utils-USE_MODELSCOPE = os.environ.get("UNSLOTH_USE_MODELSCOPE", "0") == "1"-if USE_MODELSCOPE:- if importlib.util.find_spec("modelscope") is None:- raise ImportError(f'You are using the modelscope hub, please install modelscope by `pip install modelscope -U`')- pass-pass-# https://github.com/huggingface/transformers/pull/26037 allows 4 bit loading!from unsloth_zoo.utils import Version, _get_dtypetransformers_version = Version(transformers_version)