Models quick import - #164
Conversation
Summary of ChangesHello @vfdev-5, 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 usability and consistency of the 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
|
69f03fb to
c83b7e0
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces a simplified API for importing models by exposing them and their configurations in the bonsai.models namespace. It also standardizes the configuration class name to ModelConfig across various models. The changes are mostly a large-scale refactoring, which appears to be correctly implemented. My review includes a critical fix for an incorrect refactoring in a test file that could lead to failures, and a medium-severity suggestion to improve code style and maintainability in the new __init__.py file.
Quicker model import The idea is to simplify the model import and expose models inside `bonsai.__init__`: Today’s API: ``python import flax.nnx as nnx from bonsai.models.convnext.modeling import ConvNeXt, ModelConfig cfg = ModelConfig.convnext_base_224() model = ConvNeXt(cfg, rngs=nnx.Rngs(0)) ``` Suggested API: ```python import flax.nnx as nnx from bonsai import ConvNeXt, ConvNeXtConfig cfg = ConvNeXtConfig.base_224() model = ConvNeXt(cfg, rngs=nnx.Rngs(0)) ``` Additionally, renamed model's configs to ModelConfig, e.g. Mamba2Config -> ModelConfig
c83b7e0 to
ed62c8a
Compare
Quicker model import
The idea is to simplify the model import and expose models inside
bonsai.__init__:Today’s API:
Suggested API:
Additionally, renamed model's configs to ModelConfig, e.g.
Mamba2Config -> ModelConfig
Checklist
run_model.pyfor model usage,test_outputs.pyand/ormodel_validation_colab.ipynbfor quality).