Conversation
Summary of ChangesHello @susanbao, 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 enhances the model generation and sharding utilities. It introduces support for complex model architectures that utilize interleaved layers, ensuring that parameters are correctly processed during tree intersection. Additionally, it improves compatibility with JAX's sharding mechanisms by explicitly recognizing 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 support for loading models with inhomogeneous scanned layers and updates the JAX resharding utility. The new layer mapping logic in tunix/generate/utils.py seems correct for its purpose.
However, I've found a high-severity maintainability issue in tunix/rl/reshard.py. The code now imports GSPMDSharding from a private jax._src module, which is an unstable API that could break in future JAX updates. I've provided a suggestion to use the public jax.sharding.Sharding base class instead, which is a more robust and future-proof solution.
| if isinstance( | ||
| x, jax.sharding.NamedSharding | jax.sharding.SingleDeviceSharding | ||
| x, jax.sharding.NamedSharding | jax.sharding.SingleDeviceSharding | GSPMDSharding | ||
| ): |
There was a problem hiding this comment.
Using GSPMDSharding requires importing from a private JAX _src module (line 31), which is risky as these internal APIs can change without warning. This violates the maintainability principle from the style guide (line 12).
A more robust and future-proof approach is to check against the public abstract base class jax.sharding.Sharding. This will cover all sharding types (NamedSharding, SingleDeviceSharding, GSPMDSharding, etc.) and allows you to remove the import from jax._src.sharding_impls.
if isinstance(x, jax.sharding.Sharding):References
- The style guide states that code should be maintainable and easy to modify and extend. Relying on private, unstable APIs from dependencies makes the code harder to maintain as it can break with dependency updates. (link)
Resolves #<issue_number_goes_here>
Reference
Colab Notebook
Checklist