feat: flexible Whisper installation options for different system configurations (#63)

* fix: VOSK-only install and CLI arg handling for low-memory systems

Fixes several issues reported by users on low-memory systems (8GB RAM):

1. Install script: Don't auto-install Whisper in non-interactive mode
   - Previously, running 'curl | bash' would install Whisper by default
   - Now requires explicit --with-whisper flag to install Whisper
   - Prevents OOM errors on systems with limited RAM

2. CLI arguments: Command-line flags now properly override saved config
   - --engine vosk now works even if config file has whisper set
   - --model flag also properly overrides saved model setting
   - Checks sys.argv to detect if user explicitly provided arguments

3. Default engine: Changed from 'whisper' to 'vosk'
   - VOSK works on low-memory systems without OOM issues
   - Users can still install and use Whisper with --with-whisper flag
   - Existing configs with 'whisper' engine are still respected

Reported issues:
- OOM during installation on 8GB RAM system
- vocalinux --engine vosk being ignored
- Config file not respected when trying to force VOSK

* fix: keep whisper as default engine, improve test robustness

- Reverted default engine back to 'whisper' for better accuracy
- Install script still defaults to VOSK-only install (--with-whisper for Whisper)
- CLI args still properly override saved config
- Improved test_config_manager tests to handle module caching issues

* fix: default to Whisper install, --no-whisper for VOSK-only on low-RAM systems

Updated install behavior:
- Default (curl|bash): Installs Whisper for best experience
- --no-whisper flag: Skips Whisper AND creates config with VOSK as default engine

This allows low-RAM users (8GB) to run:
  curl -fsSL .../install.sh | bash -s -- --no-whisper

Which will:
1. Skip installing torch/whisper (avoids OOM)
2. Create ~/.config/vocalinux/config.json with engine='vosk'
3. App will use VOSK by default without needing CLI flags

* docs: clarify --no-whisper is for low-RAM systems (8GB or less)

Updated README and website to explain that --no-whisper flag:
- Is intended for systems with 8GB RAM or less
- Avoids out-of-memory errors during installation
- Configures VOSK as the default speech recognition engine

* feat: add --whisper-cpu flag for CPU-only PyTorch installation

New installation option for users without NVIDIA GPU or with limited RAM:

Install script changes:
- Added --whisper-cpu flag: Installs CPU-only PyTorch (~200MB vs ~2.3GB)
- Uses https://download.pytorch.org/whl/cpu index for smaller torch package
- Interactive mode now offers 3 options: GPU, CPU-only, or skip Whisper
- Updated help text to explain all Whisper installation options

Documentation updates:
- README: Added --whisper-cpu example with explanation
- Website: Added new 'Whisper CPU-only' install option section

Installation options summary:
- Default (curl|bash): Whisper + GPU/CUDA support (~2.3GB, 5-10 min)
- --whisper-cpu: Whisper + CPU-only PyTorch (~200MB, 3-4 min)
- --no-whisper: VOSK only, no Whisper (~2-3 min)
This commit is contained in:
Jatin K Malik
2026-01-20 19:19:09 -08:00
committed by GitHub
parent d31dab6fd2
commit 7a6d0d4e2b
6 changed files with 288 additions and 140 deletions
+22 -5
View File
@@ -107,15 +107,32 @@ def main():
saved_settings = config_manager.get_settings().get("speech_recognition", {})
audio_settings = config_manager.get_settings().get("audio", {})
# Use saved settings if no command-line override was provided
# Check if args are still at their defaults (user didn't explicitly set them)
engine = saved_settings.get("engine", args.engine)
model_size = saved_settings.get("model_size", args.model)
# CLI arguments take precedence over saved config
# We need to check if the user explicitly provided arguments
# by examining sys.argv since argparse defaults don't tell us this
cli_engine_set = any(arg.startswith("--engine") for arg in sys.argv[1:])
cli_model_set = any(arg.startswith("--model") for arg in sys.argv[1:])
# Use CLI args if explicitly set, otherwise fall back to saved config, then defaults
if cli_engine_set:
engine = args.engine
logger.info(f"Using engine={engine} (from command line)")
else:
engine = saved_settings.get("engine", args.engine)
logger.info(f"Using engine={engine} (from saved config)")
if cli_model_set:
model_size = args.model
logger.info(f"Using model={model_size} (from command line)")
else:
model_size = saved_settings.get("model_size", args.model)
logger.info(f"Using model={model_size} (from saved config)")
vad_sensitivity = saved_settings.get("vad_sensitivity", 3)
silence_timeout = saved_settings.get("silence_timeout", 2.0)
audio_device_index = audio_settings.get("device_index", None)
logger.info(f"Using engine={engine}, model={model_size} (from saved config)")
logger.info(f"Final settings: engine={engine}, model={model_size}")
if audio_device_index is not None:
logger.info(f"Using audio device index={audio_device_index} (from saved config)")
+1 -1
View File
@@ -18,7 +18,7 @@ CONFIG_FILE = os.path.join(CONFIG_DIR, "config.json")
# Default configuration
DEFAULT_CONFIG = {
"speech_recognition": { # Changed section name
"engine": "whisper", # "vosk" or "whisper"
"engine": "whisper", # "vosk" or "whisper" - whisper is default for better accuracy
"model_size": "tiny", # "tiny", "small", "medium", or "large"
"vad_sensitivity": 3, # Voice Activity Detection sensitivity (1-5)
"silence_timeout": 2.0, # Seconds of silence before stopping