[Iluvatar] Fix cannot import name mtp_save_first_token#7495
Open
wuyujiji wants to merge 1 commit intoPaddlePaddle:developfrom
Open
[Iluvatar] Fix cannot import name mtp_save_first_token#7495wuyujiji wants to merge 1 commit intoPaddlePaddle:developfrom
wuyujiji wants to merge 1 commit intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review |
2026-04-20 10:28 CST
📋 Review 摘要
PR 概述:修复非 GPU 硬件平台导入 GPU-only MTP 算子导致的 ImportError
变更范围:model_executor/pre_and_post_process.py 导入重组
影响面 Tag:Iluvatar OP
问题
未发现阻塞性问题。
总体评价
变更逻辑正确。mtp_save_first_token 和 mtp_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 中使用,不会影响其他平台。
Contributor
Author
|
/re-run all-failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
该pr导入了mtp_save_first_token和mtp_save_first_token_with_topk两个gpu算子,其他硬件执行到这里会报错,所以需要移到gpu分支里
Modifications
Pass
Usage or Command
Pass>
Accuracy Tests
Pass
Checklist
[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]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.