-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
Training bug when using --sync_bn
#3754
Comments
👋 Hello @twotwoiscute, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at [email protected]. RequirementsPython 3.8 or later with all requirements.txt dependencies installed, including $ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@twotwoiscute your code is out of date, the opt class no longer carries DDP variables. To update your code:
|
@glenn-jocher Thanks for the suggestion
I found that if I use 4 gpus and the first 3 gpus would have message And this happen after first iteration completed.By the way,sync_bn would only fail if I use multiple gpus, with single gpu everything works perfectly. |
@twotwoiscute ok understood, I will try to reproduce this today. |
@twotwoiscute yes I can reproduce this. I'm not sure what the cause is. In looking at the documentation perhaps we are missing a The convert function is here: Lines 217 to 221 in 3749573
|
I follow the script you mentioned somehing like :
However ,it still does not work ... |
@twotwoiscute I'm not sure if this is due to torch 1.9.0 or our own code, but I don't see anything wrong with the implementation. I would actually not use --sync if I were you though. It mainly helps in early training but we found it to have little to no effect on final mAP (provided you train long enough, i.e. 300 COCO epochs). |
In my case , I have 64 batch size per gpu , I think it's enough for calculating running mean & var correctly . However,for completeness,maybe to let pytorch team to have a look at this issue ? |
@twotwoiscute yes, that's a good idea. I would raise a bug report on the pytorch repo linking to this issue. |
@twotwoiscute --sync known issue PR in #4032 to alert future users to the existing problem |
👋 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 ⭐! |
Have you get any response from pytorch team? I posted the similiar question in PyTorch Forums However, does not get any response.. |
@twotwoiscute we still have no resolution on this issue. If you find anything or hear from the PyTorch team please update here, thank you! |
I think this issue would be solved in current version since the way I solve this issue by commenting out :
And |
@twotwoiscute do you mean you comment out L81 in loggers/init.py? yolov5/utils/loggers/__init__.py Lines 79 to 81 in b894e69
|
@twotwoiscute what about the daemon Thread plots in val.py here? Lines 221 to 227 in b894e69
|
--sync_bn
@glenn-jocher Ops! I think i made a wrong statement.. actually I comment out this part of code :
but keep the ploting part . |
@twotwoiscute I don't think this line correlates with the issue at all. It doesn't actually exist anymore, it's been replaced with loggers/init.py L137 that only runs on the yolov5/utils/loggers/__init__.py Lines 126 to 138 in b894e69
|
@twotwoiscute wait are you saying the line you commented in your comment is uncommented, this line? yolov5/utils/loggers/__init__.py Lines 72 to 78 in b894e69
|
@glenn-jocher okay,last weekend I tried to comment out |
@twotwoiscute ok got it, thanks for the feedback! These are two very different things, add images is just adding images to TensorBoard, add_graph is adding an interactive YOLOv5 model visualizer (below), which is a much more complicated operation. I don't know what it has to do with --sync but if it's causing the hang we can simply not add graphs on --sync trainings as a workaround. |
❔Question
Hi I have a problem with using
convert_sync_batchnorm
,When I was trying to use DDP everything works fine ,but when I turn on the sync_bn mode ,the training process start and get stuck right away…Thanks
The text was updated successfully, but these errors were encountered: