forked from UoA-CARES/BuilT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
42 lines (30 loc) · 908 Bytes
/
run.py
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
42
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import pprint
import torch
from easydict import EasyDict as edict
from sacred import Experiment
from sacred.utils import apply_backspaces_and_linefeeds
from src.models.mnist import Mnist
from src.trainer import Trainer
ex = Experiment('orsum')
ex.captured_out_filter = apply_backspaces_and_linefeeds
@ex.config
def cfg():
description = ''
@ex.main
def main(_run, _config):
config = edict(_config)
pprint.PrettyPrinter(indent=2).pprint(config)
@ex.command
def train(_run, _config):
config = edict(_config)
pprint.PrettyPrinter(indent=2).pprint(config)
tr = Trainer(config)
tr.run()
if __name__ == '__main__':
torch.multiprocessing.set_sharing_strategy('file_system')
torch.backends.cudnn.deterministic=True
ex.run_commandline()