-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecuter.py
58 lines (44 loc) · 1.45 KB
/
executer.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
45
46
47
48
49
50
51
52
53
54
55
56
57
# %%
import os
import pandas as pd
from datetime import datetime as dt
from hmc.utils.dir import create_dir, create_job_id
from hmc.model.train import run
# %%
base_path = "/mnt/disks/data/fma/trains"
id = "hierarchical_tworoots"
# %%
train_path = os.path.join(base_path,id)
torch_path = os.path.join(train_path,'torch')
metadata_path = os.path.join(train_path,"metadata.json")
labels_path = os.path.join(train_path,"labels.json")
models_path = os.path.join(train_path, "models")
hmc_path = os.path.join(train_path, 'hmc_torch_effnet')
job_id = create_job_id()
print(f"Job ID: {job_id}")
model_path = os.path.join(hmc_path, job_id)
create_dir(model_path)
args = pd.Series({
"batch_size":64,
"epochs":15,
"dropout":0.1,
'patience':5,
'shuffle':True,
'max_queue_size':64,
"labels_path": labels_path,
"metadata_path": metadata_path,
"model_path": model_path,
"train_path": os.path.join(torch_path,'train'),
"test_path": os.path.join(torch_path,'test'),
"val_path": os.path.join(torch_path,'val')
})
# %%
time_start = dt.utcnow()
print("[{}] Experiment started at {}".format(id, time_start.strftime("%H:%M:%S")))
print(".......................................")
print(args)
run(args)
time_end = dt.utcnow()
time_elapsed = time_end - time_start
print(".......................................")
print("[{}] Experiment finished at {} / elapsed time {}s".format(id, time_end.strftime("%H:%M:%S"), time_elapsed.total_seconds()))