Comments (9)
莫慌兄弟,新的exporter问题不止这一个,你先弄回0.6.3
from ppq.
0.6.3也有bug 阿
from ppq.
莫慌,小问题
from ppq.
话说这个问题似乎解决了?
因为我在TRT模式导出的模型,跑onnxruntime也遇到了这个问题,貌似是因为TRTExporter会把zero_point看成fp32格式,而模型用ORT推理就会报错这个问题
from ppq.
哦,你说的这个跟他的问题不一样,你的问题更新到最新版本就不会有了。他这个还是会有。
from ppq.
@ZhangZhiPku
兄弟,我也遇到一样的问题,降0.6.3也是,有解吗?
from ppq.
啊兄弟你是为啥要导出这个格式啊...这格式没框架认啊...
from ppq.
想搞个SparseInst 的模型阿,我把前处理的normalize 移到模型外面后,还是报错误,大佬能帮帮忙吗...
模型从这搬的: https://github.com/hustvl/SparseInst
量化: https://zhuanlan.zhihu.com/p/515855548
from typing import Iterable
import torch
from torch.utils.data import DataLoader
from ppq import BaseGraph, QuantizationSettingFactory, TargetPlatform
from ppq.api import export_ppq_graph, quantize_onnx_model
BATCHSIZE = 1
INPUT_SHAPE = [3, 640, 640]
DEVICE = 'cuda' # only cuda is fully tested :( For other executing device there might be bugs.
PLATFORM = TargetPlatform.ORT_OOS_INT8 # identify a target platform for your network.
ONNX_PATH = 'weights/sparse_inst_r50vd_giam_aug_8bc5b3.onnx'
def load_calibration_dataset() -> Iterable:
return [torch.rand(size=INPUT_SHAPE) for _ in range(8)]
def collate_fn(batch: torch.Tensor) -> torch.Tensor:
return batch.to(DEVICE)
# create a setting for quantizing your network with PPL CUDA.
quant_setting = QuantizationSettingFactory.pplcuda_setting()
quant_setting.equalization = True # use layerwise equalization algorithm.
quant_setting.dispatcher = 'conservative' # dispatch this network in conservertive way.
# Load training data for creating a calibration dataloader.
calibration_dataset = load_calibration_dataset()
calibration_dataloader = DataLoader(
dataset=calibration_dataset,
batch_size=BATCHSIZE, shuffle=True)
# quantize your model.
quantized = quantize_onnx_model(
onnx_import_file=ONNX_PATH, calib_dataloader=calibration_dataloader,
calib_steps=8, input_shape=[BATCHSIZE] + INPUT_SHAPE,
setting=quant_setting, collate_fn=collate_fn, platform=PLATFORM,
device=DEVICE, verbose=1)
# export quantized graph.
export_ppq_graph(graph=quantized, platform=PLATFORM,
graph_save_to=ONNX_PATH.split('.')[0] + '_q.onnx',
config_save_to=ONNX_PATH.split('.')[0] + '_q.json')
遇到错误:
from ppq.
@Lilyo 来来你加我个qq 281077761
from ppq.
Related Issues (20)
- Op Execution Error: Einsum HOT 1
- yolov5量化,在ppq/samples/yolo中运行02_Quantization.py文件出现警告和报错,输出模型只有onnx没有engine文件 HOT 1
- 请问PPQ支持一维网络模型的量化吗 HOT 1
- [视频资料]使用profiler来分析网络性能,tensorboard无法解析日志文件 HOT 2
- PPQint8CPU量化bug HOT 1
- Op Execution Error MMCVModulatedDeformConv2d
- 关于QAT中的BN? HOT 1
- 是否有计划支持高通QNN(比较新的版本)和海思芯片呢? HOT 1
- ppq使用torch_mlir导出tosa格式的mlir HOT 1
- 这个工具链已经收敛了吗?我看已经比较久没有特性更新了,后续还有新特性计划吗? HOT 1
- 能否支持权重和激活位宽不同的量化? HOT 2
- VIT类模型量化感知训练loss跑飞 HOT 1
- PPQ已经支持了不少后端推理框架(TensorRT,ncnn,mnn等),这些后端的量化规格细节都是怎么获取的呢?现在PPQ与后端量化推理可以完全对齐吗?
- PPQ在画质类任务上(如低光降噪)量化效果咋样呢?
- AttributeError: 'NoneType' object has no attribute 'copy'
- 求助 为什么量化以后模型没有减小?
- ProgramEntrance_2.py读取imagenet图片reshape报错
- RuntimeError: Op Execution Error: /Slice(Type: Slice, Num of Input: 5, Num of Output: 1)
- Quantization for tflite HOT 1
- PPQ can not process parameter variable(PPQ_Variable_108) with multiple destinations HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ppq.