Skip to content

[BugFix] Fix import compatibility for paddlefleet.ops and paddlefleet_ops#7873

Merged
zoooo0820 merged 1 commit into
PaddlePaddle:developfrom
liuruyan:dev_fleet_fix_bug
May 21, 2026
Merged

[BugFix] Fix import compatibility for paddlefleet.ops and paddlefleet_ops#7873
zoooo0820 merged 1 commit into
PaddlePaddle:developfrom
liuruyan:dev_fleet_fix_bug

Conversation

@liuruyan
Copy link
Copy Markdown
Contributor

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

Modifications

Usage or Command

Accuracy Tests

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.

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.

🤖 Paddle-CI-Agent | pr_review | 2026-05-21 12:01:24

📋 Review 摘要

PR 概述:修复 paddlefleet 包路径变更导致的 deep_epdeep_gemm 导入兼容性问题,新增对 paddlefleet.ops 新路径的支持,同时保留对旧路径 paddlefleet_ops 的回退
变更范围model_executor/layers/moe/ep.pymodel_executor/layers/quantization/fp8_utils.py
影响面 Tag[OP] [Quantization]

问题

级别 文件 概述
🟡 建议 ep.py:48 except: 应改为 except ImportError:,避免误吞关键异常
🟡 建议 fp8_utils.py:50 except: 应改为 except ImportError:,避免误吞关键异常
📝 PR 规范 标题缺少官方 [Tag],PR 描述各段均为占位符未填写

📝 PR 规范检查

标题无官方 [Tag];PR 描述中 Motivation / Modifications / Usage or Command / Accuracy Tests 各段内容均为空/占位符,Checklist 条目全部未勾选。

标题建议(可直接复制):

  • [BugFix] Fix import compatibility for paddlefleet.ops and paddlefleet_ops

PR 描述建议(可直接复制,必须复刻 checklist §D2 模板的完整结构):

## Motivation
修复 `paddlefleet` 包路径变更导致的兼容性问题:新版 `paddlefleet` 将 ops 子模块路径从 `paddlefleet_ops.deep_ep`/`paddlefleet_ops.deep_gemm` 迁移至 `paddlefleet.ops.deep_ep`/`paddlefleet.ops.deep_gemm`,旧路径导致 ImportError。本 PR 在 `ep.py``fp8_utils.py` 中同时兼容两种路径,优先尝试新路径,失败时回退到旧路径。

## Modifications
- `fastdeploy/model_executor/layers/moe/ep.py`:移除模块级 `try_import(["paddlefleet.ops"])` 调用;在 `load_deep_ep()` 内新增内层 try/except,优先 `import paddlefleet.ops.deep_ep`,回退 `import paddlefleet_ops.deep_ep`
- `fastdeploy/model_executor/layers/quantization/fp8_utils.py`:更新模块级 `try_import` 同时检测 `paddlefleet.ops``paddlefleet_ops`;在 `load_deep_gemm()` 内新增内层 try/except,优先 `import paddlefleet.ops.deep_gemm`,回退 `import paddlefleet_ops.deep_gemm`

## Usage or Command
N/A

## Accuracy Tests
N/A

## Checklist

- [x] 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.

总体评价

兼容性修复逻辑清晰,能正确处理包路径迁移场景。建议将两处裸 except: 改为 except ImportError: 以避免误吞 KeyboardInterrupt 等关键异常;PR 标题和描述规范需同步补充。

import paddlefleet_ops.deep_ep as deep_ep # type: ignore
try:
import paddlefleet.ops.deep_ep as deep_ep # type: ignore
except:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 建议except: 捕获范围过宽

当前 except: 会捕获所有异常(包括 KeyboardInterruptSystemExit),若 paddlefleet.ops 已安装但因非导入原因(如内部初始化错误)抛出非 ImportError 异常,将被静默吞掉并错误地回退到旧路径,导致难以排查的问题。

建议修复方式:

try:
    import paddlefleet.ops.deep_ep as deep_ep  # type: ignore
except ImportError:
    import paddlefleet_ops.deep_ep as deep_ep  # type: ignore

import paddlefleet_ops.deep_gemm as deep_gemm
try:
import paddlefleet.ops.deep_gemm as deep_gemm
except:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 建议except: 捕获范围过宽

ep.py 问题:当前 except: 捕获所有异常,若 paddlefleet.ops 包存在但初始化时抛出非 ImportError 异常,将被静默吞掉并错误回退。

建议修复方式:

try:
    import paddlefleet.ops.deep_gemm as deep_gemm
except ImportError:
    import paddlefleet_ops.deep_gemm as deep_gemm

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 21, 2026

Codecov Report

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

Files with missing lines Patch % Lines
fastdeploy/model_executor/layers/moe/ep.py 0.00% 4 Missing ⚠️
...oy/model_executor/layers/quantization/fp8_utils.py 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #7873   +/-   ##
==========================================
  Coverage           ?   63.58%           
==========================================
  Files              ?      462           
  Lines              ?    64490           
  Branches           ?     9887           
==========================================
  Hits               ?    41006           
  Misses             ?    20705           
  Partials           ?     2779           
Flag Coverage Δ
GPU 72.71% <11.11%> (?)
XPU 7.11% <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.

Copy link
Copy Markdown
Collaborator

@EmmonsCurse EmmonsCurse left a comment

Choose a reason for hiding this comment

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

LGTM~ Skip coverage check as it mainly relies on tests with paddlefleet.

@EmmonsCurse EmmonsCurse changed the title Fix ce bug becauseof paddlefleet_ops [BugFix] Fix import compatibility for paddlefleet.ops and paddlefleet_ops May 21, 2026
@zoooo0820 zoooo0820 merged commit 4402396 into PaddlePaddle:develop May 21, 2026
56 of 61 checks passed
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.

5 participants