app/ = /opt/callrec (Node-Backend, Vite-Frontend, Python-Inferenz, Audio-Skripte, rkllm_server.cpp), system/ = systemd-Units, WirePlumber/PipeWire-Drop-ins, sudoers. Modelle, Binaries, Aufnahmen und node_modules bleiben draussen (.gitignore). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
24 lines
872 B
Python
24 lines
872 B
Python
import sys, time
|
|
import numpy as np
|
|
sys.path.insert(0, "/opt/callrec")
|
|
from inference.rknpu_whisper_encoder import RknnWhisperEncoder
|
|
|
|
M = "/opt/callrec/models/turbo-encoder-fp16.rknn"
|
|
print("== init ==", flush=True)
|
|
t0 = time.time()
|
|
e = RknnWhisperEncoder(M, lib_path="/usr/lib/librknnrt.so")
|
|
print(f"init OK in {time.time()-t0:.1f}s", flush=True)
|
|
|
|
rng = np.random.default_rng(9)
|
|
mel = (rng.standard_normal((1,128,3000))*0.5).astype(np.float32)
|
|
print("== run ==", flush=True)
|
|
t0 = time.time()
|
|
out = e.run(mel)
|
|
dt = time.time()-t0
|
|
print(f"run OK in {dt:.2f}s out.shape={out.shape} dtype={out.dtype}", flush=True)
|
|
print(f"out mean={out.mean():.4f} std={out.std():.4f} min={out.min():.3f} max={out.max():.3f}", flush=True)
|
|
# second run (warm) timing
|
|
t0=time.time(); e.run(mel); print(f"warm run {time.time()-t0:.2f}s", flush=True)
|
|
e.close()
|
|
print("== done ==", flush=True)
|