open-mmlab/mmdetection · warning
group` is deprecated. Currently only supports NCCL backend.
Error message
group` is deprecated. Currently only supports NCCL backend.
What it means
all_reduce_dict in mmdet/utils/dist_utils.py warns that the group argument is deprecated and only the NCCL backend is supported, before performing an all-reduce of a dict of tensors across ranks (used by hooks like before_val_epoch to aggregate validation metrics). On world_size == 1 it returns immediately after the warning, so single-process runs only see noise.
Source
Thrown at mmdet/utils/dist_utils.py:110
The code is modified from https://github.com/Megvii-
BaseDetection/YOLOX/blob/main/yolox/utils/allreduce_norm.py.
NOTE: make sure that py_dict in different ranks has the same keys and
the values should be in the same shape. Currently only supports
nccl backend.
Args:
py_dict (dict): Dict to be applied all reduce op.
op (str): Operator, could be 'sum' or 'mean'. Default: 'sum'
group (:obj:`torch.distributed.group`, optional): Distributed group,
Default: None.
to_float (bool): Whether to convert all values of dict to float.
Default: True.
Returns:
OrderedDict: reduced python dict object.
"""
warnings.warn(
'group` is deprecated. Currently only supports NCCL backend.')
_, world_size = get_dist_info()
if world_size == 1:
return py_dict
# all reduce logic across different devices.
py_key = list(py_dict.keys())
if not isinstance(py_dict, OrderedDict):
py_key_tensor = obj2tensor(py_key)
dist.broadcast(py_key_tensor, src=0)
py_key = tensor2obj(py_key_tensor)
tensor_shapes = [py_dict[k].shape for k in py_key]
tensor_numels = [py_dict[k].numel() for k in py_key]
if to_float:
warnings.warn('Note: the "to_float" is True, you need to '
'ensure that the behavior is reasonable.')View on GitHub (pinned to cfd5d3a985)
Solutions
- If on GPUs, ensure distributed is initialized with NCCL: torch.distributed.init_process_group(backend='nccl') and launch via the provided dist scripts.
- If you called all_reduce_dict directly, drop the group argument and rely on the default process group.
- For CPU/multi-machine non-NCCL setups, replace all_reduce_dict with your own reduce (e.g. all_gather + torch.distributed.all_reduce with Gloo) since NCCL is unsupported here.
- Suppress the notice in logs when behavior is already correct: warnings.filterwarnings('ignore', message=".*group` is deprecated.*").
Example fix
# before reduced = all_reduce_dict(metrics, group=my_group) # after reduced = all_reduce_dict(metrics) # group deprecated; NCCL default process group used
Defensive patterns
Strategy: validation
Validate before calling
import torch, torch.distributed as dist
def nccl_ready() -> bool:
return dist.is_available() and dist.is_initialized() and dist.get_backend() == 'nccl' Type guard
def safe_all_reduce_dict(py_dict):
import warnings
from mmdet.utils import all_reduce_dict, get_dist_info
_, world_size = get_dist_info()
if world_size == 1:
return py_dict # skip warn + reduce on single process
assert dist.get_backend() == dist.Backend.NCCL, 'all_reduce_dict requires NCCL'
with warnings.catch_warnings():
warnings.simplefilter('ignore')
return all_reduce_dict(py_dict) Prevention
- Initialize distributed with backend='nccl' for GPU training/validation.
- Call all_reduce_dict without the group argument.
- Short-circuit on world_size==1 to avoid pointless warnings in single-GPU runs.
When it happens
Trigger: Distributed evaluation (mmdet hooks calling all_reduce_dict in before_val_epoch) or any direct call to all_reduce_dict(py_dict). Triggered regardless of backend because the warning fires unconditionally at function entry; actual reduction requires NCCL (GPU) distributed init.
Common situations: Multi-GPU validation with torch.distributed launched via tools/dist_train.sh; running on CPU-only distributed (Gloo) where the NCCL-only assumption breaks; single-GPU runs where the warning is pure noise since world_size==1 short-circuits.
Related errors
- Note: the "to_float" is True, you need to ensure that the be
- The `file_client_args` is deprecated, please use `backend_ar
- device must be 'cpu' or 'gpu', but got {device}
- GPU collecting has not been supported yet
- The `file_client_args` is deprecated, please use `backend_ar
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/d616c8756e086909.
Report an issue: GitHub.