-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Support external custom models #13429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support external custom models #13429
Conversation
Summary of ChangesHello @zhooooong, 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 significantly enhances the SGLang framework by enabling the seamless integration of external custom models. It addresses a critical limitation where custom model registrations were not correctly propagated across processes, particularly to the scheduler. By introducing dedicated environment variables and modifying the model and processor registration mechanisms, users can now easily define and load their own models and multimodal processors, expanding the framework's extensibility and adaptability to diverse model architectures. Highlights
Using Gemini Code AssistThe 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
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 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
|
768094d to
5473e68
Compare
There was a problem hiding this 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 robust mechanism for integrating external custom models and multimodal processors into the SGLang framework. By leveraging new environment variables (SGLANG_EXTERNAL_MODEL_PACKAGE, SGLANG_EXTERNAL_MM_MODEL_ARCH, SGLANG_EXTERNAL_MM_PROCESSOR_PACKAGE), users can now dynamically register their custom implementations. The import_processors and ModelRegistry.register functions have been enhanced with an overwrite flag, ensuring that external definitions can seamlessly replace or extend existing ones. The accompanying unit tests (test/srt/external_models/custom_qwen2_vl.py and test/srt/test_external_models.py) effectively demonstrate the end-to-end functionality, confirming that the custom models and processors are correctly loaded and utilized. This is a well-designed and valuable addition for extending the framework's capabilities.
zhaochenyang20
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
zhaochenyang20
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@Kangyan-Zhou kangyan could you help to merge? |
Motivation
I tried this way to import external custom model:
Unfortunately, the
schedulerprocess cannot retrieve the registration information from the original process, so I added some environment variables to fix the problem.Modifications
Three new environment variables:
SGLANG_EXTERNAL_MODEL_PACKAGE: the package name of the external modelSGLANG_EXTERNAL_MM_MODEL_ARCH: used for multimodal modelSGLANG_EXTERNAL_MM_PROCESSOR_PACKAGE: processor's package name for multimodal modelAccuracy Tests
Benchmarking and Profiling
Checklist