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

How to use DDP? #8283

Closed
1 task done
Zhiying-Li-dot opened this issue Jun 21, 2022 · 2 comments · Fixed by #8284
Closed
1 task done

How to use DDP? #8283

Zhiying-Li-dot opened this issue Jun 21, 2022 · 2 comments · Fixed by #8284
Labels
question Further information is requested

Comments

@Zhiying-Li-dot
Copy link

Search before asking

Question

image
I do not know what should I do. When I run train.py without DDP, it can run, but slowly. So I want to use DDP to speed up. Always display this bug. Could you tell me how to solve this problem? Please.
image
image

Additional

No response

@Zhiying-Li-dot Zhiying-Li-dot added the question Further information is requested label Jun 21, 2022
@glenn-jocher
Copy link
Member

glenn-jocher commented Jun 21, 2022

@AyushExel it looks like we should disable LOGGER for all RANKs except for RANK in (0, -1) to avoid multiple printouts like the AMP check above:

LOGGER.warning(emojis(f'{prefix}checks failed ❌, disabling Automatic Mixed Precision. See {help_url}'))

I think I can do this here:

yolov5/utils/general.py

Lines 82 to 99 in 1156a32

def set_logging(name=None, verbose=VERBOSE):
# Sets level and returns logger
if is_kaggle():
for h in logging.root.handlers:
logging.root.removeHandler(h) # remove all handlers associated with the root logger object
rank = int(os.getenv('RANK', -1)) # rank in world for Multi-GPU trainings
level = logging.INFO if verbose and rank in {-1, 0} else logging.WARNING
log = logging.getLogger(name)
log.setLevel(level)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(message)s"))
handler.setLevel(level)
log.addHandler(handler)
set_logging() # run before defining LOGGER
LOGGER = logging.getLogger("yolov5") # define globally (used in train.py, val.py, detect.py, etc.)

EDIT: Oh, haha I've already done this on L88, this line is just printing out because it's set to warning for non RANK (0, -1) messages. Maybe I should just disable it entirely or set it to logging.ERROR for non RANK(0, -1)?
EDIT2: console output fix implemented in #8284

glenn-jocher added a commit that referenced this issue Jun 21, 2022
Improve DDP console response in #8283
@glenn-jocher glenn-jocher linked a pull request Jun 21, 2022 that will close this issue
@glenn-jocher
Copy link
Member

glenn-jocher commented Jun 21, 2022

@lizhiying-2019 your error doesn't look familiar. For full DDP examples please see our Multi-GPU tutorial below which recommends using our Docker image for all DDP trainings.

If you have a reproducible issue inside our Docker container please let us know with exact commands to reproduce. If we can not reproduce there is no action for us to take.

YOLOv5 Tutorials

How to create a Minimal, Reproducible Example

When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:

  • Minimal – Use as little code as possible to produce the problem
  • Complete – Provide all parts someone else needs to reproduce the problem
  • Reproducible – Test the code you're about to provide to make sure it reproduces the problem

For Ultralytics to provide assistance your code should also be:

  • Current – Verify that your code is up-to-date with GitHub master, and if necessary git pull or git clone a new copy to ensure your problem has not already been solved in master.
  • Unmodified – Your problem must be reproducible using official YOLOv5 code without changes. Ultralytics does not provide support for custom code ⚠️.

If you believe your problem meets all the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template with a minimum reproducible example to help us better understand and diagnose your problem.

Thank you! 😃

glenn-jocher added a commit that referenced this issue Jun 21, 2022
Improve DDP console response in #8283
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this issue Sep 8, 2022
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

Successfully merging a pull request may close this issue.

2 participants