Skip to content

[BugFix] Fix platform-specific attribute access in reset_model_inputs#6614

Open
kevincheng2 wants to merge 1 commit intoPaddlePaddle:developfrom
kevincheng2:fix_reset_model_inputs_platform_check
Open

[BugFix] Fix platform-specific attribute access in reset_model_inputs#6614
kevincheng2 wants to merge 1 commit intoPaddlePaddle:developfrom
kevincheng2:fix_reset_model_inputs_platform_check

Conversation

@kevincheng2
Copy link
Collaborator

Motivation

修复 ProposerInputBatch.reset_model_inputs 方法中的平台属性访问错误。

在 CUDA 平台上,代码错误地尝试访问 output_cum_offsetsoutput_padding_offset 属性,但这些属性仅在非 CUDA 平台上初始化,导致错误:

Resetting model inputs failed, skipping reset, error message is "'output cum offsets' is not a valid attribute of InputBatch"

Modifications

  • output_cum_offsetsoutput_padding_offset 的重置代码移到 else 分支(非 CUDA 平台)
  • if current_platform.is_cuda() 分支中添加 cu_seqlens_q_outputbatch_id_per_token_output 的重置代码

这与初始化逻辑(第 285-298 行)保持一致,确保不同平台访问正确的属性。

Usage or Command

无需额外命令,修复后代码会根据平台自动选择正确的属性进行重置。

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [BugFix]
  • 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.

@paddle-bot
Copy link

paddle-bot bot commented Mar 2, 2026

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Mar 2, 2026

CLA assistant check
All committers have signed the CLA.

@kevincheng2 kevincheng2 force-pushed the fix_reset_model_inputs_platform_check branch from 9dbef4f to 40525af Compare March 2, 2026 13:37
修复 `ProposerInputBatch.reset_model_inputs` 方法中的平台属性访问错误。
在 CUDA 平台上,代码错误地尝试访问 `output_cum_offsets` 和 `output_padding_offset` 属性,
但这些属性仅在非 CUDA 平台上初始化,导致错误:
"'output cum offsets' is not a valid attribute of InputBatch"

- 将 `output_cum_offsets` 和 `output_padding_offset` 的重置代码移到 `else` 分支(非 CUDA 平台)
- 在 `if current_platform.is_cuda()` 分支中添加 `cu_seqlens_q_output` 和 `batch_id_per_token_output` 的重置代码

这与初始化逻辑(第 285-298 行)保持一致,确保不同平台访问正确的属性。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kevincheng2 kevincheng2 force-pushed the fix_reset_model_inputs_platform_check branch from 40525af to 6fb8161 Compare March 2, 2026 13:49
@codecov-commenter
Copy link

Codecov Report

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

Files with missing lines Patch % Lines
fastdeploy/worker/input_batch.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #6614   +/-   ##
==========================================
  Coverage           ?   71.64%           
==========================================
  Files              ?      394           
  Lines              ?    53754           
  Branches           ?     8437           
==========================================
  Hits               ?    38511           
  Misses             ?    12473           
  Partials           ?     2770           
Flag Coverage Δ
GPU 71.64% <0.00%> (?)

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

☔ 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants