-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmusic_example.py
51 lines (35 loc) · 1.22 KB
/
music_example.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
"""
This script provides an example of how to call music_maker.py
"""
from importlib import reload
import math
import torch
import numpy as np
import src.music_maker
reload(src.music_maker)
from src.music_maker import ex # importing experiment here is crucial (why?)
from sacred.observers import FileStorageObserver, RunObserver
import os
# don't record information in the file system, just investigate where the program fails
debug_mode = False
config_updates = {
'dataset': "Nottingham",
'key': "traindata",
'index': 1,
'variance': 0,
'hidden_size': 100,
'sdpath': "models/209/final_state_dict.pt",
'song_name': "cybernottingham"
}
if __name__ == "__main__":
base_dir = os.getcwd()
if debug_mode:
# run the experiment without an observer
ex.run(config_updates={**config_updates})
result = ex.current_run.result
else:
# store in local directory for now
ex.observers.append(FileStorageObserver(base_dir + '/music'))
# run the experiment after adding observer
ex.run(config_updates={**config_updates})
result = ex.current_run.result