Skip to content

Commit

Permalink
[Fix] fix repeated warning from different ranks (open-mmlab#2053)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tau-J authored Mar 14, 2023
1 parent e0a5713 commit 8cbe359
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mmpose/datasets/transforms/common_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from mmcv.transforms import BaseTransform
from mmcv.transforms.utils import avoid_cache_randomness, cache_randomness
from mmengine import is_list_of
from mmengine.dist import get_dist_info
from scipy.stats import truncnorm

from mmpose.codecs import * # noqa: F401, F403
Expand Down Expand Up @@ -639,7 +640,9 @@ def albu_builder(self, cfg: dict) -> albumentations:
if mmengine.is_str(obj_type):
if albumentations is None:
raise RuntimeError('albumentations is not installed')
if not hasattr(albumentations.augmentations.transforms, obj_type):
rank, _ = get_dist_info()
if rank == 0 and not hasattr(
albumentations.augmentations.transforms, obj_type):
warnings.warn(
f'{obj_type} is not pixel-level transformations. '
'Please use with caution.')
Expand Down

0 comments on commit 8cbe359

Please sign in to comment.