forked from paulxiong/SimCLR-4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperiment.py
44 lines (31 loc) · 894 Bytes
/
experiment.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
43
44
"""
Sacred experiment file
"""
# Sacred
from sacred import Experiment
from sacred.stflow import LogFileWriter
from sacred.observers import FileStorageObserver, MongoObserver
# from utils import CustomFileStorageObserver
# custom config hook
from utils.yaml_config_hook import yaml_config_hook
ex = Experiment("SimCLR")
#### file output directory
ex.observers.append(FileStorageObserver("./logs"))
#### database output
# ex.observers.append(
# MongoObserver().create(
# url=f"mongodb://admin:admin@localhost:27017/?authMechanism=SCRAM-SHA-1",
# db_name="db",
# )
# )
@ex.config
def my_config():
config_file = "./config/config.yaml"
ex.add_config(config_file)
cfg = yaml_config_hook(config_file)
ex.add_config(cfg)
del cfg
# override any settings here
# start_epoch = 100
# ex.add_config(
# {'start_epoch': start_epoch})