PaddleSeg icon indicating copy to clipboard operation
PaddleSeg copied to clipboard

[General Issue] The number of model parameters and computation

Open fanxiaochen456 opened this issue 2 years ago • 5 comments

求教,我想像pytorch一样加载Paddle2.0训练好的模型参数model.pdparams,运用Summary函数可以输出参与训练的参数量和总的模型参数量,请问该怎么写呢? The number of parameters involved in the training and the total number of parameters in the model can be displayed by using the Summary function.

import paddle save_path = "model.pdiparams" model = paddle.load(save_path)

This is the quantized model. Pdiparams. I want to output the number of parameters and computations output by him to predict a picture, that is, to perform a model inference operation, so as to select the development board with the appropriate computation power.

fanxiaochen456 avatar Jun 16 '22 05:06 fanxiaochen456

具体使用可以参考https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/summary_cn.html#summary

haoyuying avatar Jun 16 '22 06:06 haoyuying

@haoyuying 您好,我就是参考的那个文档来改写代码,但加载模型时就不对了,这是我量化之后的输出,请问我该怎么加载model.pdiparams文件呢,然后像文档里那样运用summary输出参数量呢?

这是量化之后的输出 image

fanxiaochen456 avatar Jun 16 '22 09:06 fanxiaochen456

@haoyuying 这是paddle2.0环境下量化的模型

fanxiaochen456 avatar Jun 16 '22 09:06 fanxiaochen456

pdmodel和pdiparams是静态图模型和参数,用paddle.jit.load()或者paddle inference进行加载,静态图参数量输出没找到相应的API,可以去paddle的repo下提问以便获取更精确的回复。

haoyuying avatar Jun 17 '22 02:06 haoyuying

@haoyuying 请问paddle的repo是什么

fanxiaochen456 avatar Jun 17 '22 04:06 fanxiaochen456

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 09 '22 17:12 github-actions[bot]