MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / create_logger

Function create_logger

Large-DiT-ImageNet/train.py:97–113  ·  view source on GitHub ↗

Create a logger that writes to a log file and stdout.

(logging_dir)

Source from the content-addressed store, hash-verified

95
96
97def create_logger(logging_dir):
98 """
99 Create a logger that writes to a log file and stdout.
100 """
101 if dist.get_rank() == 0: # real logger
102 logging.basicConfig(
103 level=logging.INFO,
104 format='[\033[34m%(asctime)s\033[0m] %(message)s',
105 datefmt='%Y-%m-%d %H:%M:%S',
106 handlers=[logging.StreamHandler(),
107 logging.FileHandler(f"{logging_dir}/log.txt")]
108 )
109 logger = logging.getLogger(__name__)
110 else: # dummy logger (does nothing)
111 logger = logging.getLogger(__name__)
112 logger.addHandler(logging.NullHandler())
113 return logger
114
115
116def center_crop_arr(pil_image, image_size):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected