666DZY666 / micronet

micronet, a model compression and deploy lib. compression: 1、quantization: quantization-aware-training(QAT), High-Bit(>2b)(DoReFa/Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference)、Low-Bit(≤2b)/Ternary and Binary(TWN/BNN/XNOR-Net); post-training-quantization(PTQ), 8-bit(tensorrt); 2、 pruning: normal、regular and group convolutional channel pruning; 3、 group convolution structure; 4、batch-normalization fuse for quantization. deploy: tensorrt, fp32/fp16/int8(ptq-calibration)、op-adapt(upsample)、dynamic_shape
MIT License
2.2k stars 478 forks source link

量化后模型参数并未变成指定位数 #26

Open lvsen94 opened 4 years ago

lvsen94 commented 4 years ago

您好,按照说明进行模型的量化后,提取模型参数,发现还是高位浮点数,并未变成指定的量化位数。请问是需要注意什么操作吗

666DZY666 commented 4 years ago

这里量化训练是模拟验证量化过程,最终保存的还是浮点参数,但这个浮点参数其实已经是量化的了,接下来拿这个参数再坐下量化表示就可以部署了,可以参照bn_folding/bn_folding.py和bn_folding/bn_folding_model_test.py。(当然在量化训练中最后也可以保存成量化表示的参数,这里没有这么做,这些以及其他一些后处理都在bn_folding.py中完成)

666DZY666 commented 4 years ago

补充下,这里参数量化的形式,如 quantizes a real number input ri∈[0, 1] to a k-bit number output ro∈ [0, 1]

manwu1994 commented 3 years ago

您好,按照说明进行模型的量化后,提取模型参数,发现还是高位浮点数,并未变成指定的量化位数。请问是需要注意什么操作吗 您好,请问您实现了浮点参数转化为指定参数了吗?谢谢

manwu1994 commented 3 years ago

这里量化训练是模拟验证量化过程,最终保存的还是浮点参数,但这个浮点参数其实已经是量化的了,接下来拿这个参数再坐下量化表示就可以部署了,可以参照bn_folding/bn_folding.py和bn_folding/bn_folding_model_test.py。(当然在量化训练中最后也可以保存成量化表示的参数,这里没有这么做,这些以及其他一些后处理都在bn_folding.py中完成)

大佬,您好,我在学习您的代码bn_folding/bn_folding.py和bn_folding/bn_folding_model_test.py过程中,仍然还是没有提取出量化后指定的参数,请问您有相关的建议吗?谢谢!