{"id":19001304,"url":"https://github.com/oneflow-inc/oneflow-model-compression","last_synced_at":"2025-06-14T03:35:06.423Z","repository":{"id":103034311,"uuid":"347852455","full_name":"Oneflow-Inc/Oneflow-Model-Compression","owner":"Oneflow-Inc","description":null,"archived":false,"fork":false,"pushed_at":"2021-08-16T04:24:17.000Z","size":1398,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":50,"default_branch":"main","last_synced_at":"2025-03-29T17:12:38.512Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Oneflow-Inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-15T05:51:16.000Z","updated_at":"2024-06-07T05:42:13.000Z","dependencies_parsed_at":"2023-07-25T02:15:12.917Z","dependency_job_id":null,"html_url":"https://github.com/Oneflow-Inc/Oneflow-Model-Compression","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oneflow-Inc%2FOneflow-Model-Compression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oneflow-Inc%2FOneflow-Model-Compression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oneflow-Inc%2FOneflow-Model-Compression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oneflow-Inc%2FOneflow-Model-Compression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oneflow-Inc","download_url":"https://codeload.github.com/Oneflow-Inc/Oneflow-Model-Compression/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249279454,"owners_count":21242930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T18:10:42.384Z","updated_at":"2025-04-16T21:32:04.749Z","avatar_url":"https://github.com/Oneflow-Inc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oneflow-Model-Compression\n\n## 概述\n炼知技术平台是一个模型压缩平台，包含剪枝、量化、知识蒸馏等一系列模型压缩策略。\n提供完整的模型压缩解决方案，可用于各种类型的自然语言和计算机视觉场景，如文本分类、推理，图像分类等。\n另外，平台在不断完善各种压缩策略在经典开源任务的Benchmark，以便用户参考。\n同时，平台也提供各种压缩策略的功能算子，方便用户使用、复现最新的论文方法，以及利用压缩算子进行二次开发。\n\n\u003cp align=\"center\"\u003e\n    \u003cbr\u003e\n    \u003cimg src=\"./docs/imgs/overview.png\" width=\"600\"/\u003e\n    \u003cbr\u003e\n\u003cp\u003e\n\n## 功能\n\n\u003ctable style=\"width:100%;\" cellpadding=\"2\" cellspacing=\"0\" border=\"1\" bordercolor=\"#000000\"\u003e\n\t\u003ctbody\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd style=\"text-align:center;\"\u003e\n\t\t\t\t\u003cspan style=\"font-size:18px;\"\u003e功能模块\u003c/span\u003e\n\t\t\t\u003c/td\u003e\n\t\t\t\u003ctd style=\"text-align:center;\"\u003e\n\t\t\t\t\u003cspan style=\"font-size:18px;\"\u003e算法\u003c/span\u003e\n\t\t\t\u003c/td\u003e\n\t\t\t\u003ctd style=\"text-align:center;\"\u003e\n\t\t\t\t\u003cspan style=\"font-size:18px;\"\u003e相关文档\u003c/span\u003e\n\t\t\t\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd style=\"text-align:center;\"\u003e\n\t\t\t\t量化\n\t\t\t\u003c/td\u003e\n\t\t\t\u003ctd\u003e\n\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\u003cli\u003e\n                        \u003cspan\u003edeep compression\u003c/span\u003e:\u0026nbsp;\u003ca href=\"https://arxiv.org/pdf/1510.00149.pdf\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eHan S, Mao H, Dally W J. \"Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding\"\u0026nbsp;\u003c/span\u003e\u003ci\u003earXiv preprint arXiv:1510.00149\u003c/i\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003e\u0026nbsp;(2017).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003cli\u003e\n                        \u003cspan\u003eNVIDIA TensorRT\u003c/span\u003e:\u0026nbsp;\u003ca href=\"https://github.com/NVIDIA/TensorRT\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003ea C++ library for high performance inference on NVIDIA GPUs and deep learning accelerators.\u0026nbsp;\u003c/span\u003e\u003ci\u003e\u003c/i\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003e\u0026nbsp;\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\t\t\t\t\t\n\t\t\t\t\u003c/ul\u003e\n\t\t\t\u003c/td\u003e\n\t\t\t\u003ctd\u003e\n\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\t\u003ca href=\"./docs/API_quant.md\" target=\"_blank\"\u003e量化API文档\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n                    \u003cli\u003e\n\t\t\t\t\t\t\u003ca href=\"./model_compress/quantization/tutorial.md\" target=\"_blank\"\u003e量化快速上手\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\u003c/ul\u003e\n\t\t\t\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd style=\"text-align:center;\"\u003e\n\t\t\t\t\u003cspan style=\"font-size:12px;\"\u003e剪枝\u003c/span\u003e\u003cspan style=\"font-size:12px;\"\u003e\u003c/span\u003e\u003cbr /\u003e\n\t\t\t\u003c/td\u003e\n\t\t\t\u003ctd\u003e\n\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\u003cli\u003e\n                        \u003cspan\u003ebn channel slimming\u003c/span\u003e:\u0026nbsp;\u003ca href=\"https://arxiv.org/abs/1708.06519\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eZhuang Liu, Jianguo Li, Zhiqiang Shen. \"Learning Efficient Convolutional Networks through Network Slimming\"\u0026nbsp;\u003c/span\u003e\u003ci\u003earXiv preprint arXiv:1708.06519\u003c/i\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003e\u0026nbsp;(2017).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n                    \u003cli\u003e\n                        \u003cspan\u003econv channel slimming\u003c/span\u003e:\u0026nbsp;\u003ca href=\"https://arxiv.org/abs/1608.08710\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eHao Li, Asim Kadav, Igor Durdanovic. \"Pruning Filters for Efficient ConvNets\"\u0026nbsp;\u003c/span\u003e\u003ci\u003earXiv preprint arXiv:1608.08710\u003c/i\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003e\u0026nbsp;(2016).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n                    \u003cli\u003e\n                        \u003cspan\u003econv channel slimming\u003c/span\u003e:\u0026nbsp;\u003ca href=\"http://cn.arxiv.org/abs/1607.03250\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eHengyuan Hu, Rui Peng, Yu-Wing Tai. \"Network Trimming: A Data-Driven Neuron Pruning Approach towards Efficient Deep Architectures\"\u0026nbsp;\u003c/span\u003e\u003ci\u003earXiv preprint arXiv:1607.03250\u003c/i\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003e\u0026nbsp;(2016).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\u003c/ul\u003e\n\t\t\t\u003c/td\u003e\n\t\t\t\u003ctd\u003e\n\t\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\t\t\u003ca href=\"./docs/API_prune.md\" target=\"_blank\"\u003e剪枝API文档\u003c/a\u003e\n\t\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003c/ul\u003e\n\t\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\t\t\u003ca href=\"./model_compress/ChannelSlimming\" target=\"_blank\"\u003e剪枝快速上手\u003c/a\u003e\n\t\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003c/ul\u003e\n\t\t\t\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd style=\"text-align:center;\"\u003e\n\t\t\t\t知识蒸馏\n\t\t\t\u003c/td\u003e\n\t\t\t\u003ctd\u003e\n\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\t\u003cspan\u003eKnowledge Distillation\u003c/span\u003e:\u0026nbsp;\u003ca href=\"https://arxiv.org/abs/1503.02531\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eHinton, Geoffrey, Oriol Vinyals, and Jeff Dean. \"Distilling the knowledge in a neural network.\"\u0026nbsp;\u003c/span\u003e\u003ci\u003earXiv preprint arXiv:1503.02531\u003c/i\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003e\u0026nbsp;(2015).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\tDistilled-BiLSTM:\u0026nbsp;\u0026nbsp;\u003ca href=\"https://arxiv.org/abs/1903.12136\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eTang, Raphael, et al. \"Distilling task-specific knowledge from bert into simple neural networks.\" arXiv preprint arXiv:1903.12136 (2019).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\tBERT-PKD:\u0026nbsp;\u0026nbsp;\u003ca href=\"https://arxiv.org/abs/1908.09355\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eSun, Siqi, et al. \"Patient knowledge distillation for bert model compression.\" arXiv preprint arXiv:1908.09355 (2019).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\tTinyBERT: \u003ca href=\"https://arxiv.org/abs/1909.10351\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eJiao, Xiaoqi, et al. \"Tinybert: Distilling bert for natural language understanding.\" arXiv preprint arXiv:1909.10351 (2019).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\tMobileBERT: \u003ca href=\"https://arxiv.org/abs/2004.02984\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eSun, Zhiqing, et al. \"Mobilebert: a compact task-agnostic bert for resource-limited devices.\" arXiv preprint arXiv:2004.02984 (2020).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\tBERT-Theseus: \u003ca href=\"https://arxiv.org/abs/2002.02925\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eXu, Canwen, et al. \"Bert-of-theseus: Compressing bert by progressive module replacing.\" arXiv preprint arXiv:2002.02925 (2020).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\t改进版的BERT-Theseus: \u003ca href=\"https://arxiv.org/abs/2002.02925\" target=\"_blank\"\u003e\u003cspan style=\"color:#222222;font-family:Arial, sans-serif;font-size:13px;background-color:#FFFFFF;\"\u003eXu, Canwen, et al. \"Bert-of-theseus: Compressing bert by progressive module replacing.\" arXiv preprint arXiv:2002.02925 (2020).\u003c/span\u003e\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\u003c/ul\u003e\n\t\t\t\u003c/td\u003e\n\t\t\t\u003ctd\u003e\n\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t\t\u003ca href=\"./docs/API_knowledge_distill.md\" target=\"_blank\"\u003e知识蒸馏API文档\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\t\u003cli\u003e\n\t\t\t\t\t    \u003ca href=\"./model_compress/distil\" target=\"_blank\"\u003e知识蒸馏快速上手\u003c/a\u003e\n                   \u003c/li\u003e\n                   \u003cli\u003e\n\t\t\t\t\t    \u003ca href=\"./model_compress/distil/examples/knowledge_distillation/README.md\" target=\"_blank\"\u003eKnowledge Distillation算法文档\u003c/a\u003e\n                    \u003c/li\u003e\n                    \u003cli\u003e\n\t\t\t\t\t    \u003ca href=\"./model_compress/distil/examples/distilled-bilstm/README.md\" target=\"_blank\"\u003eDistilled-BiLSTM算法文档\u003c/a\u003e\n                    \u003c/li\u003e\n                    \u003cli\u003e\n\t\t\t\t\t    \u003ca href=\"./model_compress/distil/examples/bert-pkd/README.md\" target=\"_blank\"\u003eBERT-PKD算法文档\u003c/a\u003e\n                    \u003c/li\u003e\n                    \u003cli\u003e\n\t\t\t\t\t    \u003ca href=\"./model_compress/distil/examples/tinybert/README.md\" target=\"_blank\"\u003eTinyBERT算法文档\u003c/a\u003e\n                    \u003c/li\u003e\n                    \u003cli\u003e\n\t\t\t\t\t    \u003ca href=\"model_compress/distil/theseus/README.md\" target=\"_blank\"\u003eBERT-Theseus算法文档\u003c/a\u003e\n\t\t\t\t\t\u003c/li\u003e\n\t\t\t\t\u003c/ul\u003e\n\t\t\t\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\u003e\n\n\n\u003cbr /\u003e\n\n## 使用\n- Oneflow介绍： 深度学习框架Oneflow[介绍以及环境安装说明](https://github.com/Oneflow-Inc/oneflow)。\n- Oneflow快速开始：通过[简单示例](http://docs.oneflow.org/quick_start/quickstart_in_3_min.html)介绍如何快速3分钟上手使用Oneflow。\n- 模型压缩API文档：用户接口文档，包含以下功能\n    - [量化](./docs/API_quant.md)\n    - [剪枝](./docs/API_prune.md)\n    - [知识蒸馏](./docs/API_knowledge_distill.md)\n- 高阶教程：包括在CV和NLP等应用场景任务的使用示例、算法使用步骤，高级特性的使用教程。\n    - 量化功能文档: 介绍量化功能[使用示例](./model_compress/quantization/tutorial.md)，主要包含int8量化。\n    - 剪枝功能文档:  介绍通道剪枝实现和[使用示例](./model_compress/ChannelSlimming/readme.md)，只要包括CNN模型、DNN模型的不同剪枝算子。\n    - [知识蒸馏功能](./model_compress/distil)文档: 介绍知识蒸馏功能相关论文实现和使用示例，主要包含[KD](./model_compress/distil/examples/knowledge_distillation/README.md), [Distilled-BiLSTM](./model_compress/distil/examples/distilled-bilstm/README.md), [BERT-PKD](./model_compress/distil/examples/bert-pkd/README.md), [TinyBERT](./model_compress/distil/examples/tinybert/README.md), [BERT-Theseus](./model_compress/distil/theseus/README.md)等算法。\n    - [TensorRT量化部署](./docs/API_quant.md): 介绍如何使用TensorRT部署量化得到的Oneflow模型。\n- [模型库](./docs/model_zoo.md)：各个压缩算法在文本分类、推理，图像分类等数据集上的实验结果，包括模型精度、模型尺寸和推理速度。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneflow-inc%2Foneflow-model-compression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneflow-inc%2Foneflow-model-compression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneflow-inc%2Foneflow-model-compression/lists"}