Code Monkey home page Code Monkey logo

Comments (8)

666DZY666 avatar 666DZY666 commented on August 22, 2024

这个训练量化程序保存的模型参数形式是正常的浮点,但在训练过程中模拟了量化过程,即保存的这个参数其实已经是量化了的。可以再用个脚本提取参数(运行训练量化程序中的量化部分)来变成量化形式,8bits变为[0, 255]的整数,三值/二值变为+-1、0,可用于终端部署。WbWtAb-bn_merge-bn_merge.py中就做了这个参数提取,可以参考

from micronet.

Greyman-Seu avatar Greyman-Seu commented on August 22, 2024

这个训练量化程序保存的模型参数形式是正常的浮点,但在训练过程中模拟了量化过程,即保存的这个参数其实已经是量化了的。可以再用个脚本提取参数(运行训练量化程序中的量化部分)来变成量化形式,8bits变为[0, 255]的整数,三值/二值变为+-1、0,可用于终端部署。WbWtAb-bn_merge-bn_merge.py中就做了这个参数提取,可以参考

我是可以理解成量化操作最后数值是量化后的数值,但是保存方式是浮点型。现在torch官方支持qint8类型,三值、二值是不是难以工程部署使用。

from micronet.

tengshaofeng avatar tengshaofeng commented on August 22, 2024

@Greyman-Seu, @666DZY666 , 并没有看到WbWtAb/bn_merge/bn_merge.py呀
大神我刚试了bn_folding.py, 但是model.pth和quan_model_para.pth都是2.4M,还是没有减小

from micronet.

Icey-Liu avatar Icey-Liu commented on August 22, 2024

@666DZY666 大佬你好,bnfuse的pth读取后内部仍是浮点型,没有变成整数,请问是需要不同的操作吗

from micronet.

dan123yi avatar dan123yi commented on August 22, 2024

请问问怎么让这个·pth文件变小呢

from micronet.

YangNuoCheng avatar YangNuoCheng commented on August 22, 2024

如果要实现变成整数的weight和bias,是否可以按照量化公式,用pth中的scale,zero_point来得到量化中间值呢?

from micronet.

dan123yi avatar dan123yi commented on August 22, 2024

from micronet.

rourou8023 avatar rourou8023 commented on August 22, 2024

@666DZY666 @tengshaofeng @Greyman-Seu @Icey-Liu @YangNuoCheng 麻烦问下,怎么将通过二值权重和特征方式训练的模型保存为二值的模型呢?现在保存的还是浮点型的,模型的大小未发生变化,
参照bn_fuse.py中的处理,处理之后保存的模型依然是浮点型的;
用的网络是nin.py的结构,麻烦问下要怎么转换为二值的呢?

from micronet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.