Example #1
0
X_std = train_data.X_std

valid_data = Onomatopoeia(name='valid',
                          path=data_path,
                          frame_size=frame_size,
                          X_mean=X_mean,
                          X_std=X_std)

x, x_mask = train_data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, frame_size), dtype=np.float32)
    temp = np.ones((15, batch_size), dtype=np.float32)
    temp[:, -2:] = 0.
    x_mask.tag.test_value = temp

exp = unpickle(exp_path + exp_name + '.pkl')
nodes = exp.model.nodes
names = [node.name for node in nodes]

main_lstm, prior, kl,\
x_1, x_2, x_3, x_4, x_5, x_6,\
z_1, z_2, z_3, z_4,\
phi_1, phi_2, phi_3, phi_4, phi_mu, phi_sig,\
theta_1, theta_2, theta_3, theta_4, theta_mu, theta_sig = nodes


def inner_fn(x_t, s_tm1, s_tm1_is):

    x_1_t = x_1.fprop([x_t])
    x_2_t = x_2.fprop([x_1_t])
    x_3_t = x_3.fprop([x_2_t])
Example #2
0
normal_params = np.load(data_path + file_name + '_normal.npz')
X_mean = normal_params['X_mean']
X_std = normal_params['X_std']

data = Blizzard_h5_tbptt(name='test',
                         path=data_path,
                         frame_size=frame_size,
                         file_name=file_name,
                         X_mean=X_mean,
                         X_std=X_std)

x = data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, frame_size), dtype=np.float32)

exp = unpickle(pkl_path + pkl_name)
nodes = exp.model.nodes
names = [node.name for node in nodes]

[main_lstm, prior, kl,
 x_1, x_2, x_3, x_4,
 z_1, z_2, z_3, z_4,
 phi_1, phi_2, phi_3, phi_4, phi_mu, phi_sig,
 prior_1, prior_2, prior_3, prior_4, prior_mu, prior_sig,
 theta_1, theta_2, theta_3, theta_4, theta_mu, theta_sig, coeff] = nodes


def inner_fn(x_t, s_tm1, s_tm1_is):

    x_1_t = x_1.fprop([x_t])
    x_2_t = x_2.fprop([x_1_t])
Example #3
0
X_mean = train_data.X_mean
X_std = train_data.X_std

valid_data = TIMIT(
    name="valid", path=data_path, frame_size=frame_size, shuffle=0, use_n_gram=1, X_mean=X_mean, X_std=X_std
)

x, x_mask = train_data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, frame_size), dtype=np.float32)
    temp = np.ones((15, batch_size), dtype=np.float32)
    temp[:, -2:] = 0.0
    x_mask.tag.test_value = temp

exp = unpickle(exp_path + exp_name + ".pkl")
nodes = exp.model.nodes
ipdb.set_trace()
names = [node.name for node in nodes]

[main_lstm, x_1, x_2, x_3, x_4, theta_1, theta_2, theta_3, theta_4, theta_mu, theta_sig] = nodes


def inner_fn(x_t, s_tm1):

    x_1_t = x_1.fprop([x_t])
    x_2_t = x_2.fprop([x_1_t])
    x_3_t = x_3.fprop([x_2_t])
    x_4_t = x_4.fprop([x_3_t])

    theta_1_t = theta_1.fprop([s_tm1])
Example #4
0
from cle.cle.utils import unpickle

dir_path = '/home/junyoung/repos/sk/cle/models/nips2015/onomatopoeia/'
#models = ['m0_1', 'm1_1', 'm2_1']
#colors = ['r', 'g', 'b']
#labels = ['RNN-Gaussian', 'RNN-GMM', 'RNN-VAE']
models = ['m0_2', 'm1_2', 're_m2_1', 're_m3_1', 'm2_prior']
colors = ['r', 'g', 'b', 'c', 'k']
labels = ['RNN-Gauss', 'RNN-GMM', 'RNN-VAEGauss', 'RNN-VAEGMM', 'STORN-Gauss']
save_name = 'valid_curves_2.png'

fig = plt.figure()
for i, model in enumerate(models):
    #exp = unpickle(dir_path + 'pkl/' + model + '_best.pkl')
    exp = unpickle(dir_path + 'pkl/' + model + '.pkl')
    mon = np.asarray(exp.trainlog._ddmonitors)

    valid_nll_lower_bound = mon[:, 0]
    legend_size = 10
    print valid_nll_lower_bound.min()

    plt.plot(valid_nll_lower_bound, linestyle='-', color=colors[i], label=labels[i])
    #plt.xscale('log')

#valid_nll_lower_bound = np.load(dir_path + 'pkl/valid_m2_1.npy')
#plt.plot(valid_nll_lower_bound, linestyle='-', color='b', label='RNN-VAE')
plt.legend(loc='upper right', prop={'size': legend_size})
plt.grid()
plt.savefig(dir_path + save_name, bbox_inches='tight', format='png')
Example #5
0
#pkl_name = '$your_model_name'
pkl_name = 'toy_bb_lstm.pkl'

frame_size = 256
# How many examples you want to proceed at a time
batch_size = 100
debug = 0

test_data = BouncingBalls(name='test',
                          path=data_path)

x = test_data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, frame_size), dtype=np.float32)

exp = unpickle(save_path + pkl_name)
nodes = exp.model.nodes
names = [node.name for node in nodes]

[h1, h2, h3, h4] = nodes

s1_0 = h1.get_init_state(batch_size)
s2_0 = h2.get_init_state(batch_size)
s3_0 = h3.get_init_state(batch_size)

x = T.fmatrix()
ts = T.iscalar()

def inner_fn(s1_tm1, s2_tm1, s3_tm1, iter_):

    s1_t = h1.fprop([[iter_], [s1_tm1]])
Example #6
0
save_path = '/u/chungjun/src/cle/saved/'
#pkl_name = '$your_model_name'
pkl_name = 'toy_bb_lstm.pkl'

frame_size = 256
# How many examples you want to proceed at a time
batch_size = 100
debug = 0

test_data = BouncingBalls(name='test', path=data_path)

x = test_data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((15, batch_size, frame_size), dtype=np.float32)

exp = unpickle(save_path + pkl_name)
nodes = exp.model.nodes
names = [node.name for node in nodes]

[h1, h2, h3, h4] = nodes

s1_0 = h1.get_init_state(batch_size)
s2_0 = h2.get_init_state(batch_size)
s3_0 = h3.get_init_state(batch_size)

x = T.fmatrix()
ts = T.iscalar()


def inner_fn(s1_tm1, s2_tm1, s3_tm1, iter_):
frame_size = 200
# How many samples to generate
batch_size = 10
# How many timesteps to generate
n_steps = 480
debug = 0

exp_name = 'm2_3'
save_name = 'm2_3_sample_'

file_name = 'blizzard_unseg_tbptt'
normal_params = np.load(data_path + file_name + '_normal.npz')
X_mean = normal_params['X_mean']
X_std = normal_params['X_std']

exp = unpickle(exp_path + exp_name + '_best.pkl')
nodes = exp.model.nodes
names = [node.name for node in nodes]

output = GaussianLayer(name='output',
                       parent=['theta_mu',
                               'theta_sig'],
                       use_sample=1,
                       nout=frame_size)

[main_lstm, prior, kl,
 x_1, x_2, x_3, x_4,
 z_1, z_2, z_3, z_4,
 phi_1, phi_2, phi_3, phi_4, phi_mu, phi_sig,
 prior_1, prior_2, prior_3, prior_4, prior_mu, prior_sig,
 theta_1, theta_2, theta_3, theta_4, theta_mu, theta_sig] = nodes