Update file logger.py
Browse files
logger.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import wandb
|
| 2 |
import os
|
| 3 |
|
| 4 |
from util import Config, RandomCode
|
|
@@ -9,9 +9,6 @@ class Wandb:
|
|
| 9 |
def __init__(self, config: Config):
|
| 10 |
self.__dict__ = dict(config.__dict__)
|
| 11 |
|
| 12 |
-
#print(f"self.wandb: {self.wandb}")
|
| 13 |
-
#print(f"self.config: {self.config}")
|
| 14 |
-
|
| 15 |
if self.entity == '' or self.project == '' or self.api_key == '':
|
| 16 |
raise ValueError('Missing required values for either Entity, Project or API Key')
|
| 17 |
|
|
@@ -19,15 +16,13 @@ class Wandb:
|
|
| 19 |
self.name = 'run-' + RandomCode()
|
| 20 |
|
| 21 |
os.environ['WANDB_API_KEY'] = self.api_key
|
| 22 |
-
|
| 23 |
|
| 24 |
|
| 25 |
-
def init(self):
|
| 26 |
-
wb.init(self.project, self.entity, self.name)
|
| 27 |
|
| 28 |
def __call__(self, args):
|
| 29 |
-
|
| 30 |
|
| 31 |
|
| 32 |
def __del__(self):
|
| 33 |
-
|
|
|
|
| 1 |
+
import wandb
|
| 2 |
import os
|
| 3 |
|
| 4 |
from util import Config, RandomCode
|
|
|
|
| 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 |
|
|
|
|
| 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 |
|
| 23 |
def __call__(self, args):
|
| 24 |
+
wandb.log(args)
|
| 25 |
|
| 26 |
|
| 27 |
def __del__(self):
|
| 28 |
+
wandb.finish()
|