Re-export get_sequence_parallel_rank and get_sp_group from xfuser utils#1521
Re-export get_sequence_parallel_rank and get_sp_group from xfuser utils#1521HaozheZhang6 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the __init__.py file in diffsynth/utils/xfuser to import get_sequence_parallel_rank and get_sp_group from .xdit_context_parallel. The reviewer recommended wrapping the extremely long import statement in parentheses to comply with PEP 8 line length guidelines and improve code readability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| @@ -1 +1 @@ | |||
| from .xdit_context_parallel import usp_attn_forward, usp_dit_forward, usp_vace_forward, get_sequence_parallel_world_size, initialize_usp, get_current_chunk, gather_all_chunks | |||
| from .xdit_context_parallel import usp_attn_forward, usp_dit_forward, usp_vace_forward, get_sequence_parallel_world_size, get_sequence_parallel_rank, get_sp_group, initialize_usp, get_current_chunk, gather_all_chunks | |||
There was a problem hiding this comment.
The import line is extremely long (over 210 characters), which violates PEP 8 recommendations (maximum line length of 79 characters) and makes the code harder to read and maintain. Wrapping the imported names in parentheses allows them to be cleanly formatted across multiple lines.
| from .xdit_context_parallel import usp_attn_forward, usp_dit_forward, usp_vace_forward, get_sequence_parallel_world_size, get_sequence_parallel_rank, get_sp_group, initialize_usp, get_current_chunk, gather_all_chunks | |
| from .xdit_context_parallel import ( | |
| usp_attn_forward, | |
| usp_dit_forward, | |
| usp_vace_forward, | |
| get_sequence_parallel_world_size, | |
| get_sequence_parallel_rank, | |
| get_sp_group, | |
| initialize_usp, | |
| get_current_chunk, | |
| gather_all_chunks, | |
| ) |
References
- PEP 8 recommends limiting all lines to a maximum of 79 characters and using parentheses for multi-line imports. (link)
Fixes #1520.
diffsynth/utils/xfuser/__init__.pyre-exportsget_sequence_parallel_world_sizebut not the two companion APIsget_sequence_parallel_rankandget_sp_group, even though all three are imported together fromxfuser.core.distributedinxdit_context_parallel.pyand used throughout it. This adds the two missing names to the re-export so they can be imported fromdiffsynth.utils.xfuserthe same way as their sibling.