当前位置:网站首页>[pytoch] quantification
[pytoch] quantification
2022-06-24 14:18:00 【. Yun Zhe】
#-*- coding:utf-8 -*-
import torch
# Quantification is only available cpu
model = ResNet().cpu()
model = torch.load_state_dict(torch.load(weights))
#Specify quantization configuration
# In this step, symmetric quantization or asymmetric quantization is declared , And quantification bit Count
# The following code uses the default asymmetric quantization , And 8bit
model.qconfig = torch.quantization.default_qconfig
model = torch.quantization.prepare(model)
#Convert to quantized model
model = torch.quantization.convert(model)
#Save model, After saving the model size Significantly reduce , But the performance loss is relatively large
# so , It is suggested to consider quantitative perception training
torch.save(model.state_dict(), "path.pt")
边栏推荐
猜你喜欢
Overview of SAP marketing cloud functions (III)
Autorf: learn the radiation field of 3D objects from single view (CVPR 2022)
#21Set经典案例
二造考生必看|巩固优选题库助力考生最后冲刺
常见的单例模式&简单工厂
Puzzle (016.2) finger painting Galaxy
Unity 热力图建立方法
如何解决 Iterative 半监督训练 在 ASR 训练中难以落地的问题丨RTC Dev Meetup
Solution of channel management system for food and beverage industry: realize channel digital marketing layout
P2pdb white paper
随机推荐
conda和pip命令
Getting to know cloud native security for the first time: the best guarantee in the cloud Era
Jerrys timer0 uses the default pa13 to detect the pulse width [chapter]
Method of establishing unity thermodynamic diagram
Three efficient programming skills of go language
Kotlin shared mutable state and concurrency
AntD checkbox,限制选中数量
2022 recurrent training question bank and answers for hoisting signal Rigger (special type of construction work)
PgSQL queries the largest or smallest data of a field in a group
Unit contour creation method
Maximum path sum in binary tree [handle any subtree, then handle the whole tree]
10_那些格调很高的个性签名
远程办公之:在家露营办公小工具| 社区征文
Promotion of Project Manager
在线文本实体抽取能力,助力应用解析海量文本数据
二造考生必看|巩固优选题库助力考生最后冲刺
Go语言三个高效编程的技巧
卷积核、特征图可视化
食品饮料行业渠道商管理系统解决方案:实现渠道数字化营销布局
数据库注意事项