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

Multi-GPU distributed error #9504

Closed
1 task done
MinjeongKim03 opened this issue Sep 20, 2022 · 8 comments · Fixed by #9876
Closed
1 task done

Multi-GPU distributed error #9504

MinjeongKim03 opened this issue Sep 20, 2022 · 8 comments · Fixed by #9876
Labels
question Further information is requested Stale

Comments

@MinjeongKim03
Copy link

MinjeongKim03 commented Sep 20, 2022

Search before asking

Question

Hello I run this command. But I got an error.

terminal command

python -m torch.distributed.run --nproc_per_node 2 train.py --batch 16 --img 640 --epochs 300 --data data/coco.yaml --weights yolov5s.pt --patience 300 --device 0,1 --save-period 1

error
error

Additional

No response

@MinjeongKim03 MinjeongKim03 added the question Further information is requested label Sep 20, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 20, 2022

👋 Hello @MinjeongKim03, 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://ultralytics.com or email support@ultralytics.com.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If 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), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit.

@glenn-jocher
Copy link
Member

glenn-jocher commented Sep 20, 2022

@MinjeongKim03 it appears you may have environment problems. Please ensure you meet all dependency requirements if you are attempting to run YOLOv5 locally. If in doubt, create a new virtual Python 3.9 environment, clone the latest repo (code changes daily), and pip install requirements.txt again from scratch.

💡 ProTip! Try one of our verified environments below if you are having trouble with your local environment.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Models and datasets download automatically from the latest YOLOv5 release when first requested.

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If 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), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

@MinjeongKim03
Copy link
Author

I changed to Python 3.9 environment and tried again, but the following error occurred.

Traceback (most recent call last): File "/home/()/()/yolov5/train.py", line 630, in Traceback (most recent call last): File "/home/()/()/yolov5/train.py", line 630, in main(opt) File "/home/()/()/yolov5/train.py", line 526, in main main(opt) File "/home/()/()/yolov5/train.py", line 526, in main train(opt.hyp, opt, device, callbacks) File "/home/()/()/yolov5/train.py", line 109, in train train(opt.hyp, opt, device, callbacks) File "/home/()/()/yolov5/train.py", line 110, in train with torch_distributed_zero_first(LOCAL_RANK): File "/home/()/.conda/envs/()/lib/python3.9/contextlib.py", line 119, in enter data_dict = data_dict or check_dataset(data) # check if None File "/home/()/.conda/envs/()/lib/python3.9/contextlib.py", line 126, in exit return next(self.gen) File "/home/()/()/yolov5/utils/torch_utils.py", line 91, in torch_distributed_zero_first next(self.gen) File "/home/()/()/yolov5/utils/torch_utils.py", line 94, in torch_distributed_zero_first dist.barrier(device_ids=[local_rank]) File "/home/qisens/.conda/envs/minjeong_2/lib/python3.9/site-packages/torch/distributed/distributed_c10d.py", line 2784, in barrier dist.barrier(device_ids=[0]) File "/home/()/.conda/envs/()/lib/python3.9/site-packages/torch/distributed/distributed_c10d.py", line 2784, in barrier work = default_pg.barrier(opts=opts)work = default_pg.barrier(opts=opts) RuntimeErrorRuntimeError: : NCCL error in: ../torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:46, unhandled cuda error, NCCL version 2.10.3 ncclUnhandledCudaError: Call to CUDA function failed.NCCL error in: ../torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:46, unhandled cuda error, NCCL version 2.10.3 ncclUnhandledCudaError: Call to CUDA function failed. ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 2416573) of binary: /home/()/.conda/envs/()/bin/python Traceback (most recent call last): File "/home/()/.conda/envs/()/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/()/.conda/envs/()/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/()/.conda/envs/()/lib/python3.9/site-packages/torch/distributed/run.py", line 765, in main() File "/home/()/.conda/envs/()/lib/python3.9/site-packages/torch/distributed/elastic/multiprocessing/errors/init.py", line 345, in wrapper return f(*args, **kwargs) File "/home/()/.conda/envs/()/lib/python3.9/site-packages/torch/distributed/run.py", line 761, in main run(args) File "/home/()/.conda/envs/()/lib/python3.9/site-packages/torch/distributed/run.py", line 752, in run elastic_launch( File "/home/()/.conda/envs/()/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 131, in call return launch_agent(self._config, self._entrypoint, list(args)) File "/home/()/.conda/envs/()/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError: ============================================================ train.py FAILED ------------------------------------------------------------ Failures: [1]: time : 2022-09-21_13:56:16 host :() rank : 1 (local_rank: 1) exitcode : 1 (pid: 2416574) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html ------------------------------------------------------------ Root Cause (first observed failure): [0]: time : 2022-09-21_13:56:16 host : () rank : 0 (local_rank: 0) exitcode : 1 (pid: 2416573) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html ============================================================

@glenn-jocher
Copy link
Member

glenn-jocher commented Sep 22, 2022

@MinjeongKim03 I would run DDP training in our Docker image if you are having local environment issues:

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

@gra-ch
Copy link

gra-ch commented Oct 20, 2022

I tried to use Docker image but still got the same error.

@glenn-jocher
Copy link
Member

@gra-ch I just tried the DDP usage example shown in train.py in our Docker image and discovered a bug related to ClearML, so I've removed it from the Dockerfile requirements in #9876

@glenn-jocher glenn-jocher linked a pull request Oct 20, 2022 that will close this issue
@glenn-jocher
Copy link
Member

Good news 😃! Docker training issue related to ClearML should now be fixed ✅ in PR #9876.

To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Run on Gradient Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2022

👋 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 ⭐!

@github-actions github-actions bot added the Stale label Nov 20, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 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 Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants