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
Studio: use (gguf) context length before max seq length (#5111)
Konstantin Azizovc875dc17e4f6
diff --git a/studio/frontend/src/features/chat/hooks/use-chat-model-runtime.ts b/studio/frontend/src/features/chat/hooks/use-chat-model-runtime.tsindex c9dcd911a29..12815921689 100644--- a/studio/frontend/src/features/chat/hooks/use-chat-model-runtime.ts+++ b/studio/frontend/src/features/chat/hooks/use-chat-model-runtime.ts@@ -419,12 +419,19 @@ export function useChatModelRuntime() {let previousWasUnloaded = false;const currentCheckpoint =useChatRuntimeStore.getState().params.checkpoint;- const paramsBeforeLoad = useChatRuntimeStore.getState().params;- const trustRemoteCode = paramsBeforeLoad.trustRemoteCode ?? false;- const maxSeqLength = paramsBeforeLoad.maxSeqLength;- const hfToken = useChatRuntimeStore.getState().hfToken || null;+ const stateBeforeUnload = useChatRuntimeStore.getState();+ const trustRemoteCode = stateBeforeUnload.params.trustRemoteCode ?? false;+ const maxSeqLength = stateBeforeUnload.params.maxSeqLength;+ const previousIsGguf =+ previousModel?.isGguf === true+ || previousVariant != null+ || (previousCheckpoint?.toLowerCase().endsWith(".gguf") ?? false);+ const rollbackMaxSeqLength = previousIsGguf+ ? (stateBeforeUnload.ggufContextLength ?? 0)+ : maxSeqLength;+ const hfToken = stateBeforeUnload.hfToken || null;const previousModelRequiresTrustRemoteCode =- useChatRuntimeStore.getState().modelRequiresTrustRemoteCode;+ stateBeforeUnload.modelRequiresTrustRemoteCode;try {// Lightweight pre-flight validation: avoid unloading a working model// if the new identifier is clearly invalid (e.g. bad HF id / path).@@ -542,7 +549,7 @@ export function useChatModelRuntime() {await loadModel({model_path: previousCheckpoint,hf_token: hfToken,- max_seq_length: maxSeqLength,+ max_seq_length: rollbackMaxSeqLength,load_in_4bit: true,is_lora: previousIsLora,gguf_variant: previousVariant,