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

INT8量化报错 #153

Open
GengyuXu opened this issue Dec 12, 2023 · 8 comments
Open

INT8量化报错 #153

GengyuXu opened this issue Dec 12, 2023 · 8 comments

Comments

@GengyuXu
Copy link

GengyuXu commented Dec 12, 2023

芯片1684
模型yolov5s

npz compare FAILED.
compare output_Concat: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 25.02it/s]
Traceback (most recent call last):
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/tools/model_deploy.py", line 286, in
tool.lowering()
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/tools/model_deploy.py", line 103, in lowering
tool.validate_tpu_mlir()
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/tools/model_deploy.py", line 190, in validate_tpu_mlir
f32_blobs_compare(self.tpu_npz, self.ref_npz, self.tolerance, self.excepts)
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/utils/mlir_shell.py", line 172, in f32_blobs_compare
_os_system(cmd)
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/utils/mlir_shell.py", line 50, in _os_system
raise RuntimeError("[!Error]: {}".format(cmd_str))

请问有大佬能帮忙解答一下吗

@callmelaoyi
Copy link

你跑的是readme吗?如果是readme的话,你提供的错误信息有点不够,推测可能是环境没装好

@GengyuXu
Copy link
Author

你跑的是readme吗?如果是readme的话,你提供的错误信息有点不够,推测可能是环境没装好

我用这个工具转fp32 测试过yolov8的bmodel是没有问题的,我是按照文档的步骤走的,现在是想走量化发现报错了。

@callmelaoyi
Copy link

提供的错误信息不全,log信息截全一点

@GengyuXu
Copy link
Author

提供的错误信息不全,log信息截全一点
不好意思回复晚了

SOPHGO Toolchain v1.2.8-g32d7b3ec-20230802
[Running]: tpuc-opt yolov8s-origin.mlir --chip-assign="chip=bm1684" --import-calibration-table="file=yolov8s-origin_cali_table asymmetric=False" --chip-top-optimize --convert-top-to-tpu="mode=INT8 asymmetric=False" --canonicalize -o yolov8s-origin_bm1684_int8_sym_tpu.mlir
[Success]: tpuc-opt yolov8s-origin.mlir --chip-assign="chip=bm1684" --import-calibration-table="file=yolov8s-origin_cali_table asymmetric=False" --chip-top-optimize --convert-top-to-tpu="mode=INT8 asymmetric=False" --canonicalize -o yolov8s-origin_bm1684_int8_sym_tpu.mlir
[CMD]: model_runner.py --input yolov8s-origin_in_f32.npz --model yolov8s-origin_bm1684_int8_sym_tpu.mlir --output yolov8s-origin_bm1684_int8_sym_tpu_outputs.npz
[##################################################] 100%
[Running]: npz_tool.py compare yolov8s-origin_bm1684_int8_sym_tpu_outputs.npz yolov8s-origin_top_outputs.npz --tolerance 0.85,0.45 --except - -vv
compare output0_Concat: 0%| | 0/1 [00:00<?, ?it/s][output0_Concat ] NOT_SIMLIAR [FAILED]
(1, 84, 8400) float32
cosine_similarity = 0.766871
euclidean_similarity = -0.612472
sqnr_similarity = -16.174872
top-k:
idx-t target idx-r ref
20162 40.069126 5599 637.0387
20164 40.069126 5519 636.8641
20152 40.069126 5679 636.829
20153 40.069126 799 636.739
20156 40.069126 719 636.5047
20150 40.069126 5759 636.4254
20163 40.069126 5439 636.3794
20167 40.069126 879 636.27893
20166 40.069126 3679 636.2008
20148 40.069126 959 636.146
1 compared
0 passed
0 equal, 0 close, 0 similar
1 failed
0 not equal, 1 not similar
min_similiarity = (0.7668710350990295, -0.6124719814439703, -16.174871921539307)
Target yolov8s-origin_bm1684_int8_sym_tpu_outputs.npz
Reference yolov8s-origin_top_outputs.npz
npz compare FAILED.
compare output0_Concat: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 22.17it/s]
Traceback (most recent call last):
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/tools/model_deploy.py", line 286, in
tool.lowering()
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/tools/model_deploy.py", line 103, in lowering
tool.validate_tpu_mlir()
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/tools/model_deploy.py", line 190, in validate_tpu_mlir
f32_blobs_compare(self.tpu_npz, self.ref_npz, self.tolerance, self.excepts)
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/utils/mlir_shell.py", line 172, in f32_blobs_compare
_os_system(cmd)
File "/workspace/tpu-mlir/tpu-mlir_v1.2.8-g32d7b3ec-20230802/python/utils/mlir_shell.py", line 50, in _os_system
raise RuntimeError("[!Error]: {}".format(cmd_str))
RuntimeError: [!Error]: npz_tool.py compare yolov8s-origin_bm1684_int8_sym_tpu_outputs.npz yolov8s-origin_top_outputs.npz --tolerance 0.85,0.45 --except - -vv

@GengyuXu
Copy link
Author

提供的错误信息不全,log信息截全一点

补充 重新新建一个docker操作 coco数据集的yolov5可以量化,但是yolov8不成功,错误内容和上一个回复的一样,和yolov5一样的转化指令

@callmelaoyi
Copy link

晓得了,应该是yolov8s这个模型量化的效果不好,建议你加一下官方的wx群,然后问一下工作人员

@dzy1128
Copy link

dzy1128 commented Jul 30, 2024

我将自己的v8模型转换成onnx,编译的时候也出现这个错,请问你解决了吗

@20gg
Copy link

20gg commented Nov 28, 2024

用int8非对称量化模型,亲测成功

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

4 participants