Warm Ollama into VRAM on up and tunnel so Assistent chat is not cold.

A 1-token /api/chat after tags (and again if /api/ps is empty) loads VL weights before the first message. Mid KEEP_ALIVE is 15m so a short image-gen burst does not unload the model.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-21 20:47:14 +03:00
co-authored by Cursor
parent 79cb0a7e25
commit ffe5a031b4
12 changed files with 465 additions and 4 deletions
+27
View File
@@ -1045,6 +1045,33 @@ def provision_llm(cfg: Config, host: str, log: Log) -> None:
+ f" (есть: {sorted(have) or 'пусто'}). "
"SwarmUI ок — GPU не гасим; Assistent будет пустой."
)
warm = next(
(
n
for n in list(defaults) + names
if already_have_ollama_tag(have, n)
),
"",
)
if warm:
log(f"Ollama warmup {warm} (гружу в VRAM)")
put_text(
cfg,
host,
"/tmp/gpu-rent-ollama-warmup.json",
json.dumps({"model": warm}, indent=2),
)
try:
run_python(
cfg,
host,
_pkg_text("ollama_warmup.py"),
remote_path="/tmp/gpu-rent-ollama_warmup.py",
timeout=240,
log=log,
)
except Exception as exc:
log(f"⚠ Ollama warmup: {exc}")
else:
raise CloudError(f"неизвестный LLM_RUNTIME={runtime!r}")
st = load_state()