fix: fix MockModelRunner in attention tests#18240
fix: fix MockModelRunner in attention tests#18240Kangyan-Zhou merged 1 commit intosgl-project:mainfrom
Conversation
Summary of ChangesHello @zack041, 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 addresses an issue with 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes several issues in test_flashattn_backend.py where mock objects were not being instantiated correctly, by adding () after type(...) calls. It also adds necessary attributes to the mock configurations. However, I've identified that similar instantiation bugs exist in test_flashattn_mla_backend.py which were not addressed in this PR. I've added a comment to point these out. Additionally, I've suggested a more readable way to create these mock objects using types.SimpleNamespace.
| "is_encoder_decoder": False, | ||
| "is_local_attention_model": False, |
There was a problem hiding this comment.
While adding these new fields is correct, there are several related bugs in this file where mock objects are not being instantiated. This is the same issue you fixed in test_flashattn_backend.py.
Specifically:
self.model_configon line 34 is missing().self.server_argson line 46 is missing().self.req_to_token_poolon line 62 is missing().
These should all be instantiated by adding () at the end of the type(...) call to fix the bugs.
Motivation
Fix #18238
Modifications
test_flashattn_backend.py:
kv_cache_dtype,is_hybrid_swa,attention_chunk_sizeto class attributesis_encoder_decoder,is_local_attention_modeltomodel_configtype(...)calls missing()— was creating type objects instead of instancesself.device = self.devicetest_flashattn_mla_backend.py:
is_encoder_decoder,is_local_attention_modeltomodel_configAccuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci