安装方式需查阅官网安装指南,README 未直接给出命令;使用前需已安装 TensorFlow/Keras 环境
model-optimization
tensorflowApache-2.0活跃维护面向 Keras 和 TensorFlow 的模型压缩工具包,通过量化和剪枝把训练好的模型压小、跑得更快,方便部署到移动端和边缘设备。
A toolkit to optimize ML models for deployment for Keras and TensorFlow, including quantization and pruning.
README 未给出安装命令,仅指向 tensorflow.org/model_optimization/guide/installREADME 未说明
TensorFlow 官方的模型压缩工具包,用剪枝和量化把 Keras 模型变小以便部署
面向 Keras 和 TensorFlow 的模型压缩工具包,通过量化和剪枝把训练好的模型压小、跑得更快,方便部署到移动端和边缘设备。
核心能力
- 提供 Keras 专用 API 做剪枝与量化
- 支持稀疏权重剪枝
- 支持量化优化
- 按 clustering、quantization、sparsity 分子包维护
- 提供稳定的 Python API
容易踩的坑
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
- v0.8.1TensorFlow Model Optimization 0.8.1最新正式版2026-05-12 · 2026-05-12 18:23 UTC
TFMOT 0.8.1 improves compatibility with numpy v2 and dependencies.
- Fix keras importing failures at the colab.
- Add required packages to setup.py to match requirements.txt.
- Relax absl-py requirements for tensorflow_model_optimization.
- Mark compatibility with numpy v2.
- v0.8.0TensorFlow Model Optimization 0.8.02024-02-08 · 2024-02-08 02:06 UTC
查看更新说明
TFMOT 0.8.0 forces users to use the keras v2 version.
- Fix structural pruning sparsity notebook
- Remove private Keras imports.
- Redirect TF references.
- Fix broken tests.
- Tested against TensorFlow 2.14.1, and nightly on Python 3.
- v0.7.5TensorFlow Model Optimization 0.7.52023-05-26 · 2023-05-26 02:36 UTC
查看更新说明
TFMOT 0.7.5 fixes compatibility issues with new keras.
- Fixed improper serialization code route for functional models.
- Created a local copy of keras.utils.generic_utils.to_snake_case.
- Handled the error type reflect to the keras update.
- Fixed compatibility issues for the TF/Keras 2.13.
- v0.7.4TensorFlow Model Optimization 0.7.42023-04-03 · 2023-04-03 01:49 UTC
查看更新说明
TFMOT 0.7.4 add from_config method to QuantizeConfig class since the new keras serialization enforces it.
- v0.7.3TensorFlow Model Optimization 0.7.32022-07-20 · 2022-07-20 20:42 UTC
查看更新说明
TFMOT 0.7.3 add remove_input_range method that removes input range after apply quantize.
TensorFlow Model Optimization Toolkit
The TensorFlow Model Optimization Toolkit is a suite of tools that users, both novice and advanced, can use to optimize machine learning models for deployment and execution.
Supported techniques include quantization and pruning for sparse weights. There are APIs built specifically for Keras.
For an overview of this project and individual tools, the optimization gains, and our roadmap refer to tensorflow.org/model_optimization. The website also provides various tutorials and API docs.
The toolkit provides stable Python APIs.
Installation
For installation instructions, see tensorflow.org/model_optimization/guide/install.
Contribution guidelines
If you want to contribute to TensorFlow Model Optimization, be sure to review the contribution guidelines. This project adheres to TensorFlow's code of conduct. By participating, you are expected to uphold this code.
We use GitHub issues for tracking requests and bugs.
Maintainers
Community
As part of TensorFlow, we're committed to fostering an open and welcoming environment.
- TensorFlow Blog: Stay up to date on content from the TensorFlow team and best articles from the community.