Conversation
Summary of ChangesHello, 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 the Qwen2.5-VL encoder, a foundational component for processing text within the Qwen-Image multimodal pipelines. The implementation prioritizes smooth integration into the existing module-v2 framework, ensuring compatibility with Buffer-based interfaces. This work establishes the necessary text encoding infrastructure, paving the way for future enhancements to Qwen-Image capabilities. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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
|
There was a problem hiding this comment.
Code Review
This pull request adds the Qwen2.5-VL encoder. The implementation is well-structured, but I have identified two potential high-severity issues that could affect model correctness. One concern is the reuse of a weight name mapping from Llama3 for the Qwen model, which might lead to incorrect weight loading. The second issue is a potential misconfiguration of the RotaryEmbedding layer's dim parameter, which could cause incorrect calculations in the attention mechanism. I've provided specific feedback and suggestions for these points.
| from max.nn.embedding import Embedding | ||
| from max.nn.layer import Module | ||
| from max.pipelines.architectures.llama3.weight_adapters import ( | ||
| LLAMA_SAFETENSOR_MAPPING as QWEN_SAFETENSOR_MAP, |
There was a problem hiding this comment.
Reusing LLAMA_SAFETENSOR_MAPPING for a Qwen model is risky. While there might be similarities in layer naming, differences between model architectures could lead to incorrect weight loading or hard-to-debug errors. For clarity and safety, it's better to define a specific QWEN_SAFETENSOR_MAP for this architecture. If the mapping is indeed identical, adding a comment to clarify this would be beneficial for future maintenance.
| device = config.device | ||
|
|
||
| self.rope = RotaryEmbedding( | ||
| dim=config.hidden_size, |
There was a problem hiding this comment.
The RotaryEmbedding is initialized with dim=config.hidden_size. However, it's applied to query and key tensors that have been reshaped to (..., num_heads, head_dim). The dim parameter for RotaryEmbedding should typically match the feature dimension it operates on, which is head_dim in this case. Using hidden_size is likely incorrect and could lead to shape mismatches or incorrect application of rotary embeddings during attention computation.
| dim=config.hidden_size, | |
| dim=config.head_dim, |
e6b389e to
88b352b
Compare
88b352b to
6eb37d4
Compare
Summary
Buffer-based interfacesTesting
./bazelw run format./bazelw run lintChecklist