Skip to content

[Fix] Add validation for served model name to reserve : for LoRA adapter syntax#12912

Merged
Fridge003 merged 3 commits intosgl-project:mainfrom
neelabhsinha:fix_served_model_lora
Nov 10, 2025
Merged

[Fix] Add validation for served model name to reserve : for LoRA adapter syntax#12912
Fridge003 merged 3 commits intosgl-project:mainfrom
neelabhsinha:fix_served_model_lora

Conversation

@neelabhsinha
Copy link
Copy Markdown
Contributor

Motivation

Fixes #12745

The --served-model-name argument currently allows colon (:) characters, which conflicts with the model:adapter syntax used for LoRA adapter specification in OpenAI-compatible APIs. When a served model name contains a colon,
it gets incorrectly parsed as if it includes a LoRA adapter name, causing confusion and unexpected behavior.

This PR adds validation to prevent colons in --served-model-name, ensuring clear separation between the served model name and the LoRA adapter syntax.

Modifications

  1. Added validation in server_args.py (line 3718-3725):
    - Added assertion in check_server_args() method to raise an AssertionError if served_model_name contains a colon
    - Provides a clear error message explaining why colons are not allowed and shows the invalid value
  2. Added unit tests in test_server_args.py (line 9-27):
    - test_served_model_name_with_colon_raises_error: Verifies that a colon in the served model name raises the expected error with appropriate message
    - test_served_model_name_without_colon_succeeds: Ensures that valid model names (without colons) work correctly

Accuracy Tests

Not applicable - this is a validation change that prevents invalid configurations. It does not affect model outputs or inference behavior.

Benchmarking and Profiling

Not applicable - this is a validation check that runs only during server initialization. No impact on inference speed.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @neelabhsinha, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a crucial validation step for the served_model_name parameter, ensuring that it does not contain a colon. This change resolves a potential conflict with the model:adapter syntax used for LoRA adapters in OpenAI-compatible APIs, preventing incorrect parsing and unexpected behavior. The implementation includes the validation logic within the server arguments and comprehensive unit tests to confirm its functionality.

Highlights

  • Validation for served model name: Added a validation check to prevent the --served-model-name argument from containing a colon (:), as this character is reserved for the model:adapter syntax used in LoRA adapter specifications.
  • Error Handling: An AssertionError is now raised with a clear error message if a colon is detected in the served_model_name, guiding users on the correct format.
  • Unit Tests: New unit tests have been introduced to verify that the validation correctly raises an error for invalid model names and successfully processes valid ones.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a validation to prevent the use of colons in served_model_name, which is a good fix to avoid conflicts with LoRA adapter syntax. The implementation is correct and the error message is clear. The addition of unit tests is also appreciated. However, the new tests do not correctly exercise the validation logic as they don't call the method where the validation is implemented. I've provided suggestions to fix the tests to ensure the new logic is properly covered.

Comment thread test/srt/test_server_args.py Outdated
Comment thread test/srt/test_server_args.py Outdated
@Fridge003 Fridge003 self-assigned this Nov 9, 2025
Comment thread test/srt/test_server_args.py Outdated
@Fridge003 Fridge003 merged commit 7bffc5d into sgl-project:main Nov 10, 2025
44 of 49 checks passed
ocss884 pushed a commit to ocss884/sglang that referenced this pull request Nov 10, 2025
…apter syntax (sgl-project#12912)

Co-authored-by: neelabhsinha <neelabhsinha97@gmail.com>
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.

[Bug] The following requested LoRA adapters are not loaded: 120b

2 participants