Closed RizwanMunawar closed 2 years ago
@RizwanMunawar I just re-ran the Pruning/Sparsity tutorial and everything works correctly. I updated it to current master branch and results. See https://docs.ultralytics.com/yolov5/tutorials/model_pruning_and_sparsity
@RizwanMunawar BTW there may be better methods for pruning PyTorch models including QAT that we have not had time to investigate. If you find better implementations please let us know so we can update the tutorial.
Thanks @glenn-jocher
π Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 π resources:
Access additional Ultralytics β‘ resources:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLOv5 π and Vision AI β!
Search before asking
- [x] I have searched the YOLOv5 issues and found no similar bug report.
YOLOv5 Component
Other
Bug
I want to prune yolov5m custom trained. I followed yolov5 pruning/sparsity tutorial. When I implemented this, I face below mentioned error,
"ZeroDivisionError: division by zero"
Environment
YOLO : Yolov5 OS : Ubuntu 20.04 Python : python 3.7
Minimal Reproducible Example
I have called below mentioned code, after model load in val.py.
if training: # called by train.py device, pt, jit, engine = next(model.parameters()).device, True, False, False # get model device, PyTorch model half &= device.type != 'cpu' # half precision only supported on CUDA model.half() if half else model.float() else: # called directly device = select_device(device, batch_size=batch_size) `from utils.torch_utils import prune` ------------------------------> Pruning--------------------- `prune(model,0.3)` # Directories save_dir = increment_path(Path(project) / name, exist_ok=exist_ok) # increment run (save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True) # make dir # Load model model = DetectMultiBackend(weights, device=device, dnn=dnn)
Additional
No response
Are you willing to submit a PR?
- [ ] Yes I'd like to help by submitting a PR!
Hi @RizwanMunawar, I have successfully pruned YOLOv5 of multiple scales. Maybe you can also refer to https://github.com/HankYe/PAGCP to get more helpful information. Hope my experiences can give you some help.
Search before asking
YOLOv5 Component
Other
Bug
I want to prune yolov5m custom trained. I followed yolov5 pruning/sparsity tutorial. When I implemented this, I face below mentioned error,
"ZeroDivisionError: division by zero"
Environment
YOLO : Yolov5 OS : Ubuntu 20.04 Python : python 3.7
Minimal Reproducible Example
I have called below mentioned code, after model load in val.py.
Additional
No response
Are you willing to submit a PR?