feat(speech_recognition): add faster-whisper engine backend - #543
Draft
jatinkrmalik wants to merge 9 commits into
Draft
feat(speech_recognition): add faster-whisper engine backend#543jatinkrmalik wants to merge 9 commits into
jatinkrmalik wants to merge 9 commits into
Conversation
Introduce a typed EngineType enum and an Engine Protocol in common_types.py, plus an engines/ registry so new speech recognition backends can be plugged in without scattering string comparisons across the manager.
Add a faster-whisper engine implementation using CTranslate2/INT8 for fast CPU inference. Includes model metadata utility, wiring through the recognition manager, CLI, settings UI, config, optional dependency, and unit tests. Also updates the suspend-handler test fixture for the new engine attribute.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #543 +/- ##
==========================================
- Coverage 84.83% 84.76% -0.07%
==========================================
Files 33 36 +3
Lines 5861 6077 +216
Branches 951 979 +28
==========================================
+ Hits 4972 5151 +179
- Misses 688 719 +31
- Partials 201 207 +6
🚀 New features to boost your workflow:
|
- Import missing get_compute_type helper - Add tests for English-only detection, cache exceptions, and import-error registry path - Clear _has_torch_cuda lru_cache around exception test to avoid cached True - Replace broad builtins.__import__ patch with a fake engine module for registry test - Restore registry module state after test
Cover previously missing lines in: - faster_whisper_model_info.py: HF cache path/none, hf_hub lookup, fallback traversal, torch CUDA true, psutil exception - faster_whisper_engine.py: model None guard after is_ready() - engine registry import-error path
- Add faster_whisper to --engine help text and examples - Add faster-whisper as interactive option 5 with description - Install faster-whisper package and verify import at install time - Add fallback to whisper.cpp if faster-whisper installation fails - Add smoke test for faster-whisper import - Update welcome message engine display name - Note: faster-whisper models download automatically on first use
- Inline FASTER_WHISPER_MODEL_INFO dict literal; drop unused AVAILABLE_MODELS/MODEL_SIZES - Reuse _has_torch_cuda() in FasterWhisperEngine.device property - Remove redundant model None guard after is_ready() verification - Shrink faster-whisper default config in install.sh to engine + model_size - Update device tests to manage _has_torch_cuda lru_cache - Remove test for deleted dead-code guard
1 task
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.
Summary
This PR adds faster-whisper as a new speech recognition engine for Vocalinux, delivering significantly faster CPU inference via CTranslate2 and INT8 quantization. It also lays the groundwork for future engine additions by introducing a minimal
EngineProtocol and anengines/registry.https://huggingface.co/collections/Systran/faster-whisper
What changed
Phase 0 — engine abstraction
EngineTypeenum andEngineProtocol tosrc/vocalinux/common_types.py.src/vocalinux/speech_recognition/engines/__init__.pyas a registry for engine implementations.Phase 1 — faster-whisper backend
src/vocalinux/speech_recognition/engines/faster_whisper_engine.pyimplementing theEngineProtocol.src/vocalinux/utils/faster_whisper_model_info.pyfor model metadata, download-cache detection, and recommendations.SpeechRecognitionManager(init, transcribe, reconfigure, reinitialize-after-resume)."faster_whisper"to CLI--enginechoices.ConfigManagerdefaults.faster-whisper>=1.0.0as an optional dependency ([faster_whisper]).vocalinux.speech_recognition.enginesto setuptools packages.tests/test_faster_whisper_engine.pywith 17 unit tests.tests/test_suspend_handler.pyfixture for the new_faster_whisper_engineattribute.How to try it
pip install "vocalinux[faster_whisper]" python -m vocalinux.main --engine faster_whisper --model tinyVerification
pytest tests/test_faster_whisper_engine.py— 17/17 passed.make lint(black, isort, flake8) passed via pre-commit hooks.