fix: preserve LoRA adapter across requests in OpenAI responses endpoint#920
Closed
JasonOA888 wants to merge 1 commit into
Closed
fix: preserve LoRA adapter across requests in OpenAI responses endpoint#920JasonOA888 wants to merge 1 commit into
JasonOA888 wants to merge 1 commit into
Conversation
The responses endpoint called get_cached_model() without passing adapter_path, causing the cache key to mismatch and the adapter to be dropped after the first request. Now tracks the server's adapter_path and passes it to all cache lookups. Closes Blaizzy#907
Collaborator
|
Thanks! This is fixed for you original case, and we're covering the newer endpoints here: #1251 |
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.
Problem
When starting
mlx_vlm serverwith--adapter-path, the adapter loads correctly on startup but gets dropped after the first request. The OpenAI-compatible/v1/responsesendpoint callsget_cached_model(model)without passingadapter_path, so the cache key becomes(model, None)instead of(model, adapter_path). This triggers a cache mismatch, unloads the adapted model, and reloads the base model.Fix
server_adapter_pathmodule-level variable to track the adapter path set at startupserver_adapter_pathtoget_cached_model()in both the lifespan preload and the responses endpointTesting
--adapter-path ./my-adapter/v1/responses/healthendpointCloses #907