def load_data_info(blending_data=None, valid=None, model_path=None, n_hidden=256, step=None, beat_gt=None, beat_subdiv=None, model_out=".", acoustic='kelz', early_exit=0.001, diagRNN=False, ablate_list=[], noise=None, noise_gauss=False): """ Set up the global parameter dictionaries to run Bayesian Optimization with the given settings. This is called by optimize_sk.py. """ global global_params global data_dict global model_dict data_dict['valid'] = valid with gzip.open(blending_data, 'rb') as file: data_dict['blending_data'] = pickle.load(file) if noise is None: data_dict['noise'] = (data_dict['blending_data']['noise'] if 'noise' in data_dict['blending_data'] else None) data_dict['noise_gauss'] = (data_dict['blending_data']['noise_gauss'] if 'noise_gauss' in data_dict['blending_data'] else False) else: data_dict['noise'] = noise data_dict['noise_gauss'] = noise_gauss model_param = make_model_param() model_param['n_hidden'] = n_hidden model_param['n_steps'] = 1 # To generate 1 step at a time model_param['with_onsets'] = data_dict['blending_data']['with_onsets'] if diagRNN: model_param['cell_type'] = "diagLSTM" # Build model object model_dict['model'] = Model(model_param) model_dict['sess'], _ = model_dict['model'].load(model_path, model_path=model_path) global_params['step'] = step global_params['beat_gt'] = beat_gt global_params['beat_subdiv'] = beat_subdiv global_params['model_out'] = model_out global_params['acoustic'] = acoustic global_params['early_exit'] = early_exit global_params['ablate'] = ablate_list
def load_data_info(gt=None, beam=None, valid=None, model_path=None, n_hidden=256, step=None, model_out=".", acoustic='kelz', early_exit=0.001, diagRNN=False): global global_params global data_dict global model_dict if gt is not None: with gzip.open(gt, "rb") as file: data_dict['gt'] = pickle.load(file) if beam is not None: with gzip.open(beam, "rb") as file: data_dict['beam'] = pickle.load(file) data_dict['valid'] = valid model_param = make_model_param() model_param['n_hidden'] = n_hidden model_param['n_steps'] = 1 # To generate 1 step at a time if diagRNN: model_param['cell_type'] = "diagLSTM" # Build model object model_dict['model'] = Model(model_param) model_dict['sess'], _ = model_dict['model'].load(model_path, model_path=model_path) global_params['step'] = step global_params['model_out'] = model_out global_params['acoustic'] = acoustic global_params['early_exit'] = early_exit
if not (0 <= args.weight <= 1): print("Weight must be between 0 and 1.", file=sys.stderr) sys.exit(1) try: max_len = float(args.max_len) section = [0, max_len] except: max_len = None section = None os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu # Load model model_param = make_model_param() model_param['n_hidden'] = args.hidden model_param['n_steps'] = 1 # To generate 1 step at a time if args.diagRNN: model_param['cell_type'] = "diagLSTM" # Build model object model = Model(model_param) sess, _ = model.load(args.model, model_path=args.model) # Load data if args.MIDI.endswith(".mid"): data = dataMaps.DataMaps() data.make_from_file(args.MIDI, args.step, section=section,