feat: support Muse-Glimmer in TurboMind - #4848
Draft
lvhan028 wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds end-to-end Muse-Glimmer (30B) support across LMDeploy’s TurboMind backend, including new model builders, runtime/kernel extensions for the native vision path, and OpenAI-serving response parsing.
Changes:
- Add Muse-Glimmer TurboMind model integration (text + native vision) plus BF16-only enforcement in conversion.
- Extend QwenViT runtime/kernels for Muse-Glimmer-specific behaviors (zero-padded pos-embed interpolation, configurable vision RoPE, pixel shuffle, extra projection/norm path).
- Add Muse-Glimmer ATEM response parser, documentation updates, and new unit / kernel tests.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_lmdeploy/turbomind/test_muse_glimmer_model.py | Unit tests for Muse-Glimmer TurboMind model configs/registration. |
| tests/test_lmdeploy/serve/parsers/test_muse_glimmer_parser.py | Unit tests for Muse-Glimmer ATEM response parsing (complete + streaming). |
| src/turbomind/models/qwenvit/test_muse_glimmer_kernels.cu | CUDA test binary covering Muse-Glimmer-specific vision kernels. |
| src/turbomind/models/qwenvit/qwenvit.cc | QwenViT runtime updates for Muse-Glimmer (merge sizing, pos-embed weights dtype, RoPE params, pixel shuffle, extra norms/projection). |
| src/turbomind/models/qwenvit/qwenvit_weight.h | Add Muse-Glimmer vision config/weights fields (merge sizing, RoPE knobs, shuffle, extra layers). |
| src/turbomind/models/qwenvit/qwenvit_weight.cc | Verify required extra vision weights when Muse-Glimmer pixel-shuffle path is enabled. |
| src/turbomind/models/qwenvit/qwenvit_kernels.h | Kernel API extensions (zero-padded pos-embed, fp32 weights, RoPE knobs, pixel shuffle). |
| src/turbomind/models/qwenvit/qwenvit_kernels.cu | Implement extended kernels: zero-padded interpolation, fp32 weights support, RoPE knobs, pixel shuffle. |
| src/turbomind/models/model_weight.h | Add output logit transform params + optional embedding RMSNorm weight. |
| src/turbomind/models/model_weight.cc | Wire new ModelWeightConfig fields into ModelWeight construction. |
| src/turbomind/models/llama/unified_decoder.h | Track output norm eps and whether post-norm weights exist. |
| src/turbomind/models/llama/unified_decoder.cc | Support optional post-attention/post-FFN norm flow with consistency checks. |
| src/turbomind/models/language_model.cc | Apply optional embedding RMSNorm; apply logit scale/softcap to logits. |
| src/turbomind/models/decoder_layer_weight.h | Add optional post-attention and post-FFN norm weight slots. |
| src/turbomind/models/CMakeLists.txt | Build a Muse-Glimmer kernel test executable under BUILD_TEST. |
| src/turbomind/kernels/activation.h | Declare logit scaling + softcap kernel entrypoint. |
| src/turbomind/kernels/activation.cu | Implement logit scaling + tanh softcap kernel. |
| README.md | Add Muse-Glimmer to the supported model list. |
| lmdeploy/vl/model/muse_glimmer.py | Add Muse-Glimmer VL frontend model wrapper (processor + model load). |
| lmdeploy/vl/model/builder.py | Register Muse-Glimmer VL model in builder imports. |
| lmdeploy/turbomind/text_model.py | Allow overriding norm epsilon when building TurboMind norms. |
| lmdeploy/turbomind/supported_models.py | Map MuseGlimmer architecture name to turbomind key. |
| lmdeploy/turbomind/models/qwen3_5.py | Add padded head-dim mapping for Muse-Glimmer ViT head dim. |
| lmdeploy/turbomind/models/muse_glimmer.py | Implement Muse-Glimmer TurboMind exporters/builders (text + vision). |
| lmdeploy/turbomind/models/init.py | Export Muse-Glimmer TurboMind model classes. |
| lmdeploy/turbomind/converter.py | Enforce Muse-Glimmer constraints (HF-only, BF16-only). |
| lmdeploy/serve/parsers/muse_glimmer_response_parser.py | Add Muse-Glimmer ATEM response parser with streaming support. |
| lmdeploy/serve/parsers/init.py | Export MuseGlimmerResponseParser. |
| lmdeploy/serve/openai/api_server.py | Auto-select Muse-Glimmer response parser based on architecture. |
| lmdeploy/archs.py | Treat MuseGlimmerForConditionalGeneration as a VL architecture. |
| docs/zh_cn/supported_models/supported_models.md | Document Muse-Glimmer TurboMind support + BF16-only note (ZH). |
| docs/zh_cn/multi_modal/multimodal_inputs.md | Mention Muse-Glimmer in native video/image+video support notes (ZH). |
| docs/en/supported_models/supported_models.md | Document Muse-Glimmer TurboMind support + BF16-only note (EN). |
| docs/en/multi_modal/multimodal_inputs.md | Mention Muse-Glimmer in native video/image+video support notes (EN). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+199
to
203
| const auto& [t, h, w] = grid_thw; | ||
| const int prod = t * h * w; | ||
| const int output_merge = OutputMergeSize(); | ||
| image_embeds_offsets += prod / output_merge / output_merge; | ||
| } |
Comment on lines
+39
to
+43
| def build_model(self, trust_remote_code: bool = False): | ||
| check_transformers() | ||
| from transformers import MuseGlimmerForConditionalGeneration | ||
| self.vl_model = MuseGlimmerForConditionalGeneration.from_pretrained( | ||
| self.model_path, device_map='cpu') |
Comment on lines
+27
to
+34
| template<class T> | ||
| T* copy_to_device(const std::vector<T>& host) | ||
| { | ||
| T* device{}; | ||
| cudaMalloc(&device, host.size() * sizeof(T)); | ||
| cudaMemcpy(device, host.data(), host.size() * sizeof(T), cudaMemcpyHostToDevice); | ||
| return device; | ||
| } |
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.
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
Please describe the motivation of this PR and the goal you want to achieve through this PR.
Modification
Please briefly describe what modification is made in this PR.
BC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
Checklist