MCPcopy Create free account
hub / github.com/CompVis/zigma / create_logger

Function create_logger

utils/train_utils.py:59–77  ·  view source on GitHub ↗

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

(rank, logging_dir=None)

Source from the content-addressed store, hash-verified

57
58
59def create_logger(rank, logging_dir=None):
60 """
61 Create a logger that writes to a log file and stdout.
62 """
63 if rank == 0: # real logger
64 logging.basicConfig(
65 level=logging.INFO,
66 format="[\033[34m%(asctime)s\033[0m] %(message)s",
67 datefmt="%Y-%m-%d %H:%M:%S",
68 handlers=[
69 logging.StreamHandler(),
70 logging.FileHandler(f"{logging_dir}/log.txt"),
71 ],
72 )
73 logger = logging.getLogger(__name__)
74 else: # dummy logger (does nothing)
75 logger = logging.getLogger(__name__)
76 logger.addHandler(logging.NullHandler())
77 return logger
78
79
80def center_crop_arr(pil_image, image_size):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected