|
1 | 1 | // debug_jfk.mjs — Compare wcpp-cpu-fp16 vs ct2-fp16 word-by-word for jfk.wav |
2 | 2 | import { promises as fs } from "node:fs"; |
3 | | -const a = JSON.parse(await fs.readFile("tools/stt-eval/whispercpp-dtw-poc/results/wcpp_cpu_fp16_jfk.json", "utf8")); |
4 | | -const b = JSON.parse(await fs.readFile("tools/stt-eval/whispercpp-dtw-poc/results/ct2_fp16_jfk.json", "utf8")); |
| 3 | + |
| 4 | +const a = JSON.parse( |
| 5 | + await fs.readFile("tools/stt-eval/whispercpp-dtw-poc/results/wcpp_cpu_fp16_jfk.json", "utf8"), |
| 6 | +); |
| 7 | +const b = JSON.parse( |
| 8 | + await fs.readFile("tools/stt-eval/whispercpp-dtw-poc/results/ct2_fp16_jfk.json", "utf8"), |
| 9 | +); |
5 | 10 | const wa = a.segments[0].words; |
6 | 11 | const wb = b.segments[0].words; |
7 | 12 | console.log("wcpp words:", wa.length, "ct2 words:", wb.length); |
8 | 13 | const maxN = Math.max(wa.length, wb.length); |
9 | 14 | for (let i = 0; i < maxN; i++) { |
10 | 15 | const aw = wa[i] || { word: "<eof>", start: 0, end: 0 }; |
11 | 16 | const bw = wb[i] || { word: "<eof>", start: 0, end: 0 }; |
12 | | - const dw = aw.end - aw.start, dc = bw.end - bw.start; |
| 17 | + const dw = aw.end - aw.start, |
| 18 | + dc = bw.end - bw.start; |
13 | 19 | const dStart = Math.abs(aw.start - bw.start) * 1000; |
14 | | - const dEnd = Math.abs(aw.end - bw.end) * 1000; |
| 20 | + const dEnd = Math.abs(aw.end - bw.end) * 1000; |
15 | 21 | console.log( |
16 | 22 | ` ${String(i).padStart(2)} ` + |
17 | | - `wcpp=${aw.word.padEnd(15)}[${aw.start.toFixed(2)},${aw.end.toFixed(2)}] ` + |
18 | | - `ct2 =${bw.word.padEnd(15)}[${bw.start.toFixed(2)},${bw.end.toFixed(2)}] ` + |
19 | | - `Δs=${dStart.toFixed(0).padStart(5)}ms Δe=${dEnd.toFixed(0).padStart(5)}ms ` + |
20 | | - `wcpp_dur=${(dw*1000).toFixed(0).padStart(5)}ms ct2_dur=${(dc*1000).toFixed(0).padStart(5)}ms`, |
| 23 | + `wcpp=${aw.word.padEnd(15)}[${aw.start.toFixed(2)},${aw.end.toFixed(2)}] ` + |
| 24 | + `ct2 =${bw.word.padEnd(15)}[${bw.start.toFixed(2)},${bw.end.toFixed(2)}] ` + |
| 25 | + `Δs=${dStart.toFixed(0).padStart(5)}ms Δe=${dEnd.toFixed(0).padStart(5)}ms ` + |
| 26 | + `wcpp_dur=${(dw * 1000).toFixed(0).padStart(5)}ms ct2_dur=${(dc * 1000).toFixed(0).padStart(5)}ms`, |
21 | 27 | ); |
22 | 28 | } |
0 commit comments