Skip to content

Conversation

@w-yyh
Copy link
Contributor

@w-yyh w-yyh commented Nov 19, 2025

Centralized Highly Common Logic: The following logic, which was duplicated across multiple model subclasses, has been moved into the universal update_model_kwargs_for_generation function:

position_ids update: Logic to increment and append the next position ID for self-attention models.

4D attention_mask support: Extended attention_mask handling to correctly update 4-dimensional masks during generation (in addition to the existing 2D support).

Delete the redundant code in models.The changes were applied only to pure text models, with the exception of Llama.

update_model_kwargs_for_generation
@paddle-bot
Copy link

paddle-bot bot commented Nov 19, 2025

Thanks for your contribution!

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@9594389). Learn more about missing BASE report.

Files with missing lines Patch % Lines
paddleformers/generation/utils.py 62.50% 3 Missing ⚠️

❌ Your patch status has failed because the patch coverage (66.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #2972   +/-   ##
==========================================
  Coverage           ?   31.38%           
==========================================
  Files              ?      420           
  Lines              ?    68405           
  Branches           ?        0           
==========================================
  Hits               ?    21469           
  Misses             ?    46936           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants