mirror of
https://github.com/open-mmlab/mmrazor.git
synced 2025-06-03 15:02:54 +08:00
* add ChannelGroup (#250) * rebase new dev-1.x * modification for adding config_template * add docstring to channel_group.py * add docstring to mutable_channel_group.py * rm channel_group_cfg from Graph2ChannelGroups * change choice type of SequentialChannelGroup from float to int * add a warning about group-wise conv * restore __init__ of dynamic op * in_channel_mutable -> mutable_in_channel * rm abstractproperty * add a comment about VT * rm registry for ChannelGroup * MUTABLECHANNELGROUP -> ChannelGroupType * refine docstring of IndexDict * update docstring * update docstring * is_prunable -> is_mutable * update docstring * fix error in pre-commit * update unittest * add return type * unify init_xxx apit * add unitest about init of MutableChannelGroup * update according to reviews * sequential_channel_group -> sequential_mutable_channel_group Co-authored-by: liukai <liukai@pjlab.org.cn> * Add BaseChannelMutator and refactor Autoslim (#289) * add BaseChannelMutator * add autoslim * tmp * make SequentialMutableChannelGroup accpeted both of num and ratio as choice. and supports divisior * update OneShotMutableChannelGroup * pass supernet training of autoslim * refine autoslim * fix bug in OneShotMutableChannelGroup * refactor make_divisible * fix spell error: channl -> channel * init_using_backward_tracer -> init_from_backward_tracer init_from_fx_tracer -> init_from_fx_tracer * refine SequentialMutableChannelGroup * let mutator support models with dynamicop * support define search space in model * tracer_cfg -> parse_cfg * refine * using -> from * update docstring * update docstring Co-authored-by: liukai <liukai@pjlab.org.cn> * tmpsave * migrate ut * tmpsave2 * add loss collector * refactor slimmable and add l1-norm (#291) * refactor slimmable and add l1-norm * make l1-norm support convnd * update get_channel_groups * add l1-norm_resnet34_8xb32_in1k.py * add pretrained to resnet34-l1 * remove old channel mutator * BaseChannelMutator -> ChannelMutator * update according to reviews * add readme to l1-norm * MBV2_slimmable -> MBV2_slimmable_config Co-authored-by: liukai <liukai@pjlab.org.cn> * update config * fix md & pytorch support <1.9.0 in batchnorm init * Clean old codes. (#296) * remove old dynamic ops * move dynamic ops * clean old mutable_channels * rm OneShotMutableChannel * rm MutableChannel * refine * refine * use SquentialMutableChannel to replace OneshotMutableChannel * refactor dynamicops folder * let SquentialMutableChannel support float Co-authored-by: liukai <liukai@pjlab.org.cn> * fix ci * ci fix py3.6.x & add mmpose * ci fix py3.6.9 in utils/index_dict.py * fix mmpose * minimum_version_cpu=3.7 * fix ci 3.7.13 * fix pruning &meta ci * support python3.6.9 * fix py3.6 import caused by circular import patch in py3.7 * fix py3.6.9 * Add channel-flow (#301) * base_channel_mutator -> channel_mutator * init * update docstring * allow omitting redundant configs for channel * add register_mutable_channel_to_a_module to MutableChannelContainer * update according to reviews 1 * update according to reviews 2 * update according to reviews 3 * remove old docstring * fix error * using->from * update according to reviews * support self-define input channel number * update docstring * chanenl -> channel_elem Co-authored-by: liukai <liukai@pjlab.org.cn> Co-authored-by: jacky <jacky@xx.com> * support >=3.7 * support py3.6.9 * Rename: ChannelGroup -> ChannelUnit (#302) * refine repr of MutableChannelGroup * rename folder name * ChannelGroup -> ChannelUnit * filename in units folder * channel_group -> channel_unit * groups -> units * group -> unit * update * get_mutable_channel_groups -> get_mutable_channel_units * fix bug * refine docstring * fix ci * fix bug in tracer Co-authored-by: liukai <liukai@pjlab.org.cn> * update new channel config format * update pruning refactor * update merged pruning * update commit * fix dynamic_conv_mixin * update comments: readme&dynamic_conv_mixins.py * update readme * move kl softmax channel pooling to op by comments * fix comments: fix redundant & split README.md * dcff in ItePruneAlgorithm * partial dynamic params for fuseconv * add step_freq & prune_time check * update comments * update comments * update comments * fix ut * fix gpu ut & revise step_freq in ItePruneAlgorithm * update readme * revise ItePruneAlgorithm * fix docs * fix dynamic_conv attr * fix ci Co-authored-by: LKJacky <108643365+LKJacky@users.noreply.github.com> Co-authored-by: liukai <liukai@pjlab.org.cn> Co-authored-by: zengyi.vendor <zengyi.vendor@sensetime.com> Co-authored-by: jacky <jacky@xx.com>
194 lines
6.6 KiB
YAML
194 lines
6.6 KiB
YAML
version: 2.1
|
|
|
|
# the default pipeline parameters, which will be updated according to
|
|
# the results of the path-filtering orb
|
|
parameters:
|
|
lint_only:
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
lint:
|
|
docker:
|
|
- image: cimg/python:3.7.4
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Install pre-commit hook
|
|
command: |
|
|
pip install pre-commit
|
|
pre-commit install
|
|
- run:
|
|
name: Linting
|
|
command: pre-commit run --all-files
|
|
- run:
|
|
name: Check docstring coverage
|
|
command: |
|
|
pip install interrogate
|
|
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-magic --ignore-regex "__repr__" --fail-under 80 mmrazor
|
|
build_cpu:
|
|
parameters:
|
|
# The python version must match available image tags in
|
|
# https://circleci.com/developer/images/image/cimg/python
|
|
python:
|
|
type: string
|
|
torch:
|
|
type: string
|
|
torchvision:
|
|
type: string
|
|
docker:
|
|
- image: cimg/python:<< parameters.python >>
|
|
resource_class: large
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Install Libraries
|
|
command: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx libjpeg-dev zlib1g-dev libtinfo-dev libncurses5
|
|
- run:
|
|
name: Configure Python & pip
|
|
command: |
|
|
pip install --upgrade pip
|
|
pip install wheel
|
|
- run:
|
|
name: Install PyTorch
|
|
command: |
|
|
python -V
|
|
pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
|
- when:
|
|
condition:
|
|
equal: ["3.9.0", << parameters.python >>]
|
|
steps:
|
|
- run: pip install "protobuf <= 3.20.1" && sudo apt-get update && sudo apt-get -y install libprotobuf-dev protobuf-compiler cmake
|
|
- run:
|
|
name: Install mmrazor dependencies
|
|
command: |
|
|
pip install git+https://github.com/open-mmlab/mmengine.git@main
|
|
pip install -U openmim
|
|
mim install 'mmcv >= 2.0.0rc1'
|
|
pip install git+https://github.com/open-mmlab/mmclassification.git@dev-1.x
|
|
pip install git+https://github.com/open-mmlab/mmdetection.git@dev-3.x
|
|
pip install git+https://github.com/open-mmlab/mmsegmentation.git@dev-1.x
|
|
python -m pip install git+ssh://git@github.com/open-mmlab/mmpose.git@dev-1.x
|
|
pip install -r requirements.txt
|
|
- run:
|
|
name: Build and install
|
|
command: |
|
|
pip install -e .
|
|
- run:
|
|
name: Run unittests
|
|
command: |
|
|
coverage run --branch --source mmrazor -m pytest tests/
|
|
coverage xml
|
|
coverage report -m
|
|
build_cuda:
|
|
parameters:
|
|
torch:
|
|
type: string
|
|
cuda:
|
|
type: enum
|
|
enum: ["10.1", "10.2", "11.1"]
|
|
cudnn:
|
|
type: integer
|
|
default: 7
|
|
machine:
|
|
image: ubuntu-2004-cuda-11.4:202110-01
|
|
# docker_layer_caching: true
|
|
resource_class: gpu.nvidia.small
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
# Cloning repos in VM since Docker doesn't have access to the private key
|
|
name: Clone Repos
|
|
command: |
|
|
git clone -b main --depth 1 https://github.com/open-mmlab/mmengine.git /home/circleci/mmengine
|
|
git clone -b dev-3.x --depth 1 https://github.com/open-mmlab/mmdetection.git /home/circleci/mmdetection
|
|
git clone -b dev-1.x --depth 1 https://github.com/open-mmlab/mmclassification.git /home/circleci/mmclassification
|
|
git clone -b dev-1.x --depth 1 https://github.com/open-mmlab/mmsegmentation.git /home/circleci/mmsegmentation
|
|
- run:
|
|
name: Build Docker image
|
|
command: |
|
|
docker build .circleci/docker -t mmrazor:gpu --build-arg PYTORCH=<< parameters.torch >> --build-arg CUDA=<< parameters.cuda >> --build-arg CUDNN=<< parameters.cudnn >>
|
|
docker run --gpus all -t -d -v /home/circleci/project:/mmrazor -v /home/circleci/mmengine:/mmengine -v /home/circleci/mmdetection:/mmdetection -v /home/circleci/mmclassification:/mmclassification -v /home/circleci/mmsegmentation:/mmsegmentation -w /mmrazor --name mmrazor mmrazor:gpu
|
|
- run:
|
|
name: Install mmrazor dependencies
|
|
command: |
|
|
docker exec mmrazor pip install -e /mmengine
|
|
docker exec mmrazor pip install -U openmim
|
|
docker exec mmrazor mim install 'mmcv >= 2.0.0rc1'
|
|
docker exec mmrazor pip install -e /mmdetection
|
|
docker exec mmrazor pip install -e /mmclassification
|
|
docker exec mmrazor pip install -e /mmsegmentation
|
|
docker exec mmrazor pip install -r requirements.txt
|
|
- run:
|
|
name: Build and install
|
|
command: |
|
|
docker exec mmrazor pip install -e .
|
|
- run:
|
|
name: Run unittests
|
|
command: |
|
|
docker exec mmrazor pytest tests/
|
|
|
|
workflows:
|
|
pr_stage_lint:
|
|
when: << pipeline.parameters.lint_only >>
|
|
jobs:
|
|
- lint:
|
|
name: lint
|
|
filters:
|
|
branches:
|
|
ignore:
|
|
- dev-1.x
|
|
- 1.x
|
|
pr_stage_test:
|
|
when:
|
|
not: << pipeline.parameters.lint_only >>
|
|
jobs:
|
|
- lint:
|
|
name: lint
|
|
filters:
|
|
branches:
|
|
ignore:
|
|
- dev-1.x
|
|
- build_cpu:
|
|
name: minimum_version_cpu
|
|
torch: 1.6.0
|
|
torchvision: 0.7.0
|
|
python: 3.6.9 # The lowest python 3.6.x version available on CircleCI images
|
|
requires:
|
|
- lint
|
|
- build_cpu:
|
|
name: maximum_version_cpu
|
|
torch: 1.12.1
|
|
torchvision: 0.13.1
|
|
python: 3.9.0
|
|
requires:
|
|
- lint
|
|
- hold:
|
|
type: approval
|
|
requires:
|
|
- maximum_version_cpu
|
|
- build_cuda:
|
|
name: mainstream_version_gpu
|
|
torch: 1.8.1
|
|
# Use double quotation mark to explicitly specify its type
|
|
# as string instead of number
|
|
cuda: "10.2"
|
|
requires:
|
|
- hold
|
|
merge_stage_test:
|
|
when:
|
|
not: << pipeline.parameters.lint_only >>
|
|
jobs:
|
|
- build_cuda:
|
|
name: minimum_version_gpu
|
|
torch: 1.6.0
|
|
# Use double quotation mark to explicitly specify its type
|
|
# as string instead of number
|
|
cuda: "10.1"
|
|
filters:
|
|
branches:
|
|
only:
|
|
- dev-1.x
|