Skip to content

Warn when an acoustic model directory has no feat.params - #494

Merged
dhdaines merged 1 commit into
cmusphinx:mainfrom
lenzo-ka:warn_missing_feat_params
Aug 30, 2026
Merged

Warn when an acoustic model directory has no feat.params#494
dhdaines merged 1 commit into
cmusphinx:mainfrom
lenzo-ka:warn_missing_feat_params

Conversation

@lenzo-ka

@lenzo-ka lenzo-ka commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

A model directory lacking feat.params was accepted without any diagnostic. The front end is then built from caller-supplied values plus generic defaults (transform=legacy, nfilt=40, nfft=0, lifter=0), which can silently produce a feature recipe that does not match the model's training while initialization and decoding still appear successful. For scale, the shipped en-us model's own file specifies -nfilt 25, -transform dct, and -lifter 22.

PocketSphinx cannot infer the training-time front end from the acoustic parameter files, so it cannot validate the configuration. It can, however, observe that a model directory was supplied and no feature parameter record exists. This change emits one warning during model configuration expansion in exactly that case, naming the directory and stating that the front end will be built from defaults plus caller-supplied configuration. It is deliberately a warning, not an error: a caller may legitimately supply the complete front-end configuration itself. No other behavior changes.

The new unit test test_featparams asserts that a model shipping feat.params loads without the warning, and that a copy of the same model with the file removed initializes with the warning and a null effective featparams. The stripped case fails against the previous implementation.

Fixes #497

Tested on macOS (Apple clang) and Linux x86-64 (GCC 13.3); full unit and regression suite passes on both.

A model directory lacking feat.params was accepted silently, and the
front end was built from caller-supplied values plus generic defaults.
That can produce a feature recipe that does not match the model's
training while initialization and decoding still appear successful.

Emit a warning during model configuration expansion when hmm is set
and no feature parameter file is available, naming the directory.
This is deliberately a warning, not an error: a caller may
legitimately supply the complete front-end configuration itself.
No other behavior change.

test_featparams asserts that a model shipping feat.params loads
without the warning, and that a copy of the same model stripped of
feat.params initializes with the warning and a null effective
featparams. The stripped case fails against the previous
implementation.
@dhdaines

Copy link
Copy Markdown
Contributor

Good! The change is not disruptive, and inquiring minds need to know.

feat.params is a lousy hack to begin with (and it is 100% my fault)

SoundSwallower does something considerably more structured (https://github.com/ReadAlongs/SoundSwallower/tree/main/model/en-us) motivated in part by wanting to make things more "web-native" and I really think that we should merge the two codebases back together and make that PocketSphinx 6.0.

@dhdaines
dhdaines merged commit ac886c2 into cmusphinx:main Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Silent acceptance of an acoustic model directory with no feat.params

2 participants