Skip to content

Fix dl notification when generating from already cached model#25

Merged
jamiepine merged 8 commits intomainfrom
fix-dl-notification-when-generating-from-already-cached-model
Jan 31, 2026
Merged

Fix dl notification when generating from already cached model#25
jamiepine merged 8 commits intomainfrom
fix-dl-notification-when-generating-from-already-cached-model

Conversation

@jamiepine
Copy link
Owner

@jamiepine jamiepine commented Jan 31, 2026

Note

Medium Risk
Touches model loading and progress/task tracking paths for both TTS and STT backends; incorrect cache detection or filtering could suppress real download progress or leave tasks untracked.

Overview
Prevents misleading "model downloading" UX when running generation against already-cached HuggingFace models.

Both pytorch_backend.py and mlx_backend.py now detect whether the target TTS/Whisper model exists in the local HF cache and, if so, skip creating download tasks and skip emitting initial/complete download progress events; when not cached, behavior remains the same.

HFProgressTracker gained an optional filter_non_downloads mode to ignore non-download tqdm progress bars (e.g., internal generation "Segment 1/1"), and a set of manual debug scripts were added under backend/tests/ to validate SSE progress behavior and inspect progress/task state.

Written by Cursor Bugbot for commit 0b17073. Configure here.

- Introduced methods to check if models are cached locally in MLX and PyTorch backends.
- Enhanced progress tracking during model loading to filter out non-download progress when models are cached.
- Updated HFProgressTracker to conditionally report progress based on download status.
- Added test scripts for monitoring SSE events during model downloads and verifying progress tracking functionality.
- Improved overall error handling and logging for better debugging during model download processes.
- Introduced a new directory for manual test scripts aimed at debugging and validating backend functionality.
- Added README.md detailing the purpose and usage of various test scripts, including tests for TTS generation, model downloads, and progress tracking.
- Included an __init__.py file to define the test suite structure and provide context for the tests.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

if not is_cached:
progress_manager.mark_complete(model_name)
task_manager.complete_download(model_name)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error handlers unconditionally track errors for untracked downloads

Medium Severity

The exception handlers call mark_error and error_download unconditionally, even when the model was cached and download tracking was never started. When is_cached is True, start_download and update_progress are skipped, but on error, mark_error still creates a new error entry in progress_manager and notifies SSE listeners. This creates inconsistent state between progress_manager (has error) and task_manager (no record). The error handling paths need the same if not is_cached conditional check that was added to the success path.

Additional Locations (2)

Fix in Cursor Fix in Web

from huggingface_hub import constants as hf_constants
model_path = self._get_model_path(model_size)
repo_cache = Path(hf_constants.HF_HUB_CACHE) / ("models--" + model_path.replace("/", "--"))
return repo_cache.exists()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache check doesn't verify model files exist inside directory

Medium Severity

The _is_model_cached methods only check if the cache directory exists via repo_cache.exists(), but don't verify that model files are actually present inside. This differs from the more robust check already in main.py which uses rglob to confirm files like *.safetensors or *.bin exist. If a download was interrupted, the directory may exist but be empty or incomplete. With the current check, is_cached returns True, causing filter_non_downloads=True, which suppresses download progress notifications even though a real download is occurring.

Additional Locations (1)

Fix in Cursor Fix in Web

jamiepine and others added 6 commits January 30, 2026 18:02
- Bumped version numbers for @voicebox/app, @voicebox/landing, @voicebox/tauri, and @voicebox/web to 0.1.11.
- Added a new `useAutoUpdater` hook to check for app updates on startup and notify users with toast messages.
- Enhanced `UpdateStatus` component to handle version retrieval errors more gracefully.
- Updated dependencies in `package.json` for Tauri plugins to support new update functionalities.
- Added a step to install PyTorch with CUDA for Windows in the release workflow.
- Updated model references in backend/main.py to use openai/whisper models instead of mlx-community for the MLX backend.
- Rearranged imports for consistency across components.
- Enhanced the ModelManagement component to include detailed logging for download actions and errors.
- Updated the ModelProgress component to connect to SSE only when actively downloading, preventing connection exhaustion.
- Added a downloading state to the model status to indicate ongoing downloads.
- Improved toast notifications for model downloads with completion and error callbacks.
- Refactored the useModelDownloadToast hook to support new callbacks for download completion and error handling.
- Updated backend model status to reflect downloading state during active downloads.
- Rearranged imports for consistency in useModelDownloadToast hook.
- Improved logging in useModelDownloadToast for better debugging during download events.
- Updated progress calculation to handle cases where progress exceeds 100%.
- Enhanced toast notifications to reflect download completion and error states.
- Introduced throttling in ProgressManager to optimize SSE updates and prevent overwhelming clients.
- Added new test scripts for monitoring SSE events during model downloads, ensuring accurate progress reporting.
- Updated caching methods in MLX, PyTorch, and backend to ensure models are fully downloaded before being marked as cached.
- Improved progress tracking to filter out non-download progress and provide accurate feedback during model downloads.
- Enhanced HFProgressTracker to skip non-byte progress bars and ensure meaningful progress reporting.
- Refactored progress initialization to provide immediate feedback while fetching metadata from HuggingFace.
- Added error handling and logging for better debugging during cache checks and download processes.
Enhance model caching checks and progress tracking for downloads
@jamiepine jamiepine merged commit 97eb570 into main Jan 31, 2026
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.

1 participant