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
del model.peft_config instead of using model.delete_adapter
Roland Tannouse7ae90173771
diff --git a/studio/backend/core/inference/inference.py b/studio/backend/core/inference/inference.pyindex a4580baa71c..41a907820f7 100644--- a/studio/backend/core/inference/inference.py+++ b/studio/backend/core/inference/inference.py@@ -193,19 +193,15 @@ class InferenceBackend:else:print(f"[DEBUG] Model is NOT a PeftModel, skipping unload.")- # Step 2: Delete any lingering adapter configurations from the object.- # This is the crucial step you identified.- if hasattr(model, 'peft_config') and model.peft_config:- print(f"[DEBUG] Lingering peft_config keys: {list(model.peft_config.keys())}")- logger.info("Found lingering adapter configurations. Deleting them now...")- # Create a static list of keys before iterating and deleting- for name in list(model.peft_config.keys()):- if name == "default":- continue- logger.info(f"Deleting adapter config: '{name}'")- model.delete_adapter(name)-- print(f"[DEBUG] Model type FINAL: {model.__class__.__name__}. Reverted to clean base state.")+ # Step 2: Clear any lingering peft_config from the unwrapped model.+ # After model.unload(), the base model may still carry a peft_config+ # attribute (with 'default' key). Removing it entirely ensures+ # load_adapter() won't warn about "multiple adapters".+ if hasattr(model, 'peft_config'):+ print(f"[DEBUG] Clearing lingering peft_config: {list(model.peft_config.keys())}")+ del model.peft_config++ print(f"[DEBUG] Model type FINAL: {model.__class__.__name__}, has peft_config={hasattr(model, 'peft_config')}. Reverted to clean base state.")return Trueexcept Exception as e: