Refactor LLM configuration to remove llamacpp support
- Removed references to llamacpp from configuration files, scripts, and documentation, streamlining the LLM setup process to focus solely on Ollama. - Updated environment variables and paths to eliminate llamacpp-related entries, ensuring clarity in the configuration. - Adjusted CLI commands and help messages to reflect the removal of llamacpp, enhancing user experience and reducing confusion. - Revised documentation to provide clear guidance on using Ollama exclusively, including updates to setup instructions and runtime options.
This commit is contained in:
+25
-105
@@ -335,7 +335,7 @@ def status() -> None:
|
||||
rt = resolve_llm_runtime(cfg)
|
||||
noted = notes.get("llm_runtime")
|
||||
llm_err = notes.get("llm_error")
|
||||
detail = f"{rt}; ollama :{cfg.ollama_local_port} / llamacpp :{cfg.llamacpp_local_port}"
|
||||
detail = f"{rt}; ollama :{cfg.ollama_local_port}"
|
||||
if noted and noted != rt:
|
||||
detail += f" (notes: {noted})"
|
||||
if llm_err:
|
||||
@@ -370,7 +370,7 @@ def status() -> None:
|
||||
def open(
|
||||
llm: bool = typer.Option(False, "--llm", help="Открыть LLM API URL вместо SwarmUI"),
|
||||
) -> None:
|
||||
"""Открыть браузер на SwarmUI :17801 (или --llm / llm-only на Ollama/llama.cpp)."""
|
||||
"""Открыть браузер на SwarmUI :17801 (или --llm / llm-only на Ollama)."""
|
||||
cfg = load_config(require_auth=False)
|
||||
use_llm = llm or not bool(getattr(cfg, "enable_swarmui", True))
|
||||
if use_llm:
|
||||
@@ -379,8 +379,6 @@ def open(
|
||||
runtime = resolve_llm_runtime(cfg)
|
||||
if runtime == "ollama":
|
||||
port = cfg.ollama_local_port
|
||||
elif runtime == "llamacpp":
|
||||
port = cfg.llamacpp_local_port
|
||||
else:
|
||||
console.print("[red]LLM не выбран[/red] (LLM_RUNTIME / gpu-rent setup)")
|
||||
raise typer.Exit(1)
|
||||
@@ -398,9 +396,9 @@ def open(
|
||||
|
||||
@app.command()
|
||||
def setup(
|
||||
llm: Optional[str] = typer.Option(None, "--llm", help="none|ollama|llamacpp"),
|
||||
llm: Optional[str] = typer.Option(None, "--llm", help="none|ollama"),
|
||||
ollama_preset: Optional[str] = typer.Option(
|
||||
None, "--ollama-preset", help="recommended|light|stock|alt|empty"
|
||||
None, "--ollama-preset", help="recommended|light|stock|text|big|empty"
|
||||
),
|
||||
watchdog: Optional[bool] = typer.Option(
|
||||
None, "--watchdog/--no-watchdog", help="Поставить local-watchdog"
|
||||
@@ -466,10 +464,9 @@ def up(
|
||||
help="Полный doctor-таблица на up (по умолчанию кратко)",
|
||||
),
|
||||
llm: Optional[str] = typer.Option(
|
||||
None, "--llm", help="none|ollama|llamacpp (override LLM_RUNTIME)"
|
||||
None, "--llm", help="none|ollama (override LLM_RUNTIME)"
|
||||
),
|
||||
ollama: bool = typer.Option(False, "--ollama", help="То же что --llm ollama"),
|
||||
llamacpp: bool = typer.Option(False, "--llamacpp", help="То же что --llm llamacpp"),
|
||||
no_swarm: bool = typer.Option(
|
||||
False,
|
||||
"--no-swarm",
|
||||
@@ -489,7 +486,7 @@ def up(
|
||||
write_ollama_models_preset,
|
||||
)
|
||||
from gpu_rent.paths import vars_path
|
||||
from gpu_rent.prompts import MenuItem, prompt_menu
|
||||
from gpu_rent.prompts import prompt_menu
|
||||
from gpu_rent.timing import clock_elapsed, clock_reset, format_duration
|
||||
from gpu_rent.varsfile import upsert_vars
|
||||
|
||||
@@ -506,7 +503,6 @@ def up(
|
||||
runtime = decide_runtime(
|
||||
flag=llm,
|
||||
ollama_flag=ollama,
|
||||
llamacpp_flag=llamacpp,
|
||||
from_config=cfg.llm_runtime,
|
||||
)
|
||||
except ValueError as exc:
|
||||
@@ -514,11 +510,10 @@ def up(
|
||||
|
||||
enable_swarm = False if no_swarm else cfg.enable_swarmui
|
||||
asked_model_preset = False
|
||||
llm_flags = bool(llm or ollama or llamacpp or no_swarm)
|
||||
llm_flags = bool(llm or ollama or no_swarm)
|
||||
|
||||
if not yes and not llm_flags:
|
||||
from gpu_rent.llm_runtime import (
|
||||
llamacpp_preset_menu,
|
||||
ollama_preset_menu,
|
||||
workload_menu,
|
||||
)
|
||||
@@ -548,47 +543,11 @@ def up(
|
||||
elif stack == "both":
|
||||
enable_swarm = True
|
||||
if runtime == "none":
|
||||
try:
|
||||
choice = prompt_menu(
|
||||
"LLM runtime",
|
||||
[
|
||||
MenuItem("ollama", "Ollama (+ pull моделей)"),
|
||||
MenuItem("llamacpp", "llama.cpp server (+ GGUF)"),
|
||||
],
|
||||
default="ollama",
|
||||
ask=_ask,
|
||||
show=log,
|
||||
)
|
||||
runtime = decide_runtime(
|
||||
flag=choice,
|
||||
ollama_flag=False,
|
||||
llamacpp_flag=False,
|
||||
from_config="none",
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise GpuRentError(str(exc)) from exc
|
||||
runtime = "ollama"
|
||||
else:
|
||||
enable_swarm = False
|
||||
if runtime == "none":
|
||||
try:
|
||||
choice = prompt_menu(
|
||||
"LLM runtime",
|
||||
[
|
||||
MenuItem("ollama", "Ollama (+ pull моделей)"),
|
||||
MenuItem("llamacpp", "llama.cpp server (+ GGUF)"),
|
||||
],
|
||||
default="llamacpp",
|
||||
ask=_ask,
|
||||
show=log,
|
||||
)
|
||||
runtime = decide_runtime(
|
||||
flag=choice,
|
||||
ollama_flag=False,
|
||||
llamacpp_flag=False,
|
||||
from_config="none",
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise GpuRentError(str(exc)) from exc
|
||||
runtime = "ollama"
|
||||
|
||||
if typer.confirm("Запомнить стек в gpu-rent.vars?", default=True):
|
||||
upsert_vars(
|
||||
@@ -614,68 +573,31 @@ def up(
|
||||
if preset not in {"keep", "example"}:
|
||||
write_ollama_models_preset(cfg.ollama_models_manifest, preset)
|
||||
asked_model_preset = True
|
||||
elif runtime == "llamacpp":
|
||||
from gpu_rent.llm_runtime import (
|
||||
ensure_llamacpp_manifest_from_example,
|
||||
write_llamacpp_models_preset,
|
||||
)
|
||||
|
||||
ensure_llamacpp_manifest_from_example()
|
||||
try:
|
||||
preset = prompt_menu(
|
||||
"llama.cpp GGUF",
|
||||
llamacpp_preset_menu(include_keep=False),
|
||||
default="recommended",
|
||||
ask=_ask,
|
||||
show=log,
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise GpuRentError(str(exc)) from exc
|
||||
if preset not in {"keep", "example"}:
|
||||
write_llamacpp_models_preset(cfg.llamacpp_models_manifest, preset)
|
||||
asked_model_preset = True
|
||||
|
||||
# Runtime уже в vars — спросить пресет, default=keep.
|
||||
if not yes and not asked_model_preset and runtime in {"llamacpp", "ollama"}:
|
||||
from gpu_rent.llm_runtime import (
|
||||
ensure_llamacpp_manifest_from_example,
|
||||
llamacpp_preset_menu,
|
||||
ollama_preset_menu,
|
||||
write_llamacpp_models_preset,
|
||||
)
|
||||
if not yes and not asked_model_preset and runtime == "ollama":
|
||||
from gpu_rent.llm_runtime import ollama_preset_menu
|
||||
|
||||
def _ask2(msg: str, default: str = "") -> str:
|
||||
return typer.prompt(msg, default=default)
|
||||
|
||||
try:
|
||||
if runtime == "llamacpp":
|
||||
ensure_llamacpp_manifest_from_example()
|
||||
key = prompt_menu(
|
||||
"llama.cpp GGUF",
|
||||
llamacpp_preset_menu(include_keep=True),
|
||||
default="keep",
|
||||
ask=_ask2,
|
||||
show=log,
|
||||
)
|
||||
if key not in {"keep", "example", ""}:
|
||||
write_llamacpp_models_preset(cfg.llamacpp_models_manifest, key)
|
||||
else:
|
||||
ensure_ollama_manifest_from_example()
|
||||
key = prompt_menu(
|
||||
"Ollama preset",
|
||||
ollama_preset_menu(include_keep=True),
|
||||
default="keep",
|
||||
ask=_ask2,
|
||||
show=log,
|
||||
)
|
||||
if key not in {"keep", "example", ""}:
|
||||
write_ollama_models_preset(cfg.ollama_models_manifest, key)
|
||||
ensure_ollama_manifest_from_example()
|
||||
key = prompt_menu(
|
||||
"Ollama preset",
|
||||
ollama_preset_menu(include_keep=True),
|
||||
default="keep",
|
||||
ask=_ask2,
|
||||
show=log,
|
||||
)
|
||||
if key not in {"keep", "example", ""}:
|
||||
write_ollama_models_preset(cfg.ollama_models_manifest, key)
|
||||
except ValueError as exc:
|
||||
raise GpuRentError(str(exc)) from exc
|
||||
|
||||
if not enable_swarm and runtime == "none":
|
||||
raise GpuRentError(
|
||||
"llm-only требует --ollama / --llamacpp / --llm … "
|
||||
"llm-only требует --ollama / --llm ollama "
|
||||
"(или убери --no-swarm / ENABLE_SWARMUI=true)"
|
||||
)
|
||||
|
||||
@@ -796,7 +718,7 @@ def logs(
|
||||
None,
|
||||
"--unit",
|
||||
"-u",
|
||||
help="swarm|ollama|llamacpp|killer|cloud-init (по умолчанию — всё)",
|
||||
help="swarm|ollama|killer|cloud-init (по умолчанию — всё)",
|
||||
),
|
||||
lines: int = typer.Option(80, "--lines", "-n", help="Строк journalctl"),
|
||||
) -> None:
|
||||
@@ -812,8 +734,6 @@ def logs(
|
||||
"swarm": "swarmui",
|
||||
"swarmui": "swarmui",
|
||||
"ollama": "ollama",
|
||||
"llamacpp": "llamacpp",
|
||||
"llama": "llamacpp",
|
||||
"killer": "gpu-rent-idle-killer",
|
||||
"idle-killer": "gpu-rent-idle-killer",
|
||||
"idle": "gpu-rent-idle-killer",
|
||||
@@ -823,7 +743,7 @@ def logs(
|
||||
if key not in aliases:
|
||||
raise GpuRentError(
|
||||
f"неизвестный --unit={unit!r}; "
|
||||
"ожидаю: swarm|ollama|llamacpp|killer|cloud-init|all"
|
||||
"ожидаю: swarm|ollama|killer|cloud-init|all"
|
||||
)
|
||||
target = aliases[key]
|
||||
n = max(10, min(int(lines), 500))
|
||||
@@ -835,7 +755,7 @@ def logs(
|
||||
)
|
||||
journal_units = []
|
||||
if target == "all":
|
||||
journal_units = ["swarmui", "ollama", "llamacpp", "gpu-rent-idle-killer"]
|
||||
journal_units = ["swarmui", "ollama", "gpu-rent-idle-killer"]
|
||||
elif target != "cloud-init":
|
||||
journal_units = [target]
|
||||
for ju in journal_units:
|
||||
|
||||
Reference in New Issue
Block a user