Skip to content

fix: read flm_version directly when checking compatibility (#545) - #571

Open
istitov wants to merge 1 commit into
ROCm:mainfrom
istitov:fix/545-whisper-version-check
Open

fix: read flm_version directly when checking compatibility (#545)#571
istitov wants to merge 1 commit into
ROCm:mainfrom
istitov:fix/545-whisper-version-check

Conversation

@istitov

@istitov istitov commented May 28, 2026

Copy link
Copy Markdown

Fixes #545.

Problem

After flm pull whisper-v3:turbo, both flm list and flm serve --asr 1 abort:
Assertion this->hidden_size > 0 failed. (lm_config.hpp:121)

Root cause

ModelDownloader::check_model_compatibility() reads each model's flm_version by constructing a base LM_Config and calling from_pretrained() — which
runs the decoder-LM shape asserts (hidden_size > 0, …). A HuggingFace Whisper config.json carries d_model, not hidden_size, so hidden_size stays
0 and the assert fires. Whisper_Config exists and reads d_model, but from_pretrained is non-virtual and this scan path uses the base class for
every model regardless of model_type.

Why it doesn't reproduce on the default build: the linux-default preset is Release (-DNDEBUG), so assert() is a no-op and the path runs silently.
Builds with asserts live abort.

Fix

A compatibility check only needs flm_version, so read it straight from config.json instead of constructing + validating a full LM config.

Why this approach

  • (this PR) read flm_version directly — model-type-agnostic (handles Whisper and any future non-LM config), minimal, and decouples a version check
    from LM-loadability validation.
  • (alternative) route model_type == "whisper" to Whisper_Config here — uses the existing subclass but needs a model_type peek and only covers
    Whisper.

A broader fix (make from_pretrained virtual + dispatch by model_type at all scan sites) is left out of scope. The Whisper loading path already
uses Whisper_Config and is untouched.

Testing

Built with asserts live (no -DNDEBUG) against a pristine whisper-v3:turbo config: flm list completes (whisper-v3:turbo ✅) and flm serve --asr 1 loads the model and starts the server. Both aborted before.

check_model_compatibility() built a base LM_Config and called
from_pretrained() only to read flm_version, which runs the decoder-LM
shape asserts (hidden_size > 0, ...). A HuggingFace Whisper config.json
carries d_model rather than hidden_size, so the assert aborts `flm list`
and `flm serve --asr 1`. The linux-default Release build sets -DNDEBUG,
making assert() a no-op, so the crash is masked there.

A compatibility check only needs flm_version, so read it directly from
config.json: model-type agnostic and independent of LM-shape fields.
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.

Whisper: hidden_size > 0 assertion in lm_config.hpp:121 crashes flm serve --asr 1 and flm list after Whisper pull

1 participant