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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user