Skip to content

RankFilter in a single gpu environment #6894

Closed
Project-MONAI/research-contributions
#298

Description

@wyli

Describe the bug

MONAI/monai/utils/dist.py

Lines 197 to 204 in 59bcad4

if dist.is_available() and dist.is_initialized():
self.rank: int = rank if rank is not None else dist.get_rank()
else:
warnings.warn(
"The torch.distributed is either unavailable and uninitiated when RankFilter is instantiated. "
"If torch.distributed is used, please ensure that the RankFilter() is called "
"after torch.distributed.init_process_group() in the script."
)

rankfilter is not well defined for the single gpu environment

  File "/usr/lib/python3.10/logging/__init__.py", line 1465, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "/usr/lib/python3.10/logging/__init__.py", line 1624, in _log
    self.handle(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 964, in handle
    rv = self.filter(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 821, in filter
    result = f.filter(record)
  File "/opt/monai/monai/utils/dist.py", line 207, in filter
    return self.filter_fn(self.rank)
AttributeError: 'RankFilter' object has no attribute 'rank'

Activity

  1. added a commit that references this issue on Aug 21, 2023
    2daabf9
  2. added a commit that references this issue on Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions