Repository navigation
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @lbh2001, 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 aims to resolve a reported bug where the gathered_buffer could unexpectedly become None following a two-batch overlap filter. The change modifies a boolean condition to ensure the correct code path is executed, thereby preventing the None state and addressing the underlying issue that caused the problem for the author.
Highlights
- Bug Fix: Corrected a conditional logic error within the
filter_batchfunction intwo_batch_overlap.pyto properly handle scenarios wherebatch.gathered_buffermight beNoneafter a filter operation, especially whenglobal_server_args_dict["moe_dense_tp_size"]is 1.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and 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 to provide feedback.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
The pull request modifies a conditional from and to or to address an issue with gathered_buffer becoming None. However, this change introduces a critical bug that can cause a crash due to a potential AttributeError. The provided code suggestion includes a null check to avoid this error.
| global_server_args_dict["moe_dense_tp_size"] == 1 | ||
| and batch.gathered_buffer is not None | ||
| or batch.gathered_buffer is not None |
There was a problem hiding this comment.
Changing and to or can lead to an AttributeError if batch.gathered_buffer is None. Accessing batch.gathered_buffer.shape[1] in this case will cause a crash.
if global_server_args_dict["moe_dense_tp_size"] == 1 or batch.gathered_buffer is not None:
sum_len = end_token_index - start_token_index
if batch.gathered_buffer is not None:
hidden_size = batch.gathered_buffer.shape[1]
dtype = batch.gathered_buffer.dtype
device = batch.gathered_buffer.device
else:
hidden_size = batch.token_to_kv_pool.hidden_size
dtype = batch.token_to_kv_pool.dtype
device = batch.input_ids.device
gathered_buffer = torch.zeros(
(sum_len, hidden_size),
dtype=dtype,
device=device,
)
else:
gathered_buffer = None|
Hi @lbh2001 , could you share the launching command you use? |
Hi @Qiaolin-Yu My environment and launch script was record in #7602. Before I change the |
Hi @lbh2001 , I think currently TBO assumes you have the config of |
@Qiaolin-Yu Thanks for your reply. def _scattered_to_tp_attn_full(
hidden_states: torch.Tensor,
forward_batch: ForwardBatch,
context: CommunicateContext,
) -> torch.Tensor:
hidden_states, local_hidden_states = (
forward_batch.gathered_buffer[: forward_batch.input_ids.shape[0]],
hidden_states,
)
attn_tp_all_gather(
list(hidden_states.tensor_split(context.attn_tp_size)),
local_hidden_states,
)
return hidden_statesIn fact, the reason was |
@lbh2001 So your issue seems not related to #7511? And yes, try to pass |
|
Hi @lbh2001 , I think it's normal, since TBO assumes you have set |
Motivation
fix #7511, which was fixed by #7531 but not worked for me
Modifications
Checklist