Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ be compared only when no such change lies between them.
docs and recipe comments now call it Olign v1, Olewave's job API, since it
runs Olewave's current release. Its published rows keep the name Olign 1.0,
the release that produced them. No number moves.
- Every Olign v1 upload, on both tracks, asks for phone times with the form
field `timestamps=phone`. Olign v1.2.1 returns word times alone unless a job
asks, and the phone tier is scored. A Track 1 answer whose words carry no
phones now stops the run instead of scoring an empty phone tier. Olign's
answers and every cached result are unchanged, so no number moves.

## [2.1.0] - 2026-11-10

Expand Down
17 changes: 17 additions & 0 deletions fabench/aligners/olign_v1/test/test_olign_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def test_track1_sends_the_transcript_and_reads_words_and_phones(audio, tmp_path,
assert post["headers"]["User-Agent"] == "fa-bench-olign/1"
assert b'name="transcript"' in post["data"] and b"in wage" in post["data"]
assert b'name="audio"' in post["data"]
assert b'name="timestamps"\r\n\r\nphone\r\n' in post["data"]
assert poll["url"] == "https://api.olewave.com/olign/v1/j1"
assert [(w.label, w.start, w.end) for w in out.words] == [("in", 0.14, 0.31), ("wage", 0.31, 0.75)]
assert out.words[0].conf == pytest.approx(0.98)
Expand All @@ -88,6 +89,7 @@ def test_track2_sends_audio_alone(audio, tmp_path, monkeypatch, server):
out = _make(OlignV1ASR, tmp_path, monkeypatch).align(audio, "the reference is never sent")
assert b'name="transcript"' not in calls[0]["data"]
assert b"the reference is never sent" not in calls[0]["data"]
assert b'name="timestamps"\r\n\r\nphone\r\n' in calls[0]["data"]
assert out.meta["transcript_source"] == "asr"
assert [w.label for w in out.words] == ["in", "wage"]

Expand All @@ -103,6 +105,21 @@ def test_no_speech_is_an_empty_answer_and_is_cached(audio, tmp_path, monkeypatch
assert a.align(audio, "").meta["cached"] is True and len(calls) == n


def test_words_without_phones_fail_loudly(audio, tmp_path, monkeypatch, server):
_, state = server
state["final"] = {**DONE, "result": {"words": [{**w, "phones": []} for w in DONE["result"]["words"]]}}
with pytest.raises(Exception, match="2 words came back with no phones"):
_make(OlignV1, tmp_path, monkeypatch).align(audio, "in wage")


def test_track2_words_without_phones_are_kept(audio, tmp_path, monkeypatch, server):
_, state = server
state["final"] = {**DONE, "transcript_source": "asr",
"result": {"words": [{**w, "phones": []} for w in DONE["result"]["words"]]}}
out = _make(OlignV1ASR, tmp_path, monkeypatch).align(audio, "")
assert [w.label for w in out.words] == ["in", "wage"] and out.phones == []


def test_any_other_failure_raises(audio, tmp_path, monkeypatch, server):
_, state = server
state["final"] = {"state": "failed", "log_tail": "pipeline crashed"}
Expand Down
14 changes: 13 additions & 1 deletion fabench/timestamp_asrs/cloud/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ def elevenlabs_fa_parse(r: dict, model: str, opts: dict) -> tuple[list[Word], di
#: The job's own word for a recording with nothing in it. A real answer, so
#: it is kept and cached as an empty result rather than retried on every run.
OLIGN_NO_SPEECH = "no speech recognized"
#: Olign answers with word times alone unless a job asks for phones, and the
#: phone tier is scored, so every upload asks. Sent as a form field and kept
#: out of the recipe options, so the cache key, and every cached answer, stays.
OLIGN_TIMESTAMPS = "phone"


def olign_v1_call(blob: bytes, path: str, model: str, opts: dict, key: str,
Expand All @@ -325,7 +329,7 @@ def olign_v1_call(blob: bytes, path: str, model: str, opts: dict, key: str,
text = str(opts.get("text") or "").strip()
if text:
files["transcript"] = ("transcript.txt", "text/plain", text.encode("utf-8"))
ctype, body = multipart({}, files)
ctype, body = multipart({"timestamps": OLIGN_TIMESTAMPS}, files)
_note("endpoint", base); _note("api_version", "v1")
created = request_json(base, method="POST", data=body,
headers={**auth, "Content-Type": ctype},
Expand Down Expand Up @@ -374,6 +378,14 @@ def olign_v1_parse(r: dict, model: str, opts: dict) -> tuple[list[Word], dict, l
ps = p.get("score")
phones.append([str(p.get("ph") or ""), float(p["begin"]), float(p["end"]),
None if ps is None else float(ps) / 100.0])
# Aligned words with no phones at all mean the request for phones never
# reached the job. Scoring that would report an empty phone tier as Olign's,
# so stop. Only for the given transcript: Track 2 scores words alone, and a
# few of its genuine answers name words without phones.
spoken = [w for w in res.get("words") or [] if str(w.get("word") or "").strip()]
if r.get("transcript_source") == "client" and spoken and not any(w.get("phones") for w in spoken):
raise CloudASRError(f"olign_v1: {len(spoken)} words came back with no phones, "
f"so timestamps={OLIGN_TIMESTAMPS} did not reach the job")
meta = {"api_model": model, "transcript_source": r.get("transcript_source"),
"job_state": r.get("state")}
if r.get("state") == "failed":
Expand Down
Loading