def sync_string(value: str):
    """
    This function synchronizes a string across all processes.
    """
    if not is_distributed():
        return value
    bytes_value = value.encode("utf-8")
    max_len = 256
    bytes_tensor = torch.zeros(max_len, dtype=torch.uint8).cuda()
    bytes_tensor[: len(bytes_value)] = torch.tensor(
        list(bytes_value), dtype=torch.uint8
    )
    torch.distributed.broadcast(bytes_tensor, 0)
    synced_value = bytes_tensor.cpu().numpy().tobytes().decode("utf-8").rstrip("\x00")
    return synced_value

    This function synchronizes a string across all processes.
    
opensora/utils/config.py