flpelerin commited on
Commit
7db0785
·
1 Parent(s): c6541c4

Update 2 files

Browse files

- /wandb.py
- /trainer.cli.py

Files changed (2) hide show
  1. trainer.cli.py +5 -3
  2. wandb.py +5 -3
trainer.cli.py CHANGED
@@ -6,6 +6,8 @@ from argparse import ArgumentParser
6
 
7
  from util import ConfigParser
8
 
 
 
9
 
10
 
11
  parser = ArgumentParser(
@@ -23,6 +25,6 @@ if __name__ == '__main__':
23
 
24
  config = ConfigParser(args.config_path).config
25
 
26
- print(f"Config: {config}")
27
- print(f"Wandb: {config.wandb}")
28
- print(f"Wandb.name: {config.wandb.name}")
 
6
 
7
  from util import ConfigParser
8
 
9
+ from wandb import Wandb
10
+
11
 
12
 
13
  parser = ArgumentParser(
 
25
 
26
  config = ConfigParser(args.config_path).config
27
 
28
+
29
+ wandb = Wandb(config)
30
+ print(wandb.name)
wandb.py CHANGED
@@ -7,11 +7,13 @@ from util import Config, RandomCode
7
 
8
  class Wandb:
9
  def __init__(self, config: Config):
10
- if config.entity is None or config.project is None or config.api_key is None:
 
 
11
  raise ValueError('Missing required values for either Entity, Project or API Key')
12
 
13
- if config.name == '':
14
- config.name = 'run-' + RandomCode()
15
 
16
  os.environ['WANDB_API_KEY'] = api_key
17
  wandb.init(project, entity, name)
 
7
 
8
  class Wandb:
9
  def __init__(self, config: Config):
10
+ self.__dict__ = config.__dict__
11
+
12
+ if entity is None or project is None or api_key is None:
13
  raise ValueError('Missing required values for either Entity, Project or API Key')
14
 
15
+ if name == '':
16
+ name = 'run-' + RandomCode()
17
 
18
  os.environ['WANDB_API_KEY'] = api_key
19
  wandb.init(project, entity, name)