ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.82k stars 16.37k forks source link

in _ddp_init_helper expect_sparse_gradient) RuntimeError: Model replicas must have an equal number of parameters. #2311

Closed AIYoungcino closed 3 years ago

AIYoungcino commented 3 years ago

在hpc上训练YOLOv5,单节点单卡可以运行,但单节点多卡,多节点多卡都会报错。

github-actions[bot] commented 3 years ago

👋 Hello @xioyung, 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 glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

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

AIYoungcino commented 3 years ago

/public/software/apps/DeepLearning/PyTorch/rocm3.3_torch1.5/lib/python3.6/site-packages/torch/nn/parallel/distributed.py:303: UserWarning: Single-Process Multi-GPU is not the recommended mode for DDP. In this mode, each DDP instance operates on multiple devices and creates multiple module replicas within one process. The overhead of scatter/gather and GIL contention in every forward pass can slow down training. Please consider using one DDP instance per device or per module replica by explicitly setting device_ids or CUDA_VISIBLE_DEVICES. NB: There is a known issue in nn.parallel.replicate that prevents a single DDP instance to operate on multiple model replicas. "Single-Process Multi-GPU is not the recommended mode for " Namespace(adam=False, batch_size=16, bucket='', cache_images=False, cfg='./models/yolov5x.yaml', data='./data/mydata.yaml', device='1', epochs=300, img_size=[640], multi_scale=False, name='', noautoanchor=False, nosave=False, notest=False, rect=False, single_cls=False, weights='weights/last.pt') Using CUDA device0 _CudaDeviceProperties(name='Device 66a1', total_memory=16368MB) device1 _CudaDeviceProperties(name='Device 66a1', total_memory=16368MB) device2 _CudaDeviceProperties(name='Device 66a1', total_memory=16368MB) device3 _CudaDeviceProperties(name='Device 66a1', total_memory=16368MB)

NanoCode012 commented 3 years ago

@xioyung, pull latest code base and check Multi-GPU Tutorial https://docs.ultralytics.com/yolov5

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.