-
Notifications
You must be signed in to change notification settings - Fork 526
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
Feat: output logs on freezing models #4165
Conversation
📝 WalkthroughWalkthroughThe pull request introduces a new log statement in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FreezeFunction
participant Logger
User->>FreezeFunction: Call freeze()
FreezeFunction->>FreezeFunction: Save model
FreezeFunction->>Logger: Log "Saved frozen model to {FLAGS.output}"
Logger-->>FreezeFunction: Confirmation logged
FreezeFunction-->>User: Model frozen successfully
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 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 (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
deepmd/pt/entrypoints/main.py (1)
357-357
: LGTM! Consider adding error handling.The added log statement effectively fulfills the PR objective by outputting the path where the frozen model is saved. This enhances the user experience by providing clear feedback on the operation's success.
Consider wrapping the model saving operation in a try-except block to handle potential I/O errors and provide more informative error messages. For example:
try: torch.jit.save( model, FLAGS.output, extra_files, ) log.info(f"Saved frozen model to {FLAGS.output}") except IOError as e: log.error(f"Failed to save frozen model to {FLAGS.output}: {str(e)}") raiseThis enhancement would provide more detailed information if the save operation fails, aiding in troubleshooting.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #4165 +/- ##
==========================================
- Coverage 83.45% 83.45% -0.01%
==========================================
Files 537 537
Lines 52146 52147 +1
Branches 3046 3046
==========================================
Hits 43521 43521
Misses 7677 7677
- Partials 948 949 +1 ☔ View full report in Codecov by Sentry. |
dp --pt freeze
does not output whether the operation finishes successfully. This PR adds a log message on it.