Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

identity_mask_propagation issue while trying to prune yolov5 #715

Open
abuvaneswari opened this issue May 18, 2021 · 6 comments
Open

identity_mask_propagation issue while trying to prune yolov5 #715

abuvaneswari opened this issue May 18, 2021 · 6 comments
Assignees

Comments

@abuvaneswari
Copy link

abuvaneswari commented May 18, 2021

Hello,
I am trying to prune yolov5 model and my env is as follows:
torch==1.8.1
torchvision==0.9.1
nncf==1.7.1
Python 3.6.8
No CUDA
While the sparsity compression works fine, filter pruning does not work. I get the following error message:

INFO:nncf:Computing filter importance scores and binary masks...
Traceback (most recent call last):
File "train.nncf.py", line 539, in
train(hyp, opt, device, tb_writer, wandb)
File "train.nncf.py", line 246, in train
compression_ctrl, compressed_model = create_compressed_model(model, nncf_config)
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/model_creation.py", line 124, in create_compressed_model
compression_ctrl = composite_builder.build_controller(compressed_model)
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/composite_compression.py", line 94, in build_controller
return self._child_builders[0].build_controller(model)
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/pruning/filter_pruning/algo.py", line 66, in build_controller
self.config)
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/pruning/filter_pruning/algo.py", line 108, in init
self.set_pruning_rate(self.pruning_init)
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/pruning/filter_pruning/algo.py", line 336, in set_pruning_rate
self._apply_masks()
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/pruning/filter_pruning/algo.py", line 537, in _apply_masks
MaskPropagationAlgorithm(graph, PT_PRUNING_OPERATOR_METATYPES).mask_propagation()
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/common/pruning/mask_propagation.py", line 62, in mask_propagation
cls.mask_propagation(node, self._graph)
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/pruning/export_helpers.py", line 144, in mask_propagation
identity_mask_propagation(node, graph)
File "/home/tfs/venv_nncf/lib/python3.6/site-packages/nncf/common/pruning/mask_propagation.py", line 80, in identity_mask_propagation
assert len(input_masks) == 1
AssertionError

I will share a zip of the directory with files.

To reproduce this error:

  1. please populate the coco directory with coco dataset (untarred). Alternatively, modify the data/coco.yaml file as per your training data location.
  2. pip install -r requirements.txt
  3. train.nncf.py --data data/coco.yaml --cfg yolov5s.yaml --weights yolov5s.pt --batch-size 64
@abuvaneswari
Copy link
Author

@abuvaneswari
Copy link
Author

Download the yolov5s.pt from here and place it in the main directory:
https://github.com/ultralytics/yolov5/releases/download/v3.0/yolov5s.pt

@vshampor
Copy link
Contributor

@AlexanderDokuchaev
Copy link
Collaborator

Hi @abuvaneswari
Thanks for raising this issue with detailed description and code to reproduce.
Yes, there is problem with working on yolov5. We will soon fix this one.

@KrishnaKishore123
Copy link

Hi @AlexanderDokuchaev
I have faced the same issue recently. Any update from you on this?

@MaximProshin
Copy link
Collaborator

@daniil-lyakhov FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants