You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR fixes a bug related to saving model parameters under dygraph mode by ensuring that the save hook runs in the correct context, and updates related error messages and tests.
Added a new simple model and corresponding tests for the save dtype functionality.
Wrapped the save hook in a dygraph guard in the auto_cast module.
Updated error messaging in the data feeder to better reflect the dygraph mode requirements.
Reviewed Changes
File
Description
test/legacy_test/test_jit_save_load.py
Added tests for the new save_dtype functionality and model decoration.
python/paddle/amp/auto_cast.py
Wrapped save hook call with a dygraph guard to ensure proper context.
python/paddle/base/data_feeder.py
Updated the error message to refer to dygraph mode and corrected terminology.
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
python/paddle/amp/auto_cast.py:738
[nitpick] Consider adding a comment explaining the purpose of using the dygraph guard with Tracer(), to clarify its necessity and ensure maintainability.
with paddle.base.framework._dygraph_guard(paddle.base.dygraph.Tracer()):
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Execute Infrastructure
PR Types
Bug fixes
Description
Fixes #71356,确保 save hook 在动态图执行
PCard-66972