Skip to content

[training_utils, hardware] fix: unify import statements for attention utilities across test files - #7172

Closed
kahlun wants to merge 1 commit into
verl-project:mainfrom
kahlun:hardware_attention_functional.py
Closed

kahlun wants to merge 1 commit into
verl-project:mainfrom
kahlun:hardware_attention_functional.py

Conversation

@kahlun

@kahlun kahlun commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Would want to unify the one more attention_util file in torch_functional.py
After this [#7098] merged, then this PR should be related to merge in. To resolve the different hardware encounter bug

to tconvert the code of

elif get_device_name() == "XXX": from npu

if get_device_name() == "cuda":
    from flash_attn.bert_padding import index_first_axis, rearrange, unpad_input
elif get_device_name() == "npu":
    from verl.utils.attention_utils import index_first_axis, rearrange, unpad_input


# become for prevent elif == XYZ
->
    from verl.utils.attention_utils import index_first_axis, rearrange, unpad_input

Add concise overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review.

Checklist Before Starting

Test

to run with cuda (a100), xpu (b70) path for the log.

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

example file or trigger path for bug.

# Add code snippet or script demonstrating how to use this
XXX.py ( from gist) through verl training path

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and list the specific changes.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@kahlun

kahlun commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

will close this PR and related issue. due to this PR will resolve the hardware agnostic attention util problem. #7917

@kahlun kahlun closed this Oct 8, 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.

1 participant