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
fix(studio): lazy-import transformers in model_config to fix 5.x version switch (#4806)
Roland Tannousf91ef8f9b048
diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.pyindex 44c700bf3d5..d752500bf4f 100644--- a/studio/backend/core/inference/llama_cpp.py+++ b/studio/backend/core/inference/llama_cpp.py@@ -52,8 +52,14 @@ _REPROMPT_MAX_CHARS = 2000_SHARD_FULL_RE = re.compile(r"^(.*)-(\d{5})-of-(\d{5})\.gguf$")_SHARD_RE = re.compile(r"^(.*)-\d{5}-of-\d{5}\.gguf$")-# Model size extraction (shared with routes/inference.py)-from utils.models import extract_model_size_b as _extract_model_size_b++# Model size extraction — lazy import to avoid pulling in transformers+# at module level. See PR description for the full explanation.+def _extract_model_size_b(model_id: str):+ from utils.models import extract_model_size_b++ return extract_model_size_b(model_id)+# ── Pre-compiled patterns for tool XML stripping ─────────────_TOOL_CLOSED_PATS = [diff --git a/studio/backend/utils/models/model_config.py b/studio/backend/utils/models/model_config.pyindex df1058abf6f..6cffc534aa0 100644--- a/studio/backend/utils/models/model_config.py+++ b/studio/backend/utils/models/model_config.py@@ -5,7 +5,6 @@Model and LoRA configuration handling"""-from transformers import AutoConfigfrom dataclasses import dataclassfrom typing import Optional, Dict, Anyfrom utils.paths import (@@ -422,6 +421,7 @@ def load_model_config("""Load model config with optional authentication control."""+ from transformers import AutoConfigif token:# Explicit token provided - use it