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 · 1 comment · Fixed by #8284
Closed
1 task done

How to use DDP? #8283

Zhiying-Li-dot opened this issue Jun 21, 2022 · 1 comment · 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 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