verl icon indicating copy to clipboard operation
verl copied to clipboard

Engine worker: bshd cp PR lead a conflict when NPU remove padding=Fasle

Open ZLiao097 opened this issue 8 months ago • 2 comments

System Info

AssertionError: output.shape: torch.Size([1, 268]), attention_mask.shape: torch.Size([1, 1, 268, 268])

Information

  • [ ] The official example scripts
  • [x] My own modified scripts

Tasks

  • [ ] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

conflict PR: #5826 and #5768

PR-5768 change the NPU attention mask shape from (b,s) to (b,1,s,s) by preprocess_bshd method, but PR-5826 add an assert to make sure output.shape[:2] match attention mask shape, that break NPU code in bshd.

Furthermore, due to the input requirements of NPU Flash Attention, the attention mask in the NPU preprocessing is processed into a lower triangular matrix combining the padding mask and causal mask. However, the attention mask was reconstructed in the CP adaptation part, which makes it incompatible with the NPU Flash Attention input format.

Image

BTW, I just found thd branch has the same problem😭.

Expected behavior

  • [ ] I will submit a follow‑up PR to fix this issue.

ZLiao097 avatar Apr 03 '26 08:04 ZLiao097

BTW, I just found that thd branch has same problem, I'm afraid no one get there by NPU ever.🤣

ZLiao097 avatar Apr 03 '26 09:04 ZLiao097

I also had this problem.

ruanhao566 avatar Apr 03 '26 09:04 ruanhao566