-
Notifications
You must be signed in to change notification settings - Fork 234
Description
Describe the bug
A clear and concise description of what the bug is.
when code run try_prune function in group_fisher/mutator.py show the IndexError: from sefl.mutable_units[0].
I check the sefl.mutable_units length is zero. But I don't know where to set sefl.mutable_units and why its zero.
To Reproduce
The group_fisher_act_prune.py
#############################################################################
base = 'mmdet::/RTMDet_M_group_fisher/RTMDet_ins_M.py'
pretrained_path = '/root/xxxx/best_coco_bbox_mAP_epoch_580.pth' # noqa
interval = 10
normalization_type = 'act'
lr_ratio = 0.1
target_flop_ratio = 0.5
input_shape = (1, 6, 960, 960)
##############################################################################
architecture = base.model
if hasattr(base, 'data_preprocessor'):
architecture.update({'data_preprocessor': base.data_preprocessor})
data_preprocessor = {}
architecture.init_cfg = dict(type='Pretrained', checkpoint=pretrained_path)
architecture['scope'] = base.default_scope
architecture.backbone.frozen_stages = -1
model = dict(
delete=True,
scope='mmrazor',
type='GroupFisherAlgorithm',
architecture=architecture,
interval=interval,
mutator=dict(
type='GroupFisherChannelMutator',
parse_cfg=dict(type='ChannelAnalyzer', demo_input=input_shape, tracer_type='FxTracer'),
channel_unit_cfg=dict(
type='GroupFisherChannelUnit',
default_args=dict(normalization_type=normalization_type, ),
),
),
)
model_wrapper_cfg = dict(
type='mmrazor.GroupFisherDDP',
broadcast_buffers=False,
)
optim_wrapper = dict(
optimizer=dict(lr=base.optim_wrapper.optimizer.lr * lr_ratio))
custom_hooks = getattr(base, 'custom_hooks', []) + [
dict(type='mmrazor.PruningStructureHook'),
dict(
type='mmrazor.ResourceInfoHook',
interval=interval,
demo_input=dict(
type='mmrazor.DefaultDemoInput',
input_shape=input_shape,
),
save_ckpt_thr=[target_flop_ratio],
),
]
Post related information
- The output of
pip list | grep "mmcv\|mmrazor\|^torch"
[here] - Your config file if you modified it or created a new one.
Package Version Editable project location
------------------------ ------------ --------------------------
addict 2.4.0
aenum 3.1.15
albucore 0.0.15
albumentations 1.3.0
aliyun-python-sdk-core 2.14.0
aliyun-python-sdk-kms 2.16.2
annotated-types 0.7.0
appdirs 1.4.4
certifi 2022.12.7
cffi 1.16.0
charset-normalizer 2.1.1
click 8.1.7
cmake 3.25.0
colorama 0.4.6
contourpy 1.2.0
crcmod 1.7
cryptography 42.0.0
cycler 0.12.1
dill 0.3.8
docker-pycreds 0.4.0
einops 0.7.0
eval_type_backport 0.2.0
filelock 3.9.0
flatbuffers 23.5.26
fonttools 4.47.2
fsspec 2023.4.0
gitdb 4.0.11
GitPython 3.1.41
grpcio 1.60.0
h5py 3.10.0
idna 3.4
imageio 2.35.1
importlib-metadata 7.0.1
importlib-resources 6.1.1
Jinja2 3.1.2
jmespath 0.10.0
joblib 1.4.2
kiwisolver 1.4.5
lazy_loader 0.4
lit 15.0.7
Mako 1.3.0
Markdown 3.5.2
markdown-it-py 3.0.0
MarkupSafe 2.1.3
mat4py 0.6.0
matplotlib 3.8.2
mdurl 0.1.2
mkl-fft 1.3.8
mkl-random 1.2.4
mkl-service 2.4.0
mmcv 2.0.0 /root/louis/mm/MMCV
mmdet 3.1.0 /root/louis/mm/mmdetection
mmengine 0.8.4 /root/louis/mm/MMengine
mmrazor 1.0.0 /root/louis/mm/mmrazor
model-index 0.1.11
modelindex 0.0.2
mpmath 1.3.0
multiprocess 0.70.16
networkx 3.0
ninja 1.11.1.1
numpy 1.26.3
nvidia-cublas-cu11 11.11.3.6
nvidia-cuda-cupti-cu11 11.8.87
nvidia-cuda-nvrtc-cu11 11.8.89
nvidia-cuda-runtime-cu11 11.8.89
nvidia-cudnn-cu11 8.7.0.84
nvidia-cufft-cu11 10.9.0.58
nvidia-curand-cu11 10.3.0.86
nvidia-cusolver-cu11 11.4.1.48
nvidia-cusparse-cu11 11.7.5.86
nvidia-nccl-cu11 2.19.3
nvidia-nvtx-cu11 11.8.86
onnx 1.15.0
onnxruntime 1.8.1
opencv-python 4.9.0.80
opencv-python-headless 4.10.0.84
opendatalab 0.0.10
openmim 0.3.9
openxlab 0.0.34
ordered-set 4.1.0
oss2 2.17.0
packaging 23.2
pandas 2.2.0
Pillow 9.3.0
pip 23.3.1
platformdirs 4.1.0
prettytable 3.9.0
protobuf 3.20.2
psutil 5.9.8
pycocotools 2.0.7
pycparser 2.21
pycryptodome 3.20.0
pycuda 2024.1
pydantic 2.9.2
pydantic_core 2.23.4
Pygments 2.17.2
pyparsing 3.1.1
python-dateutil 2.8.2
python-memcached 1.62
pytools 2023.1.1
pytz 2023.3.post1
PyYAML 6.0.1
qudida 0.0.4
requests 2.28.2
rich 13.4.2
scikit-image 0.24.0
scikit-learn 1.5.2
scipy 1.12.0
sentry-sdk 1.39.2
setproctitle 1.3.3
setuptools 60.2.0
shapely 2.0.2
six 1.16.0
smmap 5.0.1
sympy 1.12
tabulate 0.9.0
tensorrt 8.6.1
termcolor 2.4.0
terminaltables 3.1.10
threadpoolctl 3.5.0
tifffile 2024.8.30
tomli 2.0.1
torch 2.0.0+cu118
torchaudio 2.0.1+cu118
torchvision 0.15.1+cu118
tqdm 4.65.2
triton 2.0.0
typing_extensions 4.12.2
tzdata 2023.4
urllib3 1.26.13
wandb 0.16.2
wcwidth 0.2.13
wheel 0.41.2
yapf 0.40.1
zipp 3.17.0
- Your train log file if you meet the problem during training.
Traceback (most recent call last):
File "/root/louis/mm/mmrazor/tools/train.py", line 121, in
main()
File "/root/louis/mm/mmrazor/tools/train.py", line 117, in main
runner.train()
File "/root/louis/mm/MMengine/mmengine/runner/runner.py", line 1755, in train
model = self.train_loop.run() # type: ignore
File "/root/louis/mm/MMengine/mmengine/runner/loops.py", line 97, in run
self.run_epoch()
File "/root/louis/mm/MMengine/mmengine/runner/loops.py", line 113, in run_epoch
self.run_iter(idx, data_batch)
File "/root/louis/mm/MMengine/mmengine/runner/loops.py", line 129, in run_iter
outputs = self.runner.model.train_step(
File "/root/louis/mm/mmrazor/mmrazor/implementations/pruning/group_fisher/algorithm.py", line 61, in train_step
return self._train_step(data, optim_wrapper)
File "/root/louis/mm/mmrazor/mmrazor/implementations/pruning/group_fisher/algorithm.py", line 73, in _train_step
self.mutator.try_prune()
File "/root/louis/mm/mmrazor/mmrazor/implementations/pruning/group_fisher/mutator.py", line 60, in try_prune
min_unit = self.mutable_units[0]
IndexError: list index out of range - Other code you modified in the
mmrazor
folder.
[here]
Additional context
Add any other context about the problem here.
[here]