Shortcuts

Changelog of v1.x

v1.0.0 (24/04/2023)

We are excited to announce the first official release of MMRazor 1.0.

Highlights

  • MMRazor quantization is released, which has got through task models and model deployment. With its help, we can quantize and deploy pre-trained models in OpenMMLab to specified backend quickly.

New Features & Improvements

NAS

  • Update searchable model. (https://github.com/open-mmlab/mmrazor/pull/438)

  • Update NasMutator to build search_space in NAS. (https://github.com/open-mmlab/mmrazor/pull/426)

Pruning

  • Add a new pruning algorithm named GroupFisher. We support the full pipeline for GroupFisher, including pruning, finetuning and deployment.(https://github.com/open-mmlab/mmrazor/pull/459)

KD

  • Support stopping distillation after a certain epoch. (https://github.com/open-mmlab/mmrazor/pull/455)

  • Support distilling rtmdet with mmrazor, refer to here. (https://github.com/open-mmlab/mmyolo/pull/544)

  • Add mask channel in MGD Loss. (https://github.com/open-mmlab/mmrazor/pull/461)

Quantization

  • Support two quantization types: QAT and PTQ (https://github.com/open-mmlab/mmrazor/pull/513)

  • Support various quantization bits. (https://github.com/open-mmlab/mmrazor/pull/513)

  • Support various quantization methods, such as per_tensor / per_channel, symmetry / asymmetry and so on. (https://github.com/open-mmlab/mmrazor/pull/513)

  • Support deploy quantized models to multiple backends, such as OpenVINO, TensorRT and so on. (https://github.com/open-mmlab/mmrazor/pull/513)

  • Support applying quantization algorithms to multiple task repos directly, such as mmcls, mmdet and so on. (https://github.com/open-mmlab/mmrazor/pull/513)

Bug Fixes

  • Fix split in Darts config. (https://github.com/open-mmlab/mmrazor/pull/451)

  • Fix a bug in Recorders. (https://github.com/open-mmlab/mmrazor/pull/446)

  • Fix a bug when using get_channel_unit.py. (https://github.com/open-mmlab/mmrazor/pull/432)

  • Fix a bug when deploying a pruned model to cuda. (https://github.com/open-mmlab/mmrazor/pull/495)

Contributors

A total of 10 developers contributed to this release. Thanks @415905716 @gaoyang07 @humu789 @LKJacky @HIT-cwh @aptsunny @cape-zck @vansin @twmht @wm901115nwpu

v1.0.0rc2 (06/01/2023)

We are excited to announce the release of MMRazor 1.0.0rc2.

New Features

NAS

  • Add Performance Predictor: Support 4 performance predictors with 4 basic machine learning algorithms, which can be used to directly predict model accuracy without evaluation.(https://github.com/open-mmlab/mmrazor/pull/306)

  • Support Autoformer, a one-shot architecture search algorithm dedicated to vision transformer search.(https://github.com/open-mmlab/mmrazor/pull/315 )

  • Support BigNAS, a NAS algorithm which searches the following items in MobileNetV3 with the one-shot paradigm: kernel_sizes, out_channels, expand_ratios, block_depth and input sizes. (https://github.com/open-mmlab/mmrazor/pull/219 )

Pruning

  • Support DCFF, a filter channel pruning algorithm dedicated to efficient image classification.(https://github.com/open-mmlab/mmrazor/pull/295)

  • We release a powerful tool to automatically analyze channel dependency, named ChannelAnalyzer. Here is an example as shown below.(https://github.com/open-mmlab/mmrazor/pull/371)

Now, ChannelAnalyzer supports most of CNN models in torchvision, mmcls, mmseg and mmdet. We will continue to support more models.

from mmrazor.models.task_modules import ChannelAnalyzer
from mmengine.hub import get_model
import json

model = get_model('mmdet::retinanet/retinanet_r18_fpn_1x_coco.py')
unit_configs: dict = ChannelAnalyzer().analyze(model)
unit_config0 = list(unit_configs.values())[0]
print(json.dumps(unit_config0, indent=4))
# # short version of the config
# {
#     "channels": {
#         "input_related": [
#             {"name": "backbone.layer2.0.bn1"},
#             {“name": "backbone.layer2.0.conv2"}
#         ],
#         "output_related": [
#             {"name": "backbone.layer2.0.conv1"},
#             {"name": "backbone.layer2.0.bn1"}
#         ]
#     },
#}

KD

  • Support MGD, a detection distillation algorithm.(https://github.com/open-mmlab/mmrazor/pull/381)

Bug Fixes

  • Fix FpnTeacherDistll techer forward from backbone + neck + head to backbone + neck(#387 )

  • Fix some expire configs and checkpoints(#373 #372 #422 )

Ongoing Changes

We will release Quantization in next version(1.0.0rc3)!

Contributors

A total of 11 developers contributed to this release: @wutongshenqiu @sunnyxiaohu @aptsunny @humu789 @TinyTigerPan @FreakieHuang @LKJacky @wilxy @gaoyang07 @spynccat @yivona08.

v1.0.0rc1 (27/10/2022)

We are excited to announce the release of MMRazor 1.0.0rc1.

Highlights

  • New Pruning Framework:We have systematically refactored the Pruning module. The new Pruning module can more automatically resolve the dependencies between channels and cover more corner cases.

New Features

Pruning

  • A new pruning framework is released in this release. (#311, #313) It consists of five core modules, including Algorithm, ChannelMutator, MutableChannelUnit, MutableChannel and DynamicOp.

  • MutableChannelUnit is introduced for the first time. Each MutableChannelUnit manages all channels with channel dependency.

    from mmrazor.registry import MODELS
    
    ARCHITECTURE_CFG = dict(
        _scope_='mmcls',
        type='ImageClassifier',
        backbone=dict(type='MobileNetV2', widen_factor=1.5),
        neck=dict(type='GlobalAveragePooling'),
        head=dict(type='mmcls.LinearClsHead', num_classes=1000, in_channels=1920))
    model = MODELS.build(ARCHITECTURE_CFG)
    from mmrazor.models.mutators import ChannelMutator
    
    channel_mutator = ChannelMutator()
    channel_mutator.prepare_from_supernet(model)
    units = channel_mutator.mutable_units
    print(units[0])
    # SequentialMutableChannelUnit(
    #   name=backbone.conv1.conv_(0, 48)_48
    #   (output_related): ModuleList(
    #     (0): Channel(backbone.conv1.conv, index=(0, 48), is_output_channel=true, expand_ratio=1)
    #     (1): Channel(backbone.conv1.bn, index=(0, 48), is_output_channel=true, expand_ratio=1)
    #     (2): Channel(backbone.layer1.0.conv.0.conv, index=(0, 48), is_output_channel=true, expand_ratio=1)
    #     (3): Channel(backbone.layer1.0.conv.0.bn, index=(0, 48), is_output_channel=true, expand_ratio=1)
    #   )
    #   (input_related): ModuleList(
    #     (0): Channel(backbone.conv1.bn, index=(0, 48), is_output_channel=false, expand_ratio=1)
    #     (1): Channel(backbone.layer1.0.conv.0.conv, index=(0, 48), is_output_channel=false, expand_ratio=1)
    #     (2): Channel(backbone.layer1.0.conv.0.bn, index=(0, 48), is_output_channel=false, expand_ratio=1)
    #     (3): Channel(backbone.layer1.0.conv.1.conv, index=(0, 48), is_output_channel=false, expand_ratio=1)
    #   )
    #   (mutable_channel): SquentialMutableChannel(num_channels=48, activated_channels=48)
    # )
    

Our new pruning algorithm can help you develop pruning algorithm more fluently. Pelease refer to our documents PruningUserGuide for model detail.

Distillation

  • Support CRD, a distillation algorithm based on contrastive representation learning. (#281)

  • Support PKD, a distillation algorithm that can be used in MMDetection and MMDetection3D. #304

  • Support DEIT, a classic Transformer distillation algorithm.(#332)

  • Add a more powerful baseline setting for KD. (#305)

  • Add MethodInputsRecorder and FuncInputsRecorder to record the input of a class method or a function.(#320)

NAS

  • Support DSNAS, a nas algorithm that does not require retraining. (#226 )

Tools

  • Support configurable immediate feature map visualization. (#293 ) A useful tool is supported in this release to visualize the immediate features of a neural network. Please refer to our documents VisualizationUserGuide for more details.

Bug Fixes

  • Fix the bug that FunctionXXRecorder and FunctionXXDelivery can not be pickled. (#320)

Ongoing changes

  • Quantization: We are developing the basic interface of PTQ and QAT. RFC(Request for Comments) will be released soon.

  • AutoSlim: AutoSlim is not yet available and is being refactored.

  • Fx Pruning Tracer: Currently, the model topology can only be resolved through the backward tracer. In the future, both backward tracer and fx tracer will be supported.

  • More Algorithms: BigNAS、AutoFormer、GreedyNAS and Resrep will be released in the next few versions.

  • Documentation: we will add more design docs, tutorials, and migration guidance so that the community can deep dive into our new design, participate the future development, and smoothly migrate downstream libraries to MMRazor 1.x.

Contributors

A total of 12 developers contributed to this release. Thanks @FreakieHuang @gaoyang07 @HIT-cwh @humu789 @LKJacky @pppppM @pprp @spynccat @sunnyxiaohu @wilxy @kitecats @SheffieldCao

v1.0.0rc0 (31/8/2022)

We are excited to announce the release of MMRazor 1.0.0rc0. MMRazor 1.0.0rc0 is the first version of MMRazor 1.x, a part of the OpenMMLab 2.0 projects. Built upon the new training engine, MMRazor 1.x simplified the interaction with other OpenMMLab repos, and upgraded the basic APIs of KD / Pruning / NAS. It also provides a series of knowledge distillation algorithms.

Highlights

  • New engines. MMRazor 1.x is based on MMEngine, which provides a general and powerful runner that allows more flexible customizations and significantly simplifies the entrypoints of high-level interfaces.

  • Unified interfaces. As a part of the OpenMMLab 2.0 projects, MMRazor 1.x unifies and refactors the interfaces and internal logic of train, testing, datasets, models, evaluation, and visualization. All the OpenMMLab 2.0 projects share the same design in those interfaces and logic to allow the emergence of multi-task/modality algorithms.

  • More configurable KD. MMRazor 1.x add Recorder to get the data needed for KD more automatically,Delivery to automatically pass the teacher’s intermediate results to the student, and connector to handle feature dimension mismatches between teacher and student.

  • More kinds of KD algorithms. Benefitting from the powerful APIs of KD, we have added several categories of KD algorithms, data-free distillation, self-distillation, and zero-shot distillation.

  • Unify the basic interface of NAS and Pruning. We refactored Mutable, adding mutable value and mutable channel. Both NAS and Pruning can be developed based on mutables.

  • More documentation and tutorials. We add a bunch of documentation and tutorials to help users get started more smoothly. Read it here.

Breaking Changes

Training and testing

  • MMRazor 1.x runs on PyTorch>=1.6. We have deprecated the support of PyTorch 1.5 to embrace the mixed precision training and other new features since PyTorch 1.6. Some models can still run on PyTorch 1.5, but the full functionality of MMRazor 1.x is not guaranteed.

  • MMRazor 1.x uses Runner in MMEngine rather than that in MMCV. The new Runner implements and unifies the building logic of dataset, model, evaluation, and visualizer. Therefore, MMRazor 1.x no longer maintains the building logics of those modules in mmdet.train.apis and tools/train.py. Those code have been migrated into MMEngine.

  • The Runner in MMEngine also supports testing and validation. The testing scripts are also simplified, which has similar logic as that in training scripts to build the runner.

Configs

Components

  • Algorithms

  • Distillers

  • Mutators

  • Mutables

  • Hooks

Improvements

  • Support mixed precision training of all the models. However, some models may got Nan results due to some numerical issues. We will update the documentation and list their results (accuracy of failure) of mixed precision training.

Bug Fixes

  • AutoSlim: Models of different sizes will no longer have the same size checkpoint

Ongoing changes

  • Quantization: We are developing the basic interface of PTQ and QAT. RFC(Request for Comments) will be released soon.

  • AutoSlim: AutoSlim is not yet available and is being refactored.

  • Fx Pruning Tracer: Currently, the model topology can only be resolved through the backward tracer. In the future, both backward tracer and fx tracer will be supported.

  • More Algorithms: BigNAS、AutoFormer、GreedyNAS and Resrep will be released in the next few versions.

  • Documentation: we will add more design docs, tutorials, and migration guidance so that the community can deep dive into our new design, participate the future development, and smoothly migrate downstream libraries to MMRazor 1.x.

Contributors

A total of 13 developers contributed to this release. Thanks @FreakieHuang @gaoyang07 @HIT-cwh @humu789 @LKJacky @pppppM @pprp @spynccat @sunnyxiaohu @wilxy @wutongshenqiu @NickYangMin @Hiwyl Special thanks to @Davidgzx for his contribution to the data-free distillation algorithms

Read the Docs v: latest
Versions
latest
stable
v1.0.0
v1.0.0rc2
v1.0.0rc1
v1.0.0rc0
v0.3.1
v0.3.0
v0.2.0
quantize
main
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.