flpelerin commited on
Commit
48c784d
·
1 Parent(s): 4fd0439

Update file wandb.py

Browse files
Files changed (1) hide show
  1. wandb.py +9 -20
wandb.py CHANGED
@@ -8,31 +8,20 @@ from util import Config, RandomCode
8
  class Wandb:
9
  def __init__(self, config: Config):
10
  self.__dict__ = dict(config.__dict__)
11
- locals().update(self.__dict__)
12
 
13
- ewoirjwer='wrqwer'
14
-
15
- print(f"locals: {locals()}")
16
- print(f"self: {self}")
17
- print(f'self dict: {dict(self.__dict__)}')
18
-
19
- #print(f"config: {config}")
20
- #print(f'config dict: {dict(config.__dict__)}')
21
-
22
-
23
- if entity == '' or project == '' or api_key == '':
24
  raise ValueError('Missing required values for either Entity, Project or API Key')
25
 
26
- if name == '':
27
- name = 'run-' + RandomCode()
28
 
29
- os.environ['WANDB_API_KEY'] = api_key
30
- wandb.init(project, entity, name)
31
 
32
 
33
- #def __call__(self, args):
34
- # wandb.log(args)
35
 
36
 
37
- #def __del__(self):
38
- # wandb.finish()
 
8
  class Wandb:
9
  def __init__(self, config: Config):
10
  self.__dict__ = dict(config.__dict__)
 
11
 
12
+ if self.entity == '' or self.project == '' or self.api_key == '':
 
 
 
 
 
 
 
 
 
 
13
  raise ValueError('Missing required values for either Entity, Project or API Key')
14
 
15
+ if self.name == '':
16
+ self.name = 'run-' + RandomCode()
17
 
18
+ os.environ['WANDB_API_KEY'] = self.api_key
19
+ wandb.init(self.project, self.entity, self.name)
20
 
21
 
22
+ def __call__(self, args):
23
+ wandb.log(args)
24
 
25
 
26
+ def __del__(self):
27
+ wandb.finish()