Skip to content

Dcu: format code#588

Merged
gushiqiao merged 3 commits intoModelTC:mainfrom
fuheaven:dcu
Dec 9, 2025
Merged

Dcu: format code#588
gushiqiao merged 3 commits intoModelTC:mainfrom
fuheaven:dcu

Conversation

@fuheaven
Copy link
Contributor

@fuheaven fuheaven commented Dec 9, 2025

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fuheaven, 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 focuses on enhancing code consistency and readability across several Python files related to DCU (AMD GPU) device handling and Flash Attention implementation. The changes primarily involve adjusting whitespace by removing extraneous blank lines and consolidating a multi-line function call into a single line, aligning the codebase with better formatting practices.

Highlights

  • Code Formatting: Standardized code formatting by removing unnecessary blank lines within docstrings and at the end of methods, and reformatting a multi-line function call for improved readability.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request focuses on code formatting. While most changes involve removing whitespace, which is generally fine, there are a couple of areas that could be improved.

  • In lightx2v_platform/ops/attn/dcu/flash_attn.py, a multi-line function call has been collapsed into a single line that is excessively long, harming readability. I've suggested restoring the multi-line format.
  • In lightx2v_platform/ops/attn/dcu/__init__.py, the trailing newline has been removed, which goes against the PEP 8 style guide.

Please see the specific comments for details.

@@ -1,2 +1 @@
from .flash_attn import *
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change removes the trailing newline from the file. The PEP 8 style guide recommends that all source files end with a single newline character (see warning W292). Please add a newline at the end of the file to adhere to this convention.

out = torch.nn.functional.scaled_dot_product_attention(
q, k, v, attn_mask=None, is_causal=causal, dropout_p=dropout_p
)
out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=None, is_causal=causal, dropout_p=dropout_p)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line is excessively long (over 130 characters), which significantly harms code readability and maintainability. The PEP 8 style guide recommends limiting line length (typically to 79 or 99 characters). Please reformat this call to span multiple lines, similar to how it was before this change.

Suggested change
out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=None, is_causal=causal, dropout_p=dropout_p)
out = torch.nn.functional.scaled_dot_product_attention(
q, k, v, attn_mask=None, is_causal=causal, dropout_p=dropout_p
)

@gushiqiao gushiqiao merged commit 22484a2 into ModelTC:main Dec 9, 2025
1 check passed
helloyongyang pushed a commit that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants