Repository navigation
Populate AudioConfig from sensevoice encoder_conf in _extract_audio_config - #307
Merged
Merged
Conversation
…onfig
The arch_validation tests for sensevoice_small failed because the
HuggingFace config for SenseVoice (model_type=sensevoice) keeps every
encoder field nested under encoder_conf (output_size, attention_heads,
num_blocks, tp_blocks, linear_units, kernel_size) plus an
input_size/vocab_size at the top level and num_mels under
frontend_conf. _extract_audio_config did not know about this layout,
so config.audio came back None and the SenseVoiceSmallModel ctor
hit 'assert audio is not None'.
The L1 path with the tiny synthetic config still worked because that
fixture sets config.audio directly; only the real HF config (L2) was
broken.
Add a sensevoice branch that maps encoder_conf.{output_size,
attention_heads, num_blocks, tp_blocks, linear_units, kernel_size},
top-level input_size, and frontend_conf.n_mels into AudioConfig.
pytest tests/arch_validation_test.py -k sensevoice_small -v
test_config_downloads_and_parses PASSED
test_full_graph_builds PASSED
test_graph_shapes_consistent PASSED
Full src/ + build_graph: 2753 passed, 41 skipped.
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Performance Comparison
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes HuggingFace SenseVoice config parsing so ArchitectureConfig.audio is populated during L2 arch validation builds, preventing SenseVoiceSmallModel.__init__ from failing with assert audio is not None.
Changes:
- Add a
model_type == "sensevoice"branch in_extract_audio_config()to mapencoder_conf.*, top-levelinput_size, andfrontend_conf.n_melsintoAudioConfig.
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
tests/arch_validation_test.pyfailed forsensevoice_smallwithAssertionErrorinSenseVoiceSmallModel.__init__(assert audio is not None).Why
HuggingFace SenseVoice (
model_type=sensevoice) keeps every encoder field nested underencoder_conf, plusinput_size/vocab_sizeat the top level andn_melsunderfrontend_conf:{ "model_type": "sensevoice", "vocab_size": 25055, "input_size": 560, "encoder_conf": { "output_size": 512, "attention_heads": 4, "num_blocks": 50, "tp_blocks": 20, "linear_units": 2048, "kernel_size": 11 }, "frontend_conf": {"n_mels": 80} }_extract_audio_confighad no branch forsensevoice, soconfig.audiocame backNone. The L1 build_graph test still passed because its tiny synthetic config setsconfig.audiodirectly; only the L2 arch-validation path (real HF config) was broken.Fix
Map
encoder_conf.*+ top-levelinput_size+frontend_conf.n_melsinto the correspondingAudioConfigfields. All target fields (attention_dim,attention_heads,num_blocks,tp_num_blocks,linear_units,kernel_size,input_size,num_mel_bins) already exist onAudioConfig— no new fields needed.Tests
Full unit suite (
src/+tests/build_graph_test.py): 2753 passed, 41 skipped, 0 failures.