Skip to content

[Cherry-Pick][Others] support arm env#8084

Open
BingooYang wants to merge 2 commits into
PaddlePaddle:release/2.6from
BingooYang:support_gb
Open

[Cherry-Pick][Others] support arm env#8084
BingooYang wants to merge 2 commits into
PaddlePaddle:release/2.6from
BingooYang:support_gb

Conversation

@BingooYang

Copy link
Copy Markdown
Contributor

Motivation

支持arm环境

Modifications

替换没有arm版本包的软件

  1. 使用paddlecodec替换decord,并使用paddlecodec进行适配
  2. 使用fast_dataindex替换tool_helpers
  3. 添加测试

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.

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Copy link
Copy Markdown

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-06-29 11:59:41 Asia/Shanghai

📋 Review 摘要

PR 概述:将多模态视频读取从 decord 迁移到 paddlecodec,以支持 ARM 环境。
变更范围fastdeploy/input/ 视频工具、Ernie/Qwen/PaddleOCR VL 处理器及相关单测。
影响面 Tag[DataProcessor]

问题

级别 文件 概述
🔴 兼容性 fastdeploy/input/video_utils.py:33 共享视频工具删除 read_video_decord 导出,release 升级会破坏旧 import
🔴 兼容性 fastdeploy/input/ernie4_5_vl_processor/__init__.py:19 Ernie VL 包级导出删除旧视频读取符号,旧调用路径会 ImportError
🔴 Bug fastdeploy/input/video_utils.py:108 sys.modules["torchcodec"] 置为 None 会污染全局模块缓存
🔴 Bug fastdeploy/input/ernie4_5_vl_processor/utils/video_utils.py:89 Ernie 专用 wrapper 存在同样的 torchcodec 模块缓存污染

📝 PR 规范检查

不完全符合。目标分支是 release/2.6,标题 [Cherry-Pick][Others] support arm env 未按 checklist §D1 补充 (#原PR号),且实际影响面更贴近 [DataProcessor];PR 描述中的 Usage or CommandAccuracy Tests 章节为空。当前上下文未提供 develop 原 PR 号,因此不生成可直接复制的完整标题,避免误填。

PR 描述建议(点击展开,可直接复制)
## Motivation
支持 ARM 环境,替换没有 ARM 版本包的软件,并将视频读取链路从 decord 适配到 paddlecodec。

## Modifications
1. 将 Ernie/Qwen/Qwen3/PaddleOCR VL 处理器的视频读取入口切换为 paddlecodec wrapper。
2. 使用 paddlecodec/torchcodec VideoDecoder 适配原有 `asnumpy()` 帧读取接口,并保留 GIF 转 MP4 支持。
3. 添加和更新 `tests/input/` 下的视频工具、抽帧逻辑和 VL processor 单元测试。

## Usage or Command
N/A

## Accuracy Tests
N/A(本 PR 仅替换视频读取依赖和数据处理适配,不涉及模型计算精度变更。)

## 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.
- [x] Format your code, run `pre-commit` before commit.
- [x] Add unit tests. Please write the reason in this PR if no unit tests.
- [x] 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.

总体评价

核心迁移方向合理,新增测试覆盖了 wrapper 的主要分支;但当前改动会破坏旧导入路径,并且 decoder 初始化会留下全局模块缓存副作用,建议修复后再合入 release 分支。

__all__ = [
"VideoReaderWrapper",
"read_video_decord",
"read_video_paddlecodec",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 兼容性 这里把共享视频工具导出的 read_video_decord 直接替换成 read_video_paddlecodec,会破坏已有用户代码里的 from fastdeploy.input.video_utils import read_video_decord

本 PR 是 cherry-pick 到 release/2.6 的变更,替换底层 decoder 不需要删除旧 Python API。建议保留兼容别名并继续导出旧名,例如在 read_video_paddlecodec 定义后增加 read_video_decord = read_video_paddlecodec,同时把 read_video_decord 留在 __all__

from .ernie4_5_vl_processor import Ernie4_5_VLProcessor
from .process import DataProcessor, fancy_print
from .process_video import read_video_decord
from .process_video import read_video_paddlecodec

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 兼容性 Ernie VL 包级导出也删除了旧的 read_video_decord 名称,升级后依赖该导入路径的代码会直接 ImportError

建议在 process_video.py 中保留 read_video_decord = read_video_paddlecodecread_frames_decord = read_frames_paddlecodec 兼容别名,并在这里继续导出旧名;新代码可以使用 read_video_paddlecodec,但 release 分支不要让旧 import 失效。


from torchcodec.decoders import VideoDecoder

sys.modules["torchcodec"] = None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Bug 成功导入 VideoDecoder 后把 sys.modules["torchcodec"] 设为 None 会污染整个进程的模块缓存。

一旦某个请求初始化过视频 decoder,后续同进程里的 import torchcodec 会命中这个 None sentinel 并失败,影响其他依赖或后续代码路径。建议不要写入 None;如需清理 Paddle 兼容层注入的代理模块,应记录进入前的原值并在 finallypop 或恢复原模块对象。


from torchcodec.decoders import VideoDecoder

sys.modules["torchcodec"] = None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Bug 这里同样把全局 sys.modules["torchcodec"] 改成了 None,会让同一 Python 进程后续的普通 import torchcodec 失败。

建议与共享 video_utils.py 一样改成无副作用的导入:不修改 sys.modules,或只在确认模块是本次兼容层临时注入时用 pop 清理;如果进入前已有真实 torchcodec 模块,必须恢复原值。

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.06173% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/2.6@82c7c7a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...y/input/ernie4_5_vl_processor/utils/video_utils.py 94.73% 2 Missing ⚠️
fastdeploy/input/qwen3_vl_processor/process.py 50.00% 1 Missing ⚠️
fastdeploy/input/qwen_vl_processor/process.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##             release/2.6    #8084   +/-   ##
==============================================
  Coverage               ?   71.71%           
==============================================
  Files                  ?      386           
  Lines                  ?    55835           
  Branches               ?     8768           
==============================================
  Hits                   ?    40042           
  Misses                 ?    12978           
  Partials               ?     2815           
Flag Coverage Δ
GPU 71.71% <95.06%> (?)

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.

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