Skip to content
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

Add clip_extra and change use_combine name #44008

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions python/paddle/fluid/dygraph/jit.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ def keep_name_table(self, value):


def _parse_save_configs(configs):
supported_configs = ['output_spec', "with_hook", "use_combine"]
supported_configs = [
'output_spec', "with_hook", "combine_params", "clip_extra"
]

# input check
for key in configs:
Expand All @@ -392,7 +394,8 @@ def _parse_save_configs(configs):
inner_config = _SaveLoadConfig()
inner_config.output_spec = configs.get('output_spec', None)
inner_config.with_hook = configs.get('with_hook', False)
inner_config.combine_params = configs.get("use_combine", False)
inner_config.combine_params = configs.get("combine_params", False)
inner_config.clip_extra = configs.get("clip_extra", False)

return inner_config

Expand Down Expand Up @@ -1015,7 +1018,7 @@ def fun(inputs):
params_filename=params_filename,
export_for_deployment=configs._export_for_deployment,
program_only=configs._program_only,
clip_extra=False)
clip_extra=configs.clip_extra)

# collect all vars
for var in concrete_program.main_program.list_vars():
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/fluid/tests/unittests/test_jit_save_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def test_save_load_finetune_load(self):
with unique_name.guard():
net = Net()
#save
paddle.jit.save(net, model_path, use_combine=True)
paddle.jit.save(net, model_path, combine_params=True)


class LayerLoadFinetune(paddle.nn.Layer):
Expand Down