forked from justhalf/wav2mid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runs.py
35 lines (30 loc) · 1004 Bytes
/
runs.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
import shutil
import csv
from config import create_config, load_config
from preprocess import preprocess, organize
from keras_train import train
import os
def run():
with open('models.csv', 'r') as csvfile:
reader = csv.reader(csvfile)
header = next(reader)
# print(header)
for row in reader:
args = dict(zip(header, row))
model_name = args['model_name']
# print(model_name)
if os.path.exists('models/{}/config.json'.format(model_name)):
args = load_config('models/{}/config.json'.format(model_name))
else:
create_config(args)
preprocess(args)
organize(args)
print("-------- training --------")
train(args)
if os.path.isdir("./baseline"):
shutil.rmtree("./baseline")
print("deleted the directory baseline")
if os.path.isdir("./models"):
shutil.rmtree("./models")
print("deleted the directory models")
run()