Skip to content

[Iluvatar] Fix cannot import name mtp_save_first_token#7495

Open
wuyujiji wants to merge 1 commit intoPaddlePaddle:developfrom
wuyujiji:yuzhe_dev
Open

[Iluvatar] Fix cannot import name mtp_save_first_token#7495
wuyujiji wants to merge 1 commit intoPaddlePaddle:developfrom
wuyujiji:yuzhe_dev

Conversation

@wuyujiji
Copy link
Copy Markdown
Contributor

@wuyujiji wuyujiji commented Apr 20, 2026

Motivation

pr导入了mtp_save_first_token和mtp_save_first_token_with_topk两个gpu算子,其他硬件执行到这里会报错,所以需要移到gpu分支里

Modifications

Pass

Usage or Command

Pass>

Accuracy Tests

Pass

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.

@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Apr 20, 2026

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Apr 20, 2026
Copy link
Copy Markdown

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Code Review | 2026-04-20 10:28 CST

📋 Review 摘要

PR 概述:修复非 GPU 硬件平台导入 GPU-only MTP 算子导致的 ImportError
变更范围model_executor/pre_and_post_process.py 导入重组
影响面 TagIluvatar OP

问题

未发现阻塞性问题。

总体评价

变更逻辑正确。mtp_save_first_tokenmtp_save_first_token_with_topk 是 GPU 专用算子(定义在 custom_ops/gpu_ops/),原先在文件顶部无条件从 ops.gpu 导入会导致 Iluvatar、GCU 等非 NVIDIA 平台报错。本 PR 将其移至 else(即 NVIDIA GPU)条件分支中,与其他 GPU-only 算子的导入方式保持一致。调用点 save_output_specualate 函数仅在 gpu_model_runner.py 中使用,不会影响其他平台。

@wuyujiji
Copy link
Copy Markdown
Contributor Author

/re-run all-failed

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.

2 participants