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

请问一下模型参数和模型大小的关系 #10021

Closed
shangshanruowo opened this issue May 24, 2023 · 3 comments
Closed

请问一下模型参数和模型大小的关系 #10021

shangshanruowo opened this issue May 24, 2023 · 3 comments
Assignees
Labels

Comments

@shangshanruowo
Copy link

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
  • 运行指令/Command Code:
  • 完整报错/Complete Error Message:

你好,我在评估的时候用paddle.summary打印了一下模型的参数,输入和cfg都对的上,发现det_mv3_db.yml这个打印出来约是6.64MB的参数大小,但保存的时候是7.11MB的pdparams文件。我打印自己修改模型时paddle.summary打印是8MB的参数大小,但实际pdparams文件却有12MB多,这个也大太多了,是要转成推理模型才能和paddle.summary保持一致吗

@ToddBear ToddBear added the good first issue Good for newcomers label Jun 30, 2023
@livingbody
Copy link
Contributor

你好,summary打印的是模型参数的数量
你看到的pdparams是模型保存后的文件大小
两者不是一码事。

@livingbody
Copy link
Contributor

不过总体上来说参数量越大,保存的模型文件就越大。
如果你觉得文件太大,可以量化压缩模型大小。

@shiyutang
Copy link
Collaborator

shiyutang commented Jul 3, 2023

总结说来,paddle summary展示的是模型参数的数量,pdparams的大小是文件的体积,换算关系是体积 = 数量*每个参数占用的磁盘,为了缩小体积可以进行量化,减少每个参数占用的磁盘:
summary文档说明:https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/summary_cn.html#fanhui
量化:https://paddleslim.readthedocs.io/zh_CN/latest/api_cn/static/quant/quantization_api.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants