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

Function init_logging

scripts/train.py:31–47  ·  view source on GitHub ↗

Custom logging format for better readability.

()

Source from the content-addressed store, hash-verified

29
30
31def init_logging():
32 """Custom logging format for better readability."""
33 level_mapping = {"DEBUG": "D", "INFO": "I", "WARNING": "W", "ERROR": "E", "CRITICAL": "C"}
34
35 class CustomFormatter(logging.Formatter):
36 def format(self, record):
37 record.levelname = level_mapping.get(record.levelname, record.levelname)
38 return super().format(record)
39
40 formatter = CustomFormatter(
41 fmt="%(asctime)s.%(msecs)03d [%(levelname)s] %(message)-80s (%(process)d:%(filename)s:%(lineno)s)",
42 datefmt="%H:%M:%S",
43 )
44
45 logger = logging.getLogger()
46 logger.setLevel(logging.INFO)
47 logger.handlers[0].setFormatter(formatter)
48
49
50def init_wandb(config: _config.TrainConfig, *, resuming: bool, log_code: bool = False, enabled: bool = True):

Callers 1

mainFunction · 0.70

Calls 1

CustomFormatterClass · 0.70

Tested by

no test coverage detected