Ejemplo n.º 1
0
parser.add_argument('--save', help="save values to destination", type=str)

args = parser.parse_args()

input_folder = args.input_folder
target_folder = args.target_folder
# save_folder = 'results/baseline/raw'

frame = []
note = []
out_key = []

results = {}

if args.save is not None:
    safe_mkdir(args.save)

for fn in os.listdir(input_folder):
    if fn.endswith(
            '_pr.csv') and not fn.startswith('.') and not 'chpn-e01' in fn:
        filename_input = os.path.join(input_folder, fn)
        filename_target = os.path.join(target_folder,
                                       fn).replace('_pr.csv', '.mid')
        print(filename_input)

        data = DataMaps()
        data.make_from_file(filename_target,
                            'time', [0, 30],
                            acoustic_model='kelz')

        input_roll = np.loadtxt(filename_input)
Ejemplo n.º 2
0
 parser.add_argument("--features", help="Use features in the x data points.", action="store_true")
 
 parser.add_argument("--weight", help="This model will output weights directly.", action="store_true")
 
 parser.add_argument("--epochs", help="The number of epochs to train for. Defaults to 100.",
                     type=int, default=100)
 
 parser.add_argument("--lr", help="The learning rate of the Adam optimizer. Defaults to 0.001.",
                     type=float, default=0.001)
 
 parser.add_argument("--no_lstm", help="Do not use the LSTM prior in the data.", action="store_true")
 
 parser.add_argument("--out", help="The directory to save the model to. Defaults to '.' (current directory)",
                     default=".")
 
 args = parser.parse_args()
 
 ac_pitches = args.a_pitches
 ac_pitches.append(0)
 ac_pitches = sorted(list(set(ac_pitches)))
 
 la_pitches = args.l_pitches
 la_pitches.append(0)
 la_pitches = sorted(list(set(la_pitches)))
 
 safe_mkdir(args.out)
 
 train_model_full(args.data, history=args.history, ac_pitch_window=ac_pitches,
                  la_pitch_window=la_pitches, min_diff=args.min_diff, features=args.features,
                  out=args.out, is_weight=args.weight, epochs=args.epochs, no_lstm=args.no_lstm,
                  lr=args.lr)
Ejemplo n.º 3
0
model_param['n_hidden'] = n_hidden
model_param['learning_rate'] = learning_rate
model_param['chunks'] = max_len
model_param['scheduled_sampling'] = args.sched_sampl
model_param['sampl_mix_weight'] = args.sampl_mix_weight
model_param['grad_clip'] = args.grad_clip
if args.pitchwise is None:
    model_param['pitchwise'] = False
else:
    model_param['pitchwise'] = True
    model_param['n_notes'] = 2 * args.pitchwise + 1
    train_param['batch_size'] = 500

save_path = args.save_path
log_path = os.path.join("ckpt", save_path)
safe_mkdir(log_path)
# f= open(os.path.join(log_path,"log.txt"), 'w')
# sys.stdout = f

model = make_model_from_dataset(data, model_param)
model.print_params()

if args.resume:
    safe_mkdir(os.path.join(save_path, 'resume'))
    model.resume_training(save_path, data, os.path.join(save_path, 'resume'),
                          train_param)
else:
    if args.sched_sampl_load is not None:
        model.resume_training(args.sched_sampl_load, data, save_path,
                              train_param)
    else: