One folder per meeting (out/<name>/source.*, transcript.txt, meta.json, logs/), out/_global; speaker transcript from DB; throwaway Edge profile; skip shots only when all images exist
This commit is contained in:
+9
-6
@@ -9,7 +9,7 @@ os.environ["NO_PROXY"] = "127.0.0.1,localhost"
|
||||
os.environ["PREFECT_SERVER_ANALYTICS_ENABLED"] = "false"
|
||||
os.environ.setdefault("PREFECT_LOGGING_LEVEL", os.environ.get("LOG_LEVEL", "INFO").upper())
|
||||
os.environ.setdefault("PREFECT_LOGGING_LOG_PRINTS", "true") # module print()s show in Prefect UI
|
||||
import argparse, sys
|
||||
import argparse, json, sys
|
||||
from pathlib import Path
|
||||
from prefect import flow, task
|
||||
from prefect.runtime import flow_run
|
||||
@@ -60,7 +60,7 @@ class Llama:
|
||||
def ensure(self, vision=True):
|
||||
if self.p and self.vision != vision: self.close()
|
||||
self.vision = vision
|
||||
log = db.out_dir(self.name) / ("llama.log" if vision else "llama_text.log")
|
||||
log = db.logs(self.name) / ("llama.log" if vision else "llama_text.log")
|
||||
try:
|
||||
p = llama.start(vision=vision, log=log)
|
||||
except Exception:
|
||||
@@ -75,7 +75,7 @@ class Llama:
|
||||
|
||||
def default_device():
|
||||
try:
|
||||
d = (db.OUT / "transcribe_device.txt").read_text().strip()
|
||||
d = (db.GLOBAL / "transcribe_device.txt").read_text().strip()
|
||||
return d if d in ("cuda", "npu") else "cuda"
|
||||
except OSError:
|
||||
return "cuda"
|
||||
@@ -90,8 +90,11 @@ def meeting(name: str, start_from: str = "audio", speakers: int = 0, model: str
|
||||
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 = db.out_dir(name) / "shots.json"
|
||||
skip_shots = start_from != "shots" and sj.exists() and sj.stat().st_size > 2
|
||||
sj, sd = db.out_dir(name) / "shots.json", db.out_dir(name) / "shots"
|
||||
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)
|
||||
skip_shots = 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)
|
||||
if skip_shots and go("shots"): print("shots already done: skipped (run from 'shots' to redo)")
|
||||
if start_from == "render":
|
||||
memory.run(name, link=False)
|
||||
@@ -136,7 +139,7 @@ def bench(name):
|
||||
except Exception as e: print("npu error:", e); npu_s = None
|
||||
cuda_s = transcribe.run(name, device="cuda", out_path=d / "bench_cuda.txt")
|
||||
dev = "cuda" if npu_s is None or npu_s > 3 * cuda_s else "npu"
|
||||
(db.OUT / "transcribe_device.txt").write_text(dev)
|
||||
(db.GLOBAL / "transcribe_device.txt").write_text(dev)
|
||||
print(f"npu_s={npu_s} cuda_s={cuda_s} device={dev}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user