Skip to content

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.

Remove stale .venv_overlay on server startup to prevent transformers version conflicts

Roland Tannous3fe85d36ccfa
diff --git a/studio/backend/main.py b/studio/backend/main.py
index e7a33750ff3..a765fc9030e 100644
--- a/studio/backend/main.py
+++ b/studio/backend/main.py
@@ -25,6 +25,12 @@ UNSLOTH_CACHE_DIR = Path(__file__).parent / "unsloth_compiled_cache"
@asynccontextmanager
async def lifespan(app: FastAPI):
"""Startup: detect hardware, print setup token if needed. Shutdown: clean up compiled cache."""
+ # Remove stale .venv_overlay from previous sessions — it will be
+ # rebuilt at runtime if a model needs transformers 5.x
+ overlay_dir = Path(__file__).resolve().parent.parent.parent / ".venv_overlay"
+ if overlay_dir.is_dir():
+ shutil.rmtree(overlay_dir, ignore_errors=True)
+
# Detect hardware first — sets DEVICE global used everywhere
detect_hardware()