y = speech["target"] vocabulary = speech["vocabulary"] vocabulary_size = speech["vocabulary_size"] reconstruct = speech["reconstruct"] fs = speech["sample_rate"] X = np.array([x.astype(theano.config.floatX) for x in X]) y = np.array([yy.astype(theano.config.floatX) for yy in y]) minibatch_size = 20 n_epochs = 20000 # Used way at the bottom in the training loop! checkpoint_every_n = 500 # Was 300 for handwriting cut_len = 31 # Used way at the bottom in the training loop! random_state = np.random.RandomState(1999) train_itr = list_iterator([X, y], minibatch_size, axis=1, stop_index=80, randomize=True, make_mask=True) valid_itr = list_iterator([X, y], minibatch_size, axis=1, start_index=80, make_mask=True) X_mb, X_mb_mask, c_mb, c_mb_mask = next(train_itr) train_itr.reset() input_dim = X_mb.shape[-1] n_bins = 10 n_kernels = 32 conv_size1 = 11 conv_size2 = 5 deconv_size1 = 5 deconv_size2 = 11 n_hid = 512 att_size = 10
vocabulary = speech["vocabulary"] vocabulary_size = speech["vocabulary_size"] reconstruct = speech["reconstruct"] fs = speech["sample_rate"] X = np.array([x.astype(theano.config.floatX) for x in X]) y = np.array([yy.astype(theano.config.floatX) for yy in y]) minibatch_size = 1 n_epochs = 200 # Used way at the bottom in the training loop! checkpoint_every_n = 10 cut_len = 41 # Used way at the bottom in the training loop! random_state = np.random.RandomState(1999) train_itr = list_iterator([X, y], minibatch_size, axis=1, stop_index=105, randomize=True, make_mask=True) valid_itr = list_iterator([X, y], minibatch_size, axis=1, start_index=105 - minibatch_size, randomize=True, make_mask=True) X_mb, X_mb_mask, c_mb, c_mb_mask = next(train_itr) train_itr.reset() n_hid = 256 att_size = 10 n_proj = 256 n_v_proj = 5
X1 = np.array([x.astype(theano.config.floatX) for x in X1]) X2 = np.array([x.astype(theano.config.floatX) for x in X2]) X = np.array( [np.hstack((x1[:, None], x2[:, None])) for x1, x2 in zip(X1, X2)]) y = np.array([yy.astype(theano.config.floatX) for yy in y]) minibatch_size = 20 n_epochs = 1000 # Used way at the bottom in the training loop! checkpoint_every_n = 100 # Was 300 cut_len = 21 # Used way at the bottom in the training loop! random_state = np.random.RandomState(1999) train_itr = list_iterator([X, y], minibatch_size, axis=1, stop_index=80, make_mask=True) valid_itr = list_iterator([X, y], minibatch_size, axis=1, start_index=80, make_mask=True) X_mb, X_mb_mask, c_mb, c_mb_mask = next(train_itr) train_itr.reset() n_hid = 256 att_size = 10 n_proj = 1024 n_softmax1 = X1_size n_softmax2 = X2_size
#speech = fetch_fruitspeech_spectrogram() mnist = fetch_binarized_mnist() X = mnist["data"] train_indices = mnist["train_indices"] valid_indices = mnist["valid_indices"] X = np.array([x.astype(theano.config.floatX) for x in X]) minibatch_size = 16 n_epochs = 10000 # Used way at the bottom in the training loop! checkpoint_every_n = 10 n_bins = 1 random_state = np.random.RandomState(1999) # bit weird but for MNIST this will return 28, 1, 28 train_itr = list_iterator([X], minibatch_size, axis=1, stop_index=train_indices[-1] + 1, randomize=True, make_mask=True) valid_itr = list_iterator([X], minibatch_size, axis=1, start_index=valid_indices[0], stop_index=valid_indices[-1] + 1, randomize=True, make_mask=True) X_mb, X_mb_mask = next(train_itr) train_itr.reset() desc = "Speech generation" parser = argparse.ArgumentParser(description=desc) parser.add_argument('-s', '--sample', help='Sample from a checkpoint file', default=None, required=False) def restricted_int(x):
import theano import sys from kdllib import fetch_fruitspeech_spectrogram, run_loop, list_iterator speech = fetch_fruitspeech_spectrogram() data = speech["data"] # 10 classes X_train = data[0] / 10. X_train = X_train[None].astype("float32") y_train = X_train.astype("float32") minibatch_size = 1 # Make easy iterators data = [(X_train),] target = [(y_train),] train_itr = list_iterator([data, target], minibatch_size, axis=0, stop_index=1) valid_itr = list_iterator([data, target], minibatch_size, axis=0, stop_index=1) X_mb, y_mb = train_itr.next() train_itr.reset() # set recursion limit so pickle doesn't error sys.setrecursionlimit(40000) random_state = np.random.RandomState(1999) n_epochs = 200 # theano land tensor4 for 4 dimensions input_var = tensor.tensor4('X') target_var = tensor.tensor4('y') outchan = y_train.shape[0] inchan = X_train.shape[0]
mnist = fetch_binarized_mnist() X = mnist["data"] train_indices = mnist["train_indices"] valid_indices = mnist["valid_indices"] X = np.array([x.astype(theano.config.floatX) for x in X]) minibatch_size = 16 n_epochs = 10000 # Used way at the bottom in the training loop! checkpoint_every_n = 10 n_bins = 1 random_state = np.random.RandomState(1999) # bit weird but for MNIST this will return 28, 1, 28 train_itr = list_iterator([X], minibatch_size, axis=1, stop_index=train_indices[-1] + 1, randomize=True, make_mask=True) valid_itr = list_iterator([X], minibatch_size, axis=1, start_index=valid_indices[0], stop_index=valid_indices[-1] + 1, randomize=True, make_mask=True) X_mb, X_mb_mask = next(train_itr) train_itr.reset() desc = "Speech generation" parser = argparse.ArgumentParser(description=desc) parser.add_argument('-s',
speech = fetch_fruitspeech_spectrogram() data = speech["data"] # 10 classes X_train = data[0] / 10. X_train = X_train[None].astype("float32") y_train = X_train.astype("float32") minibatch_size = 1 # Make easy iterators data = [ (X_train), ] target = [ (y_train), ] train_itr = list_iterator([data, target], minibatch_size, axis=0, stop_index=1) valid_itr = list_iterator([data, target], minibatch_size, axis=0, stop_index=1) X_mb, y_mb = train_itr.next() train_itr.reset() # set recursion limit so pickle doesn't error sys.setrecursionlimit(40000) random_state = np.random.RandomState(1999) n_epochs = 200 # theano land tensor4 for 4 dimensions input_var = tensor.tensor4('X') target_var = tensor.tensor4('y') outchan = y_train.shape[0] inchan = X_train.shape[0]