def is_main_process(group: Optional[ProcessGroup] = None) -> bool:
    """Whether the current rank of the given process group is equal to 0.

    Args:
        group (ProcessGroup, optional): The process group to work on. If None,
            the default process group will be used. Defaults to None.

    Returns:
        bool: Return True if the current rank of the given process group is
        equal to 0, otherwise False.
    """
    return get_rank(group) == 0
Whether the current rank of the given process group is equal to 0.

Args:
group (ProcessGroup, optional): The process group to work on. If None,
the default process group will be used. Defaults to None.

Returns:
bool: Return True if the current rank of the given process group is
equal to 0, otherwise False.
projects/llava_sam2/evaluation/utils/dist.py