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

qat输出模型如何支持后续的部署工作? #87

Open
xingyueye opened this issue Oct 8, 2021 · 2 comments
Open

qat输出模型如何支持后续的部署工作? #87

xingyueye opened this issue Oct 8, 2021 · 2 comments

Comments

@xingyueye
Copy link

Hi~首先非常感谢你的工作。我最近将micronet的dorefa量化部分适用到我的工程中(检测模型),发现几个问题,希望讨论一下:

  1. load预训练的浮点模型,使用dorefa的量化inference模式,检测精度直接降为0,求问为什么精度损失会这么大?
  2. 采用dorefa的qat模式,正常训练后精度接近于原float模式,但是load预训练模型与不load的结果并没有区别,这是为什么?个人还是希望能够load预训练模型然后在少数几个epoch便能够恢复精度
  3. qat结束之后保存的模型(float),直接load进行正常的浮点数运算,结果精度降为0;必须采用dorefa的量化算子结果才正确。这一点怎么解决,理论上训练过程采用的也是伪量化数,浮点运算不至于精度下降这么大
  4. qat结束之后保存的模型(float)使用其他的常见量化算法进行量化,结果精度同样降为0;如何降其训练结果更好地与后续的部署工程相结合(例如高通的snpe)
@xingyueye xingyueye changed the title dorefa量化模型精度问题 qat输出模型如何支持后续的部署工作? Oct 9, 2021
@666DZY666
Copy link
Owner

1、inference区别仅仅是先整体做weight量化,推理时仅做activation量化,可以再检查下;
2、用iao试试,加载预训练浮点模型一般会好一些;
3、测试必须用量化算子,因为训练是量化的;
4、量化算法需要统一;至于部署,目前量化后的模型参数通过bn_fuse.py可以直接导出为txt使用,还不支持直接接入其他推理框架。

@xingyueye
Copy link
Author

非常感谢🙏。这几天研究发现qat所得模型确实非常敏感,对于不同的量化参数或算法兼容性基本为0。最近正好看到一篇论文有讨论这个问题: https://arxiv.org/abs/2002.07686

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

No branches or pull requests

2 participants