File size: 566 Bytes
da77aaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
Copyright (c) 2024-present Naver Cloud Corp.

This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
"""

import torch

def print_once(message):
    if not torch.distributed.is_initialized() or torch.distributed.get_rank() == 0:
        print(message)

def pretty(d, indent=0):
    for key, value in d.items():
        print_once("\t" * indent + str(key))
        if isinstance(value, dict):
            pretty(value, indent + 1)
        else:
            print_once("\t" * (indent + 1) + str(value))