DDP config error fix (#578)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pull/592/head
Glenn Jocher 2 years ago committed by GitHub
parent d6a4ffb778
commit e9ab157330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      ultralytics/yolo/utils/__init__.py
  2. 4
      ultralytics/yolo/utils/dist.py

@ -446,18 +446,19 @@ def set_sentry():
"""
def before_send(event, hint):
if is_git_dir() and get_git_origin_url() != "https://github.com/ultralytics/ultralytics.git":
return None
event_os = 'colab' if is_colab() else 'kaggle' if is_kaggle() else 'jupyter' if is_jupyter() else \
oss = 'colab' if is_colab() else 'kaggle' if is_kaggle() else 'jupyter' if is_jupyter() else \
'docker' if is_docker() else platform.system()
event['tags'] = {
"sys_argv": sys.argv[0],
"sys_argv_name": Path(sys.argv[0]).name,
"install": 'git' if is_git_dir() else 'pip' if is_pip_package() else 'other',
"os": event_os}
"os": oss}
return event
if SETTINGS['sync'] and not is_pytest_running() or is_github_actions_ci():
if SETTINGS['sync'] and \
not is_pytest_running() and \
not is_github_actions_ci() and \
(is_pip_package() or get_git_origin_url() == "https://github.com/ultralytics/ultralytics.git"):
import sentry_sdk # noqa
import ultralytics

@ -28,10 +28,10 @@ def generate_ddp_file(trainer):
if not trainer.resume:
shutil.rmtree(trainer.save_dir) # remove the save_dir
content = f'''config = {vars(trainer.args)} \nif __name__ == "__main__":
content = f'''cfg = {vars(trainer.args)} \nif __name__ == "__main__":
from ultralytics.{import_path} import {trainer.__class__.__name__}
trainer = {trainer.__class__.__name__}(config=config)
trainer = {trainer.__class__.__name__}(cfg=cfg)
trainer.train()'''
(USER_CONFIG_DIR / 'DDP').mkdir(exist_ok=True)
with tempfile.NamedTemporaryFile(prefix="_temp_",

Loading…
Cancel
Save