1 parent a59ed24 commit 78393bdCopy full SHA for 78393bd
1 file changed
utils/wandb.py
@@ -0,0 +1,37 @@
1
+import os
2
+
3
+import wandb
4
5
+import configs
6
+import utils
7
8
9
+class Wandb(object):
10
11
+ def __init__(self, cfg, data_cfg, run):
12
+ self.cfg = cfg
13
+ self.data_cfg = data_cfg
14
+ self.run = run
15
+ self.path = utils.path.get_path(cfg, data_cfg, run)
16
+ self.project = os.path.split(self.path)[-1]
17
18
+ if configs.env.log.wandb:
19
+ self.wan = wandb.init(
20
+ entity="myluo-cair",
21
+ project=self.project,
22
+ config={
23
+ 'model': self.cfg.dict(),
24
+ 'dataset': self.data_cfg.dict(),
25
+ 'run': self.run.dict(),
26
+ },
27
+ )
28
+ else:
29
+ self.wan = None
30
31
+ def __del__(self):
32
+ if self.wan is not None:
33
+ self.wan.finish()
34
35
+ def info(self, msg):
36
37
+ self.wan.log(msg)
0 commit comments