Implement JIT and Auto-unload #97
Draft
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.
Leaving this as draft as it depends on #96. Once #96 Is merged, I will rebase and mark it ready to merge.
This pull request introduces support for just-in-time (JIT) model loading and automatic model unloading after periods of inactivity, enhancing VRAM management and server responsiveness. It refactors the API endpoint logic to be aware of JIT and auto-unload states, improves error handling, and adds stricter type checks for handler selection. Additionally, it updates the CLI and documentation to expose and explain the new features.
JIT Loading & Auto-Unload Support
--jit,--auto-unload-minutes) to enable deferred model initialization and VRAM reclamation when idle./healthendpoint now reports model status as"unloaded"when appropriate. [1] [2] [3] [4]API Endpoint Refactoring
_get_handler_or_errorhelper for consistent handler retrieval and error reporting, making endpoints aware of JIT and auto-unload states. All major endpoints now use this helper for improved reliability. [1] [2] [3] [4] [5] [6] [7] [8]Type Safety & Error Handling
embeddingsandaudio_transcriptionsendpoints, returning clear errors if the wrong model type is used. [1] [2]Streaming Response Improvements
CLI & Documentation Enhancements
UpperChoiceclass for canonical option normalization and updated related CLI help text for clarity. [1] [2]