[Fix] Reject LoRA adapters on non-PyTorch backend - #4819
Open
zcxGGmu wants to merge 1 commit into
Open
Conversation
Signed-off-by: zq <zhouquan1511@163.com>
lvhan028
reviewed
Aug 4, 2026
| @@ -0,0 +1,30 @@ | |||
| # Copyright (c) OpenMMLab. All rights reserved. | |||
Collaborator
There was a problem hiding this comment.
These UT additions don't add much value. Please remove it.
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.
Motivation
When
lmdeploy serve api_serverresolves to the TurboMind backend,--adaptersis currently accepted but not applied because LoRA adapters are PyTorch-backend only. This can make the server start successfully while adapter model names are unavailable, which matches the confusion reported in #3594.Refs #3594
Modification
serve api_server: if adapters are provided after backend resolution and the selected backend is notpytorch, raise a clearValueErrorasking the user to set--backend pytorch.BC-breaking (Optional)
No supported behavior is removed. Invalid
--adapters+ non-PyTorch backend combinations now fail early with an explicit message instead of being silently ignored.Use cases (Optional)
Users serving LoRA adapters should launch with
--backend pytorch, for example:Checklist
python -m pre_commit run --files lmdeploy/cli/serve.py tests/test_lmdeploy/cli/test_serve.pypython -m pytest tests/test_lmdeploy/cli/test_serve.py tests/test_lmdeploy/serve/test_generation_config.py -q