MCPcopy Create free account
hub / github.com/dcharatan/flowmap / LocalLogger

Class LocalLogger

flowmap/misc/local_logger.py:12–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11
12class LocalLogger(Logger):
13 def __init__(self) -> None:
14 super().__init__()
15 self.experiment = None
16 os.system(f"rm -r {LOG_PATH}")
17
18 @property
19 def name(self):
20 return "LocalLogger"
21
22 @property
23 def version(self):
24 return 0
25
26 @rank_zero_only
27 def log_hyperparams(self, params):
28 pass
29
30 @rank_zero_only
31 def log_metrics(self, metrics, step):
32 pass
33
34 @rank_zero_only
35 def log_image(
36 self,
37 key: str,
38 images: list[Any],
39 step: Optional[int] = None,
40 **kwargs,
41 ):
42 # The function signature is the same as the wandb logger's, but the step is
43 # actually required.
44 assert step is not None
45 for index, image in enumerate(images):
46 path = LOG_PATH / f"{key}/{index:0>2}_{step:0>6}.png"
47 path.parent.mkdir(exist_ok=True, parents=True)
48 Image.fromarray(image).save(path)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected