Skip to content

[XPU] Fix PaddleFormers fallback model issues - #8116

Open
mayang002 wants to merge 2 commits into
PaddlePaddle:developfrom
mayang002:xpu-paddleformers-fallback-pr
Open

[XPU] Fix PaddleFormers fallback model issues#8116
mayang002 wants to merge 2 commits into
PaddlePaddle:developfrom
mayang002:xpu-paddleformers-fallback-pr

Conversation

@mayang002

Copy link
Copy Markdown
Contributor

Description

This PR fixes three issues hit when using the PaddleFormers fallback path on XPU:

  • Fix TypeError when calling the PaddleFormers fallback model (fastdeploy/model_executor/models/paddleformers/__init__.py)
  • Do not rotate twice when the model already applied RoPE (XPU attention backend)
  • Fix position_ids for the adjust_batch token layout (paddleformers/base.py)

Testing

  • Added unit tests in tests/model_executor/test_paddleformers_base.py covering the adjust_batch position_ids layout
  • Verified generation correctness on XPU hardware with Llama models

- Fix TypeError when calling the PaddleFormers fallback model
- Do not rotate twice when the model already applied RoPE
- Fix position_ids for the adjust_batch token layout
- Move _get_identity_rotary_embs to the AttentionBackend base class with
  layout-adaptive indexing (fixes the multimodal [batch, 2, ...] layout)
- Replace the inline identity RoPE block in XPUAttentionBackend with the
  base class method; drop the duplicated copies in append_attn_backend
  and decode_unified_attention_backend
- Add None guards for optional LOD fields in _build_position_ids_from_lods
- Add docstrings to the new test methods
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