-
Notifications
You must be signed in to change notification settings - Fork 584
refactor(pd): replace build_strategy with backend option in to_static API
#4664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(pd): replace build_strategy with backend option in to_static API
#4664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the API call in the training module to replace the deprecated build_strategy option with the backend option, aligning with PaddlePaddle 3.0 recommendations.
- Removed instantiation of static.BuildStrategy and the use of build_cinn_pass
- Introduced conditional assignment of the backend parameter when calling jit.to_static
Comments suppressed due to low confidence (1)
deepmd/pd/train/training.py:642
- Ensure that passing None as the backend parameter correctly disables the CINN compilation, as intended in the new design.
backend = "CINN" if CINN else None
📝 WalkthroughWalkthroughThe update simplifies the configuration of the JIT compilation backend within the Changes
Sequence Diagram(s)sequenceDiagram
participant T as Trainer.run
participant B as Backend Decision
participant J as jit.to_static
participant W as Wrapper.forward
T->>B: Check if CINN flag is enabled
B-->>T: Return backend ("CINN" or None)
T->>J: Call jit.to_static(wrapper.forward, backend)
J->>W: Invoke wrapped forward method
W-->>J: Return execution result
J-->>T: Return wrapped outcome
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code Definitions (1)deepmd/pd/train/training.py (5)
🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
build_strategy with backend option in to_static APIbuild_strategy with backend option in to_static API
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #4664 +/- ##
==========================================
- Coverage 84.81% 84.81% -0.01%
==========================================
Files 692 692
Lines 66361 66360 -1
Branches 3539 3539
==========================================
- Hits 56282 56281 -1
+ Misses 8938 8937 -1
- Partials 1141 1142 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@HydrogenSulfate could you take a review? |
|
LGTM |
…tatic` API (#4664) In PaddlePaddle 3.0, we recommend to use `backend` option to instead of `build_strategy.build_cinn_pass` to enable our compiler `CINN`. cc @HydrogenSulfate <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Streamlined the internal process for selecting the backend during training, reducing complexity while retaining functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
In PaddlePaddle 3.0, we recommend to use
backendoption to instead ofbuild_strategy.build_cinn_passto enable our compilerCINN.cc @HydrogenSulfate
Summary by CodeRabbit