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

【PPSCI Export&Infer No.21】tempoGAN #884

Merged
merged 5 commits into from
May 11, 2024

Conversation

smallpoxscattered
Copy link
Contributor

PR types

Others

PR changes

Others

Describe

Copy link

paddle-bot bot commented May 8, 2024

Thanks for your contribution!


# load pretrained model
solver = ppsci.solver.Solver(
model=model_gen, pretrained_model_path=cfg.INFER.pretrained_model_path
Copy link
Contributor

Choose a reason for hiding this comment

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

现在的pretrained模型保存的时候保存的是ModelList,因此尽管推理时只用到Generator,在加载模型时也需要加载整个ModelList,否则parmeters的变量名会与pretrained模型中不同,进而导致实际上没有正确加载到参数
因此,参考evaluate,在export中增加:

# define model_list
model_list = ppsci.arch.ModelList((model_gen,))

并将这一行中的model_gen改成model_list

solver = ppsci.solver.Solver(
        model=model_list, pretrained_model_path=cfg.INFER.pretrained_model_path
    )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

你好,我也是尝试过的,但还是一样的报错

Copy link
Contributor

Choose a reason for hiding this comment

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

报的这个错吗:
W0510 12:21:04.746564 15157 op_compat_sensible_pass.cc:232] Check the Attr(axis) of Op(elementwise_add) in pass(conv_eltwiseadd_bn_fuse_pass) failed!
W0510 12:21:04.746583 15157 conv_bn_fuse_pass.cc:632] Pass in op compat failed.
从output中infer生成的图片来看,改之前是这样:
image
改之后就正常了:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的好的 我还以为 还可以把 solver.export(input_spec, cfg.INFER.export_path, skip_prune_program=True) 中的 skip_prune_program删掉,我确实没试过,跳过剪枝后,用model_list,谢谢 辛苦了,是我疏忽了

Copy link
Collaborator

Choose a reason for hiding this comment

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

好的好的 我还以为 还可以把 solver.export(input_spec, cfg.INFER.export_path, skip_prune_program=True) 中的 skip_prune_program删掉,我确实没试过,跳过剪枝后,用model_list,谢谢 辛苦了,是我疏忽了

这个是模型导出的一个选项,个别案例如 viv,需要加这个。

Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

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

LGTM

@HydrogenSulfate HydrogenSulfate merged commit c08f928 into PaddlePaddle:develop May 11, 2024
3 of 4 checks passed
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
* add tempoGAN export&infer

* fix tempoGAN.md

* fix tempoGAN.md

* fix tempoGAN.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants