未验证 提交 185b3c96 编写于 作者: W whs 提交者: GitHub

Fix saving API when filename is not endswith 'pdmodel' (#1239)

上级 e3a06180
...@@ -816,8 +816,14 @@ class AutoCompression: ...@@ -816,8 +816,14 @@ class AutoCompression:
for name in test_program_info.feed_target_names for name in test_program_info.feed_target_names
] ]
model_name = '.'.join(self.model_filename.split( model_name = None
'.')[:-1]) if self.model_filename is not None else 'model' if self.model_filename is None:
model_name = "model"
elif self.model_filename.endswith(".pdmodel"):
model_name = self.model_filename.rsplit(".", 1)[0]
else:
model_name = self.model_filename
path_prefix = os.path.join(model_dir, model_name) path_prefix = os.path.join(model_dir, model_name)
paddle.static.save_inference_model( paddle.static.save_inference_model(
path_prefix=path_prefix, path_prefix=path_prefix,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册