Skip to content

[CI][BugFix] Adapt test_token_penalty to Paddle uniform float16 behavior change#8031

Merged
EmmonsCurse merged 1 commit into
PaddlePaddle:developfrom
EmmonsCurse:adapt_pr_79130
Jun 10, 2026
Merged

[CI][BugFix] Adapt test_token_penalty to Paddle uniform float16 behavior change#8031
EmmonsCurse merged 1 commit into
PaddlePaddle:developfrom
EmmonsCurse:adapt_pr_79130

Conversation

@EmmonsCurse

Copy link
Copy Markdown
Collaborator

Motivation

tests/operators/test_token_penalty.py fails after changes introduced in Paddle PR #79130, which modified UniformKernel behavior for float16 precision.

Previously, paddle.rand in float16 could produce values extremely close to 1.0 due to casting from float32. The test assumptions were based on this behavior.

After the fix in Paddle:

  • When a sampled value equals max (1.0) after float16 cast,
  • It is now clamped back to min (0.0) to strictly enforce the half-open interval [0, 1).

As a result, under fixed seed 2023, some logits that were previously non-zero now become 0.0.
This breaks the test assertion logic, which did not account for valid zero-valued logits.

Modifications

  • Updated tests/operators/test_token_penalty.py to adapt to new float16 uniform sampling behavior.
  • Adjusted assertion logic to handle cases where logits can be exactly 0.0.
  • Ensured compatibility with Paddle PR #79130 behavior change in UniformKernel.
  • Preserved test correctness under revised random number distribution semantics.

Usage or Command

N/A

Accuracy Tests

N/A

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@EmmonsCurse

Copy link
Copy Markdown
Collaborator Author

/skip-ci ci_iluvatar
/skip-ci ci_hpu
/skip-ci build_xpu
/skip-ci pre_ce_test
/skip-ci stable_test
/skip-ci base_test
/skip-ci logprob_test
/skip-ci gpu_4cards_test

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@bbe5f81). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #8031   +/-   ##
==========================================
  Coverage           ?   77.78%           
==========================================
  Files              ?      404           
  Lines              ?    57430           
  Branches           ?     9032           
==========================================
  Hits               ?    44674           
  Misses             ?     9907           
  Partials           ?     2849           
Flag Coverage Δ
GPU 77.78% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@EmmonsCurse
EmmonsCurse merged commit 1eed8ba into PaddlePaddle:develop Jun 10, 2026
42 checks passed
@EmmonsCurse
EmmonsCurse deleted the adapt_pr_79130 branch June 10, 2026 06:37
@paddle-bot

paddle-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

Thanks for your contribution!

@paddle-bot paddle-bot Bot added the contributor External developers label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants