Auto-scale hardware: CUDA 13 only on cc>=7.5, pin ctranslate2 4.8 (cu12), fp16-less GPUs, CPU threads, llama --fit on >=7 GiB GPUs, CPU-only embeddings

This commit is contained in:
Stefano Zini
2026-11-04 14:14:26 +01:00
parent 03ba83fba8
commit a741859140
5 changed files with 48 additions and 19 deletions
+12 -8
View File
@@ -1,7 +1,8 @@
# /// script
# requires-python = ">=3.10,<3.13"
# dependencies = ["prefect>=3", "faster-whisper", "av>=14,<17", "nvidia-cublas-cu12", "nvidia-cudnn-cu12==9.*", "sherpa-onnx", "numpy", "imagehash", "Pillow", "markdown", "openvino-genai", "huggingface_hub"]
# dependencies = ["prefect>=3", "faster-whisper", "ctranslate2==4.8.*", "av>=14,<17", "nvidia-cublas-cu12", "nvidia-cudnn-cu12==9.*", "sherpa-onnx", "numpy", "imagehash", "Pillow", "markdown", "openvino-genai", "huggingface_hub"]
# ///
# ponytail: ctranslate2 4.8 links cublas64_12 (matches the nvidia-*-cu12 wheels); bump all three together when it moves to CUDA 13
"""Meeting pipeline. uv run --script flow.py <name> [--from STEP] [--speakers N] [--device cuda|npu] [--bench-npu]"""
import os
os.environ.setdefault("PREFECT_API_URL", "http://127.0.0.1:4200/api")
@@ -17,7 +18,7 @@ from prefect.task_runners import ThreadPoolTaskRunner
import audio, db, diarize, docs, llama, memory, report, shots, speakers, transcribe
HERE = Path(__file__).parent
STEPS = ["audio", "transcribe", "diarize", "speakers", "shots", "docs", "report", "memory", "render"]
STEPS = ["audio", "transcribe", "diarize", "speakers", "shots", "docs", "report", "memory", "render", "title"]
def step_status(name, s):
@@ -89,18 +90,21 @@ def meeting(name: str, start_from: str = "audio", speakers: int = 0, model: str
try:
db.upsert_recording(name, flow_run_id=str(flow_run.id))
db.progress_start(name, start_from)
# shots (slow, one vision call per screen) depend only on the video: keep them when re-running an earlier step; an explicit "shots" run redoes them
sj, sd = db.out_dir(name) / "shots.json", db.out_dir(name) / "shots"
# shots run every time unless the GUI toggle "Salta schermate" is on
sj = db.out_dir(name) / "shots.json"
try: done = json.loads(sj.read_text(encoding="utf-8"))
except (OSError, ValueError): done = []
# complete = every referenced frame/crop is still on disk (a run cancelled mid-shots wipes them while shots.json is stale)
no_shots = (db.GLOBAL / "skip_shots.txt").exists() # GUI toggle "Salta schermate"
skip_shots = no_shots or (start_from != "shots" and bool(done) and all((sd / f).exists() for s in done for f in (s.get("file"), s.get("view")) if f))
skip_shots = no_shots
if no_shots and not done:
for f in ("shots.json", "glossary.json"): (db.out_dir(name) / f).write_text("[]")
db.replace_shots(name, [])
if skip_shots and go("shots"): print("shots skipped" if no_shots else "shots already done: skipped (run from 'shots' to redo)")
if start_from == "render":
if skip_shots and go("shots"): print("shots skipped")
if start_from == "title":
L.ensure(vision=False)
report.retitle(name)
memory.run(name, link=False)
elif start_from == "render":
memory.run(name, link=False)
else:
if go("audio"): t_audio(name)