-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_models.py
More file actions
82 lines (68 loc) · 2.95 KB
/
Copy pathbuild_models.py
File metadata and controls
82 lines (68 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"""
Curatarr - Build Ollama Models
Pulls base models if not already present, then bakes system prompts
into curatarr-curator and curatarr-summarizer.
Run once after changing BASE_CURATOR_MODEL or BASE_SUMMARIZER_MODEL:
python build_models.py
"""
import asyncio
import sys
sys.path.insert(0, ".")
# Windows consoles default to cp1252, which crashes on the → / ✅ in our
# prints. Force UTF-8 so the rebuild never dies on a status line.
try:
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
except Exception:
pass
from src.services.setup_wizard import build_ollama_models
from src.config import settings
async def main():
endpoint = settings.effective_ollama
curator_base = settings.BASE_CURATOR_MODEL
summarizer_base = settings.BASE_SUMMARIZER_MODEL
# Two-bake split: only build the pitcher when the split is enabled
# (PITCHER_MODEL set in .env). Gating on BASE_PITCHER_MODEL instead
# would pull 17 GB on every fresh install.
pitcher_base = settings.BASE_PITCHER_MODEL if (
settings.PITCHER_MODEL or "").strip() else None
print(f"\nOllama endpoint : {endpoint}")
print(f"Curator base : {curator_base} → curatarr-curator")
print(f"Summarizer base : {summarizer_base} → curatarr-summarizer")
if pitcher_base:
print(f"Pitcher base : {pitcher_base} → curatarr-pitcher")
else:
print("Pitcher : disabled (PITCHER_MODEL empty) — skipping")
print("\nMissing models will be pulled automatically.\n")
print("─" * 60)
results = await build_ollama_models(endpoint, curator_base, summarizer_base,
base_pitcher=pitcher_base)
print("─" * 60)
if results.get("curator"):
print("✅ curatarr-curator ready")
else:
print(f"❌ curatarr-curator failed")
print(f" Is '{curator_base}' available on Ollama Hub?")
if results.get("summarizer"):
print("✅ curatarr-summarizer ready")
else:
print(f"❌ curatarr-summarizer failed")
print(f" Is '{summarizer_base}' available on Ollama Hub?")
if pitcher_base:
if results.get("pitcher"):
print("✅ curatarr-pitcher ready")
else:
print(f"❌ curatarr-pitcher failed")
print(f" Is '{pitcher_base}' available on Ollama Hub?")
if results.get("embedding"):
print(f"✅ {settings.EMBEDDING_MODEL} (embeddings) ready")
else:
print(f"❌ {settings.EMBEDDING_MODEL} (embeddings) failed")
print(f" Could not pull '{settings.EMBEDDING_MODEL}' — without it, enrichment")
print(f" produces text but no vectors (every item stays vector_ready=0).")
if all(results.values()):
print("\n🎬 All models ready — restart Curatarr.\n")
else:
print("\n⚠️ Fix the errors above and run this script again.\n")
sys.exit(1)
asyncio.run(main())