OnnxSlim: A Toolkit to Help Optimize Onnx Model
Project Links
Meta
Author: inisis
Requires Python: >=3.6
Classifiers
Programming Language
- Python :: 3
License
- OSI Approved :: MIT License
Intended Audience
- Developers
Topic
- Scientific/Engineering :: Artificial Intelligence
OnnxSlim
OnnxSlim can help you slim your onnx model, with less operators, but same accuracy, better inference speed.
- ๐ 2025/05/17: OnnxSlim is merged into optimum ๐ค๐ค๐ค
- ๐ 2025/04/30: Rank 1st in the AICAS 2025 LLM inference optimization challenge
- ๐ 2025/01/28: Achieved 1M downloads
- ๐ 2024/06/23: OnnxSlim is merged into transformers.js ๐ค๐ค๐ค
- ๐ 2024/06/02: OnnxSlim is merged into ultralytics โค๏ธโค๏ธโค๏ธ
- ๐ 2024/04/30: Rank 1st in the AICAS 2024 LLM inference optimization challenge held by Arm and T-head
- ๐ 2024/01/25: OnnxSlim is merged to mnn-llm, performance increased by 5%
Benchmark
Installation
Using Prebuilt
pip install onnxslim
Install From Source
pip install git+https://github.com/inisis/OnnxSlim@main
Install From Local
git clone https://github.com/inisis/OnnxSlim && cd OnnxSlim/
pip install .
How to use
Bash
onnxslim your_onnx_model slimmed_onnx_model

Inscript
import onnx
import onnxslim
model = onnx.load("model.onnx")
slimmed_model = onnxslim.slim(model)
onnx.save(slimmed_model, "slimmed_model.onnx")
For more usage, see onnxslim -h or refer to our examples
Projects using OnnxSlim
Mozilla/smart_autofill
alibaba/MNN
PaddlePaddle/PaddleOCR
huggingface/transformers.js
huggingface/optimum
THU-MIG/yolov10
ultralytics/ultralytics
ModelScope/FunASR
alibaba/MNN-LLM
deepghs/imgutils
sunsmarterjie/yolov12
nndeploy/nndeploy
References
Contact
Discord: https://discord.gg/nRw2Fd3VUS QQ Group: 873569894
Oct 09, 2025
0.1.71
Sep 30, 2025
0.1.70
Sep 21, 2025
0.1.69
Sep 10, 2025
0.1.68
Sep 04, 2025
0.1.67
Sep 03, 2025
0.1.66
Aug 22, 2025
0.1.65
Aug 07, 2025
0.1.64
Aug 05, 2025
0.1.63
Aug 04, 2025
0.1.62
Jul 21, 2025
0.1.61
Jul 20, 2025
0.1.60
Jul 05, 2025
0.1.59
Jun 22, 2025
0.1.58
Jun 09, 2025
0.1.57
Jun 02, 2025
0.1.56
May 31, 2025
0.1.55
May 29, 2025
0.1.54
May 14, 2025
0.1.53
May 09, 2025
0.1.52
May 02, 2025
0.1.51
Apr 09, 2025
0.1.50
Mar 27, 2025
0.1.49
Jan 24, 2025
0.1.48
Jan 08, 2025
0.1.47
Jan 05, 2025
0.1.46
Dec 21, 2024
0.1.45
Dec 14, 2024
0.1.44
Dec 05, 2024
0.1.43
Nov 25, 2024
0.1.42
Nov 24, 2024
0.1.41
Nov 24, 2024
0.1.40
Nov 12, 2024
0.1.39
Nov 12, 2024
0.1.38
Nov 10, 2024
0.1.37
Oct 28, 2024
0.1.36
Oct 02, 2024
0.1.35
Sep 13, 2024
0.1.34
Sep 06, 2024
0.1.33
Jul 13, 2024
0.1.32
Jun 22, 2024
0.1.31
Jun 21, 2024
0.1.30
Jun 14, 2024
0.1.29.1
Jun 10, 2024
0.1.29
May 30, 2024
0.1.28
May 28, 2024
0.1.27
May 14, 2024
0.1.26
Apr 28, 2024
0.1.25
Mar 27, 2024
0.1.24
Mar 24, 2024
0.1.23
Mar 16, 2024
0.1.22
Mar 14, 2024
0.1.21.1
Mar 13, 2024
0.1.21
Mar 11, 2024
0.1.20
Mar 09, 2024
0.1.19
Mar 07, 2024
0.1.18
Mar 02, 2024
0.1.17
Jan 27, 2024
0.1.16
Jan 26, 2024
0.1.15
Jan 25, 2024
0.1.14.1
Jan 24, 2024
0.1.14
Jan 02, 2024
0.1.13
Dec 27, 2023
0.1.12
Dec 24, 2023
0.1.11
Dec 21, 2023
0.1.10
Dec 19, 2023
0.1.9.1
Dec 19, 2023
0.1.9
Dec 16, 2023
0.1.8
Dec 03, 2023
0.1.7
Nov 24, 2023
0.1.6
Nov 09, 2023
0.1.5
Nov 02, 2023
0.1.4
Oct 31, 2023
0.1.3
Oct 28, 2023
0.1.2
Oct 23, 2023
0.1.1
Oct 13, 2023
0.1.0
Oct 07, 2023
0.0.9
Sep 18, 2023
0.0.8
Sep 17, 2023
0.0.7
Sep 12, 2023
0.0.6
Sep 11, 2023
0.0.5
Aug 29, 2023
0.0.4
Aug 28, 2023
0.0.3
Aug 28, 2023
0.0.2
Aug 24, 2023
0.0.1