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

[Feat] Support saving and loading models in different formats #3758

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Bobholamovic
Copy link
Member

PR types

New features

PR changes

APIs

Description

适应Paddle 3.0不同格式的静态图模型。

TODO:

  • 更新使用文档。

Copy link

paddle-bot bot commented Jul 24, 2024

Thanks for your contribution!

@@ -1 +1 @@
README_CN.md
README_CN.md
Copy link
Member Author

Choose a reason for hiding this comment

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

顺带修复bug,与PR主题无关。

docs/install.md Outdated
@@ -8,20 +8,20 @@ English | [简体中文](install_cn.md)
- pip/pip3(9.0.1+),64-bit version
- CUDA >= 10.2
- cuDNN >= 7.6
- PaddlePaddle (the version >= 2.4)
- PaddlePaddle (the version >= 3.0.0b0)
Copy link
Member Author

Choose a reason for hiding this comment

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

仿照PaddleNLP,接口变更后不再支持旧版本Paddle。

@@ -203,7 +203,7 @@ def forward_tokens(self, x):
def forward(self, x):
x = self.patch_embed(x)
x = self.forward_tokens(x)
if self.mode is not 'multi_scale':
if self.mode != 'multi_scale':
Copy link
Member Author

Choose a reason for hiding this comment

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

顺带修复bug,与PR主题无关。

Copy link

@xiaoguoguo626807 xiaoguoguo626807 left a comment

Choose a reason for hiding this comment

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

LGTM for predictor config init

help="The deploy config generated by exporting model.",
type=str,
required=True)
parser.add_argument("--config",
Copy link
Member Author

Choose a reason for hiding this comment

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

formatter自动更新,与主题无关。

@@ -62,7 +61,10 @@ def collect_dynamic_shape(args):

# prepare config
cfg = DeployConfig(args.config)
pred_cfg = PredictConfig(cfg.model, cfg.params)
if paddle.__version__.split('.')[0] == '2':
Copy link
Member Author

Choose a reason for hiding this comment

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

兼容paddle 2.x


@property
def transforms(self):
return self._transforms

@property
def model(self):
return os.path.join(self._dir, self.dic['Deploy']['model'])
if self._is_old_format:
Copy link
Member Author

Choose a reason for hiding this comment

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

兼容旧版本导出模型格式。

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.

2 participants