forked from ArthurZucker/DeepLearningProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (32 loc) · 1.04 KB
/
main.py
File metadata and controls
41 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
Auteur: Léo Tronchon & Arthur Zucker
- Capture configuration
- Update with argvs
- launches training through agent
"""
from __future__ import absolute_import, division
import wandb
from agents import *
from config.hparams import Parameters
from pytorch_lightning.loggers import WandbLogger
def main():
parameters = Parameters.parse()
# initialize wandb instance
wdb_config = {}
for k,v in vars(parameters).items():
for key,value in vars(v).items():
wdb_config[f"{k}-{key}"]=value
wandb_run = WandbLogger(
config=wdb_config,# vars(parameters), # FIXME use the full parameters
project=parameters.hparams.wandb_project,
entity=parameters.hparams.wandb_entity,
allow_val_change=True,
save_dir=parameters.hparams.save_dir,
)
config = parameters
# Create the Agent and pass all the configuration to it then run it..
agent_class = globals()[config.hparams.agent]
agent = agent_class(config, wandb_run)
agent.run()
if __name__ == "__main__":
main()