Skip to content

fix: keep the real cause when align model loading fails - #5

Merged
KalebJS merged 1 commit into
KalebJS:mainfrom
mainpart:fix/align-model-error-masking
Jul 23, 2026
Merged

KalebJS merged 1 commit into
KalebJS:mainfrom
mainpart:fix/align-model-error-masking

Conversation

@mainpart

Copy link
Copy Markdown

Problem

load_align_model reports every non-network failure as "model could not be found", whatever actually happened:

ValueError: The chosen align_model "jonatasgrosman/wav2vec2-large-xlsr-53-russian"
could not be found in huggingface (https://huggingface.co/models) or torchaudio (...)

I hit this on an interrupted download while whisper-large-v3 was being fetched in parallel. The real error was:

OSError: Can't load feature extractor for 'jonatasgrosman/wav2vec2-large-xlsr-53-russian'.
... make sure it is the correct path to a directory containing a preprocessor_config.json file

The model exists and is fine — the very next run loaded it from cache without touching the network. But the message sent me checking whether the repo had been renamed or pulled, which it hadn't. A gated repo or a cache permission problem lands in the same branch and reads identically.

The cause was chained with from e, but a CLI user sees the message, not the chained traceback.

Changes

  • put the cause into both the raised message and the log line
  • swap print for logger.error — the rest of the module logs, these two calls bypassed it
  • soften the wording so a load failure no longer asserts the model is missing
  • add a test for the non-network branch; the existing test only covers the network path

Before:

ValueError: The chosen align_model "..." could not be found in huggingface (...) or torchaudio (...)

After:

ValueError: Could not load align_model "..." (OSError: Can't load feature extractor for '...').
If the name is correct, check that the model is reachable on huggingface (...) or is a
torchaudio pipeline (...).

Verification

tests/test_alignment.py ......                    [100%]
6 passed, 20 deselected in 80.90s

Independent of #4 — no overlapping files.

Every non-network failure in load_align_model is reported as

    ValueError: The chosen align_model "jonatasgrosman/wav2vec2-large-xlsr-53-russian"
    could not be found in huggingface (...) or torchaudio (...)

regardless of what actually went wrong. Hit this on an interrupted
download: the underlying error was

    OSError: Can't load feature extractor for '<model>'. ... make sure
    '<model>' is the correct path to a directory containing a
    preprocessor_config.json file

but the message said the model does not exist. It does — the very next
run loaded it from cache without touching the network. A gated repo or a
cache permission problem lands in the same branch and reads the same way.

The original exception was already chained with `from e`, but the chained
traceback is not what a CLI user sees; they see the message.

- put the cause into the raised message and the log line
- swap `print` for `logger.error`, matching the rest of the module
- soften the wording: a load failure is not proof the model is missing
- add a test covering the non-network branch (the existing test only
  exercises the network path)
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mainpart, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4cf405e0-75a1-48c3-8dd2-a7fa84fc5e58

📥 Commits

Reviewing files that changed from the base of the PR and between 8f108ee and 135d66f.

📒 Files selected for processing (2)
  • tests/test_alignment.py
  • whispermlx/alignment.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@KalebJS
KalebJS merged commit 5ade52d into KalebJS:main Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants