[Build] deduplicate data_feed Python proto generation#78718
[Build] deduplicate data_feed Python proto generation#78718SigureMo merged 1 commit intoPaddlePaddle:developfrom
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
There was a problem hiding this comment.
Pull request overview
This PR removes duplicate Python protobuf generation rules for data_feed.proto so data_feed_pb2.py is generated by a single CMake target, and updates TrainerDesc to import trainer_desc_pb2 via an in-package relative import to make the Python proto import path more deterministic.
Changes:
- Deduplicate Python proto generation by removing
data_feed.protofrom thetrainer_py_protoCMake target inputs. - Replace the
sys.path-based protobuf import workaround inpython/paddle/base/trainer_desc.pywithfrom .proto import trainer_desc_pb2.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/paddle/base/trainer_desc.py | Switches trainer_desc_pb2 import to a package-relative import and removes sys.path manipulation. |
| paddle/fluid/framework/CMakeLists.txt | Ensures data_feed.proto is only included once in Python proto generation targets (via framework_py_proto). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #78718 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 1
Lines ? 1
Branches ? 0
===========================================
Hits ? 1
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if(WITH_PYTHON) | ||
| py_proto_compile(framework_py_proto SRCS framework.proto data_feed.proto) | ||
| py_proto_compile(trainer_py_proto SRCS trainer_desc.proto data_feed.proto) | ||
| py_proto_compile(trainer_py_proto SRCS trainer_desc.proto) |
There was a problem hiding this comment.
对比修改前后生成的 trainer_desc_pb2.py,一致吗?
There was a problem hiding this comment.
PR Category
Execute Infrastructure
PR Types
Others
Description
😺 在 #78713 的
coverage test流水线的单测test_deprecated_decorator和test_trainer_desc一直挂,顾让 codex 来帮忙分析一下,由于没有实际环境和产物并没有分析出合理原因,后来重跑coverage clone通过,但是 codex 对代码提出了修改建议,觉得有道理就提交上来了🤖 本 PR 去掉了
data_feed.proto在 Python proto 构建中的重复声明,让data_feed_pb2.py只由一个 CMake target 生成(😺py_proto_compile的 SRCS 之后的参数,是根据xxx.proto生成xxx_pb2.py文件);同时将python/paddle/base/trainer_desc.py中的trainer_desc_pb2导入改为包内导入,简化 Python 侧 proto 加载路径。验证
prek./.venv/bin/python -m py_compile python/paddle/base/trainer_desc.py是否引起精度变化
否