Skip to content

Update set_dict method name & add aliases#26700

Merged
chenwhql merged 15 commits intoPaddlePaddle:developfrom
chenwhql:saveload/update_api_names
Sep 3, 2020
Merged

Update set_dict method name & add aliases#26700
chenwhql merged 15 commits intoPaddlePaddle:developfrom
chenwhql:saveload/update_api_names

Conversation

@chenwhql
Copy link
Contributor

@chenwhql chenwhql commented Aug 26, 2020

PR types

Function optimization

PR changes

APIs

Describe

【兼容升级】Refine set_dict related APIs:

  1. Change set_dict method name to set_state_dict, add alias for compatibility
  • Layer.set_dict -> Layer.set_state_dict
  • DataParallel.set_dict -> DataParallel.set_state_dict
  • Optimizer.set_dict -> Optimizer.set_state_dict
  • LearningRateDecay.set_dict -> LearningRateDecay.set_state_dict
  • _LRScheduler.set_dict -> _LRScheduler.set_state_dict
  1. change stat_dict argument to state_dict, which is typo in old implementations, add decorator deprecate_stat_dict for compatibility
  • Layer.set_dict(stat_dict) -> Layer.set_dict(state_dict)
  • DataParallel.set_dict(stat_dict) -> DataParallel.set_dict(state_dict)
  • Optimzier.load(stat_dict) -> Optimzier.load(state_dict)
  1. remove Layer's load_dict, which is a deprecated API, add alias for compatibility

related cn doc PR: PaddlePaddle/docs#2535

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

XiaoguangHu01
XiaoguangHu01 previously approved these changes Sep 3, 2020
Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@saxon-zh saxon-zh left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@chenwhql chenwhql merged commit 9cb57f9 into PaddlePaddle:develop Sep 3, 2020
chenwhql added a commit to chenwhql/Paddle that referenced this pull request Sep 7, 2020
* update set_dict method name & add aliases

* fix var name error

* fix alias formats

* use set_state_dict in unittest

* add decorator solve compatible problem

* polish decorator

* replace layer set_state_dict by patched method

* remove import monkey path layer

* fix import function error

* add unittest for coverage
chenwhql added a commit that referenced this pull request Sep 8, 2020
* Update set_dict method name & add aliases (#26700)

* update set_dict method name & add aliases

* fix var name error

* fix alias formats

* use set_state_dict in unittest

* add decorator solve compatible problem

* polish decorator

* replace layer set_state_dict by patched method

* remove import monkey path layer

* fix import function error

* add unittest for coverage

* Support load state dict form `inference model` format save result (#26718)

* support load infer model format state dict

* add unittests

* remove keep name table

* recolve circle inport

* fix compatible problem

* recover unittest

* polish doc and comment

* Change jit.save/load configs to config & update code examples (#27056)

* change configs to config & update examples

* fix deprecate decorator conflict
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