MCPcopy Create free account
hub / github.com/Physical-Intelligence/openpi / init_logging

Function init_logging

scripts/train_pytorch.py:50–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48
49
50def init_logging():
51 level_mapping = {"DEBUG": "D", "INFO": "I", "WARNING": "W", "ERROR": "E", "CRITICAL": "C"}
52
53 class CustomFormatter(logging.Formatter):
54 def format(self, record):
55 record.levelname = level_mapping.get(record.levelname, record.levelname)
56 return super().format(record)
57
58 formatter = CustomFormatter(
59 fmt="%(asctime)s.%(msecs)03d [%(levelname)s] %(message)-80s (%(process)d:%(filename)s:%(lineno)s)",
60 datefmt="%H:%M:%S",
61 )
62 logger = logging.getLogger()
63 logger.setLevel(logging.INFO)
64 if not logger.handlers:
65 ch = logging.StreamHandler()
66 ch.setFormatter(formatter)
67 logger.addHandler(ch)
68 else:
69 logger.handlers[0].setFormatter(formatter)
70
71
72def init_wandb(config: _config.TrainConfig, *, resuming: bool, enabled: bool = True):

Callers 1

mainFunction · 0.70

Calls 1

CustomFormatterClass · 0.70

Tested by

no test coverage detected