fix: optimize punctuation model loading performance
Overview
This merge request addresses the delay and inaccurate loading behavior observed during the first-time initialization of the punctuation model. The previous implementation displayed inconsistent loading progress due to missing Content-Length headers from ONNX model downloads and allowed the loading indicator to complete before the model was fully initialized.
The changes introduced in this MR improve the overall loading workflow, provide more reliable progress handling, and enhance the user experience during model initialization.
Problem Statement
- Punctuation model loading was taking longer than expected during the initial application startup.
- Loading progress values were inaccurate because the download response did not include
Content-Lengthheaders. - The UI occasionally displayed
100%completion before the model was fully ready for inference. - Users experienced confusion due to inconsistent loading states and delayed model readiness.
Changes Implemented
- Refactored punctuation model loading workflow for better initialization handling
- Improved synchronization between model download and model readiness states
- Added fallback handling for downloads without
Content-Lengthheaders - Prevented premature completion of loading progress
- Improved loader state management and initialization feedback
- Reduced unnecessary UI blocking during model setup
- Enhanced reliability of ONNX model initialization flow
Screenshots
Technical Improvements
- Updated loading state logic to reflect actual initialization progress
- Improved worker communication during model loading
- Added safer handling for streaming model downloads
- Optimized initialization sequence for punctuation inference setup
Expected Outcome
- Faster and smoother punctuation model initialization
- More accurate and reliable loading indicators
- Improved first-time user experience
- Reduced confusion caused by incorrect progress updates
- Better stability during ONNX model download and initialization flow
closes #35 (closed)
