nni
nni copied to clipboard
borken when ModelSpeedup
borken when ModelSpeedup:
Ubuntu20:
- NNI version:2.7
- Training service (local|remote|pai|aml|etc):local
- Client OS:
- Server OS (for remote mode only):
- Python version:3.7
- PyTorch/TensorFlow version:PyTorch 1.11.0
- Is conda/virtualenv/venv used?:conda
- Is running in Docker?:No
Configuration:
- Experiment config (remember to remove secrets!):
- Search space:
Log message:
nnimanager.log:
Traceback (most recent call last): File "lib/prune_gssl.py", line 137, in
ModelSpeedup(model, torch.rand(3, 3, cfg.input_size, cfg.input_size).to(device), "./prune_model/mask.pth").speedup_model() File "/home/inspur/Projects/nni/nni/compression/pytorch/speedup/compressor.py", line 512, in speedup_model self.infer_modules_masks() File "/home/inspur/Projects/nni/nni/compression/pytorch/speedup/compressor.py", line 355, in infer_modules_masks self.update_direct_sparsity(curnode) File "/home/inspur/Projects/nni/nni/compression/pytorch/speedup/compressor.py", line 237, in update_direct_sparsity node.outputs) == 1, 'The number of the output should be one after the Tuple unpacked manually' AssertionError: The number of the output should be one after the Tuple unpacked manually
- dispatcher.log:
- nnictl stdout and stderr:
How to reproduce it?: below is my forward code
def forward(self, x): x = self.conv1(x) x = self.bn1(x) x = F.relu(x) x = self.maxpool(x) x = self.layer1(x) x = self.layer2(x) x = self.layer3(x) x = self.layer4(x) cls1 = self.cls_layer(x) offset_x = self.x_layer(x) offset_y = self.y_layer(x) nb_x = self.nb_x_layer(x) nb_y = self.nb_y_layer(x) x = self.my_maxpool(x) cls2 = self.cls_layer(x) x = self.my_maxpool(x) cls3 = self.cls_layer(x) return cls1, cls2, cls3, offset_x, offset_y, nb_x, nb_y
"cls1, cls2, cls3" are produced by the same layer(cls_layer), when return cls1, cls2, cls3, error comes up, when return one of them, error is gone
below is self.my_maxpool
self.my_maxpool = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)
reproduced. It's an error in our graph-representation tool that it assumes each node has only one output node. we are going to resolve it in 2.9.1 or 3.0.
Hi, I have install nni version 2.10 and I am facing the same problem