Files
gpu-rent/docs/llm.md
T
Leonid Pershin 2ab32a8ab5 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.
2026-08-21 08:51:36 +03:00

134 lines
4.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LLM рядом со SwarmUI (opt-in)
По умолчанию поднимается **только SwarmUI**. Ollama — отдельно (помощь с промптами и т.п.).
Интерактивные вопросы — **нумерованные меню** (Enter = вариант со ←). Ключ словом (`recommended`, `keep`) тоже принимается.
Три стека на GPU:
| # | стек | смысл |
| --- | --- | --- |
| 1 | SwarmUI | только генерация картинок |
| 2 | SwarmUI + LLM | UI + Ollama на той же карте |
| 3 | только LLM | **без** SwarmUI — только Ollama |
Флаги: `up --yes --llm-only --ollama` / `--no-swarm --ollama`. Vars: `ENABLE_SWARMUI=false` или `WORKLOAD=llm`.
---
## Быстрый путь
### A — wizard
```text
gpu-rent setup
```
Меню: runtime → пресет моделей → опционально local-watchdog. Пишет `LLM_RUNTIME` в `gpu-rent.vars`.
### B — флаг на `up`
```text
gpu-rent up --yes --ollama
gpu-rent up --yes --llm ollama
gpu-rent up --yes --llm-only --ollama # без SwarmUI
```
С `--yes` пресеты не спрашивает (берёт существующий yaml / example).
### C — vars вручную
```env
LLM_RUNTIME=ollama
```
Потом `gpu-rent up --yes`.
Выключить: `LLM_RUNTIME=none` (на `up` старые LLM unit’ы на VM останавливаются).
Голый `gpu-rent` без args — **help**. Двойной клик: `GPU_RENT_DEFAULT_ARGS=up --yes`. Полный doctor на up: `up -v`.
---
## Порты (loopback + туннель)
| Сервис | На VM | На ноутбуке |
| --- | --- | --- |
| SwarmUI | 7801 | **17801** |
| Ollama | 11434 | **17811** |
```text
gpu-rent tunnel
gpu-rent open --llm
```
```powershell
$env:OLLAMA_HOST = "http://127.0.0.1:17811"
```
После `up`/`tunnel` — access-card с URL и MCP-сниппетом.
---
## Ollama
| Файл | Роль |
| --- | --- |
| `ollama-models.example.yaml` | шаблон в git |
| `ollama-models.yaml` | список тегов (gitignore); лаунчер копирует example при отсутствии |
На `up``ollama pull` по списку. Точные теги: уже есть `foo:7b` ≠ skip для `foo:3b`. Лишнее на диске не удаляет.
### Пресеты (меню)
| # | ключ | tag / смысл |
| --- | --- | --- |
| 1 | **recommended** | `huihui_ai/qwen2.5-vl-abliterated:7b` — vision+RU, ~6 GB |
| 2 | light | VL 3B abliterate (~3 GB) |
| 3 | text | text-only `qwen2.5-abliterate:7b` |
| 4 | stock | `qwen2.5:7b` |
| 5 | alt | другой text abliterate 7B |
| 6 | empty | только runtime |
| — | keep | не трогать yaml (если уже спросили повторно) |
`default: true` в yaml — preferred в логе; pull идёт по всему списку.
---
## Автотюнинг Ollama
Unit `gpu-rent-ollama` читает `/mnt/swarm_data/.gpu-rent-gpu.json`:
| Tier (VRAM) | Flash Attn | KEEP_ALIVE | KV cache | GPU_OVERHEAD |
| --- | --- | --- | --- | --- |
| low (<16GiB) | off | 2m | q4_0 | 6GiB |
| mid (1623) | on* | 5m | q8_0 | 10GiB |
| high (2447) | on* | 15m | q8_0 | 14GiB |
| ultra (≥48) | on* | 30m | q8_0 | 20GiB |
\*Flash на Ampere+ (compute ≥ 8.0). `NUM_PARALLEL=1`, `MAX_LOADED_MODELS=1`. Env: `/mnt/swarm_data/.gpu-rent-ollama.env`.
---
## Idle-killer и LLM
Busy (не гасить GPU):
- `ollama pull` (маркер младше ~45 мин; старше сбрасывается);
- загруженная модель в Ollama.
Ошибка установки LLM на `up`**fail** (не тихий лог).
---
## Supply-chain (опциональный pin)
По умолчанию install тянет upstream без pin (`WARN` в логе). Жёстче:
```bash
OLLAMA_VERSION=0.6.5
OLLAMA_SHA256=<sha256 of ollama-linux-amd64.tgz>
```
Готовые кейсы — в `gpu-rent.vars.example`.