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
backend: resolve trust_remote_code from YAML when not set by frontend
Roland Tannous4858204c6241
diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.pyindex b2f7a802a43..67c858f032a 100644--- a/studio/backend/routes/inference.py+++ b/studio/backend/routes/inference.py@@ -26,6 +26,7 @@ try:from core.inference.llama_cpp import LlamaCppBackendfrom utils.models import ModelConfigfrom utils.inference import load_inference_config+ from utils.models.model_config import load_model_defaultsexcept ImportError:parent_backend = backend_path.parent / "backend"if str(parent_backend) not in sys.path:@@ -34,6 +35,7 @@ except ImportError:from core.inference.llama_cpp import LlamaCppBackendfrom utils.models import ModelConfigfrom utils.inference import load_inference_config+ from utils.models.model_config import load_model_defaultsfrom models.inference import (LoadRequest,@@ -220,13 +222,24 @@ async def load_model(except Exception as e:logger.warning(f"Could not read adapter_config.json: {e}")+ # Resolve trust_remote_code: use True if either the request or YAML config says so.+ # This ensures models like Nemotron that require it always get it, even if the+ # frontend toggle hasn't been set yet.+ trust_remote_code = request.trust_remote_code+ if not trust_remote_code:+ model_defaults = load_model_defaults(config.identifier)+ yaml_trust = model_defaults.get("inference", {}).get("trust_remote_code", False)+ if yaml_trust:+ logger.info(f"YAML config sets trust_remote_code=True for {config.identifier}")+ trust_remote_code = True+# Load the modelsuccess = backend.load_model(config=config,max_seq_length=request.max_seq_length,load_in_4bit=load_in_4bit,hf_token=request.hf_token,- trust_remote_code=request.trust_remote_code,+ trust_remote_code=trust_remote_code,)if not success:diff --git a/studio/backend/routes/training.py b/studio/backend/routes/training.pyindex b6e6d7e111e..151f8d85426 100644--- a/studio/backend/routes/training.py+++ b/studio/backend/routes/training.py@@ -19,12 +19,14 @@ if str(backend_path) not in sys.path:# Import backend functionstry:from core.training import get_training_backend+ from utils.models.model_config import load_model_defaultsexcept ImportError:# Fallback: try to import from parent directoryparent_backend = backend_path.parent / "backend"if str(parent_backend) not in sys.path:sys.path.insert(0, str(parent_backend))from core.training import get_training_backend+ from utils.models.model_config import load_model_defaults# Authfrom auth.authentication import get_current_subject@@ -194,6 +196,14 @@ async def start_training("trust_remote_code": request.trust_remote_code,}+ # Resolve trust_remote_code: use True if either the request or YAML config says so.+ if not training_kwargs["trust_remote_code"]:+ model_defaults = load_model_defaults(request.model_name)+ yaml_trust = model_defaults.get("training", {}).get("trust_remote_code", False)+ if yaml_trust:+ logger.info(f"YAML config sets trust_remote_code=True for {request.model_name}")+ training_kwargs["trust_remote_code"] = True+# Free GPU memory: shut down any running inference/export subprocesses# before training starts (they'd compete for VRAM otherwise)try: