Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

assert len(set(num_channels_list)) == 1 #4160

Open
jxncyym opened this issue Sep 7, 2021 · 17 comments
Open

assert len(set(num_channels_list)) == 1 #4160

jxncyym opened this issue Sep 7, 2021 · 17 comments
Assignees
Labels

Comments

@jxncyym
Copy link

jxncyym commented Sep 7, 2021

Describe the issue:
I compress the model: https://github.com/chenjun2hao/DDRNet.pytorch

when add this code "pruner._unwrap_model()", meet the error

Traceback (most recent call last):
File "/algdata02/yiming.yu/DDRNet.pytorch_pruner/tools/pruner_nni_L1filter.py", line 142, in
main()
File "/algdata02/yiming.yu/DDRNet.pytorch_pruner/tools/pruner_nni_L1filter.py", line 130, in main
m_speedup.speedup_model()
File "/algdata02/yiming.yu/DDRNet.pytorch_pruner/envp_3/lib/python3.6/site-packages/nni/compression/pytorch/speedup/compressor.py", line 500, in speedup_model
fix_mask_conflict(self.masks, self.bound_model, self.dummy_input)
File "/algdata02/yiming.yu/DDRNet.pytorch_pruner/envp_3/lib/python3.6/site-packages/nni/compression/pytorch/utils/mask_conflict.py", line 50, in fix_mask_conflict
masks = fix_channel_mask.fix_mask()
File "/algdata02/yiming.yu/DDRNet.pytorch_pruner/envp_3/lib/python3.6/site-packages/nni/compression/pytorch/utils/mask_conflict.py", line 259, in fix_mask
assert len(set(num_channels_list)) == 1
AssertionError

Environment:

  • NNI version:2.4
  • Training service (local|remote|pai|aml|etc):
  • Client OS: window
  • Server OS (for remote mode only):unbuntu 18
  • Python version:3.6
  • PyTorch/TensorFlow version:pytorch 1.7.1
  • Is conda/virtualenv/venv used?:virtualenv
  • Is running in Docker?:no

Configuration:

  • Experiment config (remember to remove secrets!): L1FilterPruner config_list = [{ 'sparsity': 0.7, 'op_types': ['Conv2d'] }]
  • Search space:

Log message:

  • nnimanager.log:
  • dispatcher.log:
  • nnictl stdout and stderr:

How to reproduce it?:

@flyingmrwang
Copy link

the same for speedup pruned ghostnet, and the num channels are 16 and 1

@J-shang
Copy link
Contributor

J-shang commented Sep 9, 2021

Hi @jxncyym @flyingmrwang ,
If possible, could you provide the model and pruning code for our reproduction?

@jxncyym
Copy link
Author

jxncyym commented Sep 9, 2021

@J-shang the latest code refer to :https://pan.baidu.com/s/19xoJOC9yaD3E6-RkZkOf9Q,g4og

@J-shang
Copy link
Contributor

J-shang commented Sep 9, 2021

This dependency set leads to error, but from the model structure, it seems that they should not be in the same group.

{'spp.scale2.3': 128, 'spp.scale4.3': 128, 'spp.scale0.2': 128, 'layer5.0.conv3': 512, 'spp.process1.2': 128, 'layer5.0.downsample.0': 512, 'spp.process2.2': 128, 'spp.scale1.3': 128, 'spp.scale3.3': 128, 'spp.process3.2': 128}

line 174 in ddrnet_23_slim.py
out = self.compression(torch.cat(x_list, 1)) + self.shortcut(x)

Seems the dependency is related to this line.

@zheng-ningxin please help to look into this issue.

@jxncyym
Copy link
Author

jxncyym commented Sep 15, 2021

Is there any progress @zheng-ningxin @J-shang

@zheng-ningxin
Copy link
Contributor

The size operation on the graph misleads the model topology analysis.
image

@jxncyym
Copy link
Author

jxncyym commented Sep 17, 2021

then how to solve this problem?@zheng-ningxin

@zheng-ningxin
Copy link
Contributor

I'll submit a PR to fix this ASAP. I'll let you know when this pr merged. Thanks!

@vinhtq115
Copy link

I'll submit a PR to fix this ASAP. I'll let you know when this pr merged. Thanks!

Have you been able to fix this? I have the same issue with YOLOv5-Face yolov5n-0.5 model.

@HappyPeanuts
Copy link

I have meet the same problem:'assert len(set(num_channels_list)) == 1' when i try to prune my model DLASeg, i want to know how to resove it~ thanks a lot

@HappyPeanuts
Copy link

I'll submit a PR to fix this ASAP. I'll let you know when this pr merged. Thanks!

Hi, have you resolved this problem? I have meet the same error and I guess it was caused by the use of DCNv2. I want to now how to resolve this problem. Thanks ~

@zheng-ningxin
Copy link
Contributor

@HappyPeanuts Sincerely sorry for the late PR, already working on this pr and need some time. Thanks~

@HappyPeanuts
Copy link

HappyPeanuts commented Feb 28, 2022 via email

@HK017
Copy link

HK017 commented May 30, 2022

@zheng-ningxin,hello, What does this code assert len(set(num_channels_list)) == 1 mean for me to examine my own model structure? thanks

@dianxin556
Copy link

I also meet the same problem , so how to solve it?

1 similar comment
@dreamlychina
Copy link

I also meet the same problem , so how to solve it?

@J-shang
Copy link
Contributor

J-shang commented Dec 15, 2022

hello @dianxin556 @dreamlychina , could you show your model for us to reproduce your issue? This problem is highly related to the model structure.

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

No branches or pull requests

10 participants