fast-vibevoice-notes / eval_v4_wrapper.py
ACloudCenter's picture
add 5th sub: safe long_drift aggregation (the recurring empty-mean bug — must live here, canonical file can't be rewritten from context)
6f54577 verified
Raw History Blame Contribute Delete
1.54 kB
import os, urllib.request
os.environ.setdefault('ARMS', 'stock,soar')
assert os.environ.get('HF_TOKEN'), 'no token'
urllib.request.urlretrieve('https://huggingface.co/datasets/ACloudCenter/fast-vibevoice-notes/resolve/main/eval_2x2.py', '/eval_2x2.py')
src = open('/eval_2x2.py').read()
subs = [
('SOAR_REPO = "ACloudCenter/vibevoice-soar-head-1.5B"', 'SOAR_REPO = "ACloudCenter/vibevoice-soar-v4"'),
('hf_hub_download(SOAR_REPO, "soar_head_state.pt")', 'hf_hub_download(SOAR_REPO, "v4_best.pt")'),
('OUT_REPO = "ACloudCenter/vibevoice-eval-2x2"', 'OUT_REPO = "ACloudCenter/vibevoice-eval-soarv4"'),
('hyp = transcriber(f"/out/{fn}", generate_kwargs={"language": "english"})', 'hyp = transcriber(f"/out/{fn}", return_timestamps=True, generate_kwargs={"language": "english"})'),
('"long_drift": st.mean(r["drift"] for r in rows if r["drift"] is not None)}', '"long_drift": (lambda v: st.mean(v) if v else None)([r["drift"] for r in rows if r["drift"] is not None])}'),
]
for old, new in subs:
assert old in src, f'missing: {old[:60]}'
src = src.replace(old, new)
open('/eval_v4.py', 'w').write(src)
print('PATCHED OK (5 subs)', flush=True)
os.system('python /eval_v4.py 2>&1 | tee /eval.log')
try:
from huggingface_hub import HfApi
a = HfApi(token=os.environ.get('HF_TOKEN'))
a.upload_file(path_or_fileobj='/eval.log', path_in_repo='v4-eval-log.txt', repo_id='ACloudCenter/fast-vibevoice-notes', repo_type='dataset')
print('LOG UPLOADED')
except Exception as e:
print('LOG UPLOAD FAILED:', e)