Open aidevmin opened 11 months ago
I had a similar issue and solved it by putting the model in eval() and passing dummy input through it once, before doing pruning.
@MarkusDrange Thank you so much for suggestion. I am going to try it later. Instead of using nni, I used torch-pruning. Could you share experience with pruning yolov7 by using NNI? Is the tradeoff between mAP and speed good?
@MarkusDrange
Can you save pruned yolov7 model by using torch.save(model, <path-to-save>)
?
Sorry, I am not really working on an identical case, I am working on tracing a yolov8 model and just mentioned the solution as the error message I got was very similar to yours.
A possible fix there could be that due to the fact that the yolov7 model possibly also has a hierarchy of classes (as my yolov8 has), model.model is the actual model that you want to save.
@MarkusDrange Thanks. I have one more question. Could you finetuning with multiple GPUs after pruning?
I had a similar issue and solved it by putting the model in eval() and passing dummy input through it once, before doing pruning.我有一个类似的问题,并通过将模型放入eval()中并在进行修剪之前传递一次虚拟输入来解决它。
Can you share the implementation code
Sorry, I am not really working on an identical case, I am working on tracing a yolov8 model and just mentioned the solution as the error message I got was very similar to yours.
A possible fix there could be that due to the fact that the yolov7 model possibly also has a hierarchy of classes (as my yolov8 has), model.model is the actual model that you want to save.
I followed your approach but still made the same mistake. Can you share this implementation code?
Describe the issue: I prune yolov7 model with L1Pruner. I followed this guide https://github.com/microsoft/nni/blob/master/examples/compression/pruning/norm_pruning.py . I added this code after this line https://github.com/WongKinYiu/yolov7/blob/84932d70fb9e2932d0a70e4a1f02a1d6dd1dd6ca/train.py#L100
But I got this error
This error encounter also with
L2NormPruner
andFPGMPruner
. I attached log file. pruning_l1norm.log. @J-shang @ultmaster please help me.Environment:
Configuration:
Log message:
How to reproduce it?:
train.py
as in the above describing part.