Skip to content
Open
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
4 changes: 4 additions & 0 deletions evals/aligners/rumblex/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ emits_confidence: true
params:
venv: venv
model: Reson8/Rumble-2-Flash
# The model commit the published row was measured on. rumblex has no
# revision argument, so the worker resolves this snapshot itself. Keep it
# equal to REVISION in download_and_install.sh, and re-run the sweep on a bump.
revision: 95bd5f9133a2398e5e48a98c089fe48e122bde97
device: cuda
13 changes: 11 additions & 2 deletions evals/aligners/rumblex/download_and_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
set -euo pipefail
HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
MODEL=${MODEL:-Reson8/Rumble-2-Flash}
# MODEL COMMIT PINNED, the one the published row was measured on. Keep it equal
# to params.revision in config.yaml. Bump deliberately + re-run the sweep.
REVISION=${REVISION:-95bd5f9133a2398e5e48a98c089fe48e122bde97}

# Re-runnable: reuse a venv that already has an interpreter.
[ -x "$HERE/venv/bin/python" ] || uv venv "$HERE/venv" --python 3.12
Expand All @@ -36,11 +39,17 @@ uv pip install --python "$HERE/venv/bin/python" rumblex==0.6.0
# uv venvs have no pip of their own; ask uv, not the venv.
uv pip freeze --python "$HERE/venv/bin/python" > "$HERE/requirements.lock"

# The whole snapshot, not only what load_model reads: rumblex fetches
# ctc/ctc_head.safetensors on the first align, which an offline sweep cannot do.
"$HERE/venv/bin/python" - <<PY
import torch
import rumblex
from huggingface_hub import snapshot_download
from rumblex.aligner import CTCHead
print("rumblex", rumblex.__version__, "| torch", torch.__version__, "cuda", torch.cuda.is_available())
print("fetching $MODEL ...")
rumblex.load_model("$MODEL", device="cpu")
print("fetching $MODEL at $REVISION ...")
path = snapshot_download("$MODEL", revision="$REVISION")
rumblex.load_model(path, device="cpu")
CTCHead.from_pretrained(path)
print("rumblex ok")
PY
9 changes: 9 additions & 0 deletions evals/aligners/rumblex/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from __future__ import annotations

import json
import os
import sys

import numpy as np
Expand All @@ -40,10 +41,18 @@ def load_audio(path: str) -> tuple[np.ndarray, int]:
def main(argv: list[str]) -> int:
jobs_path, model_id = argv[0], argv[1]
device = argv[2] if len(argv) > 2 else "cuda"
revision = argv[3] if len(argv) > 3 else None

import rumblex
import torch

# rumblex takes a repo id or a local folder and has no revision argument,
# so a pinned commit is resolved to its snapshot folder here. That folder
# holds ctc/ as well, and with HF_HUB_OFFLINE=1 it comes from the cache.
if revision and not os.path.isdir(model_id):
from huggingface_hub import snapshot_download
model_id = snapshot_download(model_id, revision=revision)

# startswith, as in the other workers: the cell runners pass "cuda:0".
device = device if (device.startswith("cuda")
and torch.cuda.is_available()) else "cpu"
Expand Down
7 changes: 6 additions & 1 deletion fabench/aligners/rumblex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ CTC probability among a word's tokens.
evals/aligners/rumblex/download_and_install.sh # its own venv, pinned
```

The script fetches the whole model snapshot at the pinned commit, CTC head
included, so the sweep can run with `HF_HUB_OFFLINE=1` afterwards.

## Config

```yaml
Expand All @@ -29,5 +32,7 @@ evals/aligners/rumblex/download_and_install.sh # its own venv, pinned
enabled: true
modes: [A]
granularity: [word]
params: { model: Reson8/Rumble-2-Flash, device: cuda }
params: { model: Reson8/Rumble-2-Flash, revision: 95bd5f9133a2398e5e48a98c089fe48e122bde97, device: cuda }
```

`revision` is the model commit. Without it the worker loads the repo's latest.
8 changes: 6 additions & 2 deletions fabench/aligners/rumblex/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ class Rumblex(SubprocessAligner):
default_model = "Reson8/Rumble-2-Flash"

def _extra_argv(self) -> list[str]:
"""worker.py <jobs> <model> <device>."""
return [str(self.params.get("device", "cuda"))]
"""worker.py <jobs> <model> <device> [revision]."""
argv = [str(self.params.get("device", "cuda"))]
revision = self.params.get("revision")
if revision:
argv.append(str(revision))
return argv
Loading