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

yolov5 resrep剪枝 #22

Open
Wq-dd opened this issue Aug 14, 2023 · 5 comments
Open

yolov5 resrep剪枝 #22

Wq-dd opened this issue Aug 14, 2023 · 5 comments
Labels
question Further information is requested

Comments

@Wq-dd
Copy link

Wq-dd commented Aug 14, 2023

使用resrep对yolov5l, yolov5m剪枝,网络无法训练,一开始就就不收敛直接变nan。

@gdh1995
Copy link
Collaborator

gdh1995 commented Aug 17, 2023

不确定,我自己没在这上边训练过。用了预训练模型吗?不用 resrep 的时候能训练不

@Wq-dd
Copy link
Author

Wq-dd commented Aug 23, 2023

没用预训练模型,不用resrep可以收敛。

@gdh1995
Copy link
Collaborator

gdh1995 commented Aug 27, 2023

刚开始训练的时候不适合剪枝;可以调参数,增大 warmup_epoch(前多少轮不剪),prune_interval(单位是 iter不是epoch)也可以改大点

@gdh1995 gdh1995 added the question Further information is requested label Aug 27, 2023
@Wq-dd
Copy link
Author

Wq-dd commented Aug 28, 2023

还有个问题,就是我发现载剪枝训练过程中某些层通道被剪完了,然后就会报错。有什么方法可以设置每层最低保留的通道数吗?

@gdh1995
Copy link
Collaborator

gdh1995 commented Sep 9, 2023

目前没有吧。它确实有可能每次剪枝都找到同一个层,你可以自己加,在算 lasso 那块
torchslim/pruning/resrep.py: def prune_model(...): index = np.argsort(lasso_value)

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

No branches or pull requests

2 participants