Download phase2_corrected/code/hybrid_eval.py from Pricile/waxal2026-backup: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/Pricile/waxal2026-backup/resolve/main/phase2_corrected/code/hybrid_eval.py
- Command line
-
hf download hf://Pricile/waxal2026-backup/phase2_corrected/code/hybrid_eval.py
-
curl -L -o hybrid_eval.py https://huggingface.co/Pricile/waxal2026-backup/resolve/main/phase2_corrected/code/hybrid_eval.py
1.12 kB
| """Combine EXACT des hybrides par langue sur devhard (oracle lang), + verif LID.""" | |
| import json, jiwer, itertools | |
| ROWS=[json.loads(l) for l in open("/root/devhard/devhard_linsna.jsonl")] | |
| H=json.load(open("/root/devhard_allhyps.json",encoding="utf-8")) | |
| def comb(R,Hy): | |
| pr=[(r,h) for r,h in zip(R,Hy) if r.strip()] | |
| r=[x for x,_ in pr]; h=[x for _,x in pr] | |
| w=jiwer.wer(r,h); c=jiwer.cer(r,h); return w,c,0.5*w+0.5*c | |
| LIN=["lin_s4_best","joint_cont2_best","joint_cont_best","mms1b_lin_best"] | |
| SNA=["sna_ps_best","joint_cont2_best","joint_cont_best"] | |
| print("=== hybrides (oracle langue) ===") | |
| res=[] | |
| for a,b in itertools.product(LIN,SNA): | |
| hy=[H[a][r["id"]] if r["lang"]=="lin" else H[b][r["id"]] for r in ROWS] | |
| w,c,m=comb([r["text"] for r in ROWS],hy) | |
| res.append((m,a,b,w,c)) | |
| for m,a,b,w,c in sorted(res): | |
| print(f" {m:.4f} lin<-{a:18s} sna<-{b:18s} (WER {w:.4f} CER {c:.4f})") | |
| print() | |
| print("=== references simples ===") | |
| for n in ["joint_cont_best","joint_cont2_best"]: | |
| w,c,m=comb([r["text"] for r in ROWS],[H[n][r["id"]] for r in ROWS]) | |
| print(f" {m:.4f} {n} (WER {w:.4f} CER {c:.4f})") | |