Add default folder and add history storing feature
This commit is contained in:
parent
a6fb2e6e73
commit
8d611ac140
1
project/generated_music/readme.md
Normal file
1
project/generated_music/readme.md
Normal file
@ -0,0 +1 @@
|
||||
In this folder generated music will be stored
|
2
project/midi_packs/readme.md
Normal file
2
project/midi_packs/readme.md
Normal file
@ -0,0 +1,2 @@
|
||||
Place in this directory folders with midi.
|
||||
Each folder represent a source for making trainig sets
|
1
project/models/readme.md
Normal file
1
project/models/readme.md
Normal file
@ -0,0 +1 @@
|
||||
In this directory trained models will be stored
|
@ -4,6 +4,7 @@ import pickle
|
||||
import keras
|
||||
import argparse
|
||||
import warnings
|
||||
import pandas as pd
|
||||
from model import Seq2SeqModel
|
||||
from extract import make_folder_if_not_exist
|
||||
|
||||
@ -42,6 +43,7 @@ def train_models(model_workflow):
|
||||
if not INSTRUMENT or INSTRUMENT == instrument:
|
||||
data_path = os.path.join('training_sets', EXPERIMENT_NAME, instrument.lower() + '_data.pkl')
|
||||
model_path = os.path.join('models', EXPERIMENT_NAME, f'{instrument.lower()}_model.h5')
|
||||
history_path = os.path.join('models', EXPERIMENT_NAME, f'{instrument.lower()}_history.csv')
|
||||
|
||||
x_train, y_train, _, bars_in_seq = pickle.load(open(data_path,'rb'))
|
||||
|
||||
@ -52,8 +54,9 @@ def train_models(model_workflow):
|
||||
model = Seq2SeqModel(x_train, y_train, LATENT_DIM, ENCODER_DROPOUT, DECODER_DROPOUT, bars_in_seq)
|
||||
|
||||
print(f'Training: {instrument}')
|
||||
model.fit(BATCH_SIZE, EPOCHS, callbacks=[])
|
||||
history = model.fit(BATCH_SIZE, EPOCHS, callbacks=[])
|
||||
make_folder_if_not_exist(os.path.join('models', EXPERIMENT_NAME))
|
||||
pd.DataFrame(history.history).to_csv(history_path, mode='a', header=False)
|
||||
model.save(model_path)
|
||||
found = True
|
||||
|
||||
|
1
project/training_sets/readme.md
Normal file
1
project/training_sets/readme.md
Normal file
@ -0,0 +1 @@
|
||||
In this directory generated training sets will be stored
|
Loading…
Reference in New Issue
Block a user