Esempio n. 1
0
from cle.cle.train import Training
from cle.cle.train.ext import (EpochCount, GradientClipping, Monitoring,
                               Picklize)
from cle.cle.train.opt import Adam
from cle.cle.utils import flatten, OrderedDict
from cle.datasets.bouncing_balls import BouncingBalls

data_path = '/home/junyoung/data/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
save_path = '/home/junyoung/src/cle/saved/'

batch_size = 128
frame_size = 256
debug = 0

model = Model()
train_data = BouncingBalls(name='train', path=data_path)

valid_data = BouncingBalls(name='valid', path=data_path)

init_W = InitCell('randn')
init_U = InitCell('ortho')
init_b = InitCell('zeros')

x, y = train_data.theano_vars()
if debug:
    x.tag.test_value = np.zeros((10, batch_size, frame_size), dtype=np.float32)
    y.tag.test_value = np.zeros((10, batch_size, frame_size), dtype=np.float32)

h1 = LSTM(name='h1',
          parent=['x'],
          parent_dim=[frame_size],
Esempio n. 2
0
from cle.cle.train.opt import Adam
from cle.cle.utils import unpack, OrderedDict
from cle.datasets.bouncing_balls import BouncingBalls


#data_path = '/data/lisatmp3/chungjun/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
#save_path = '/u/chungjun/repos/cle/saved/'
data_path = '/home/junyoung/data/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
save_path = '/home/junyoung/repos/cle/saved/'

batch_size = 128
res = 256
debug = 0

model = Model()
trdata = BouncingBalls(name='train',
                       path=data_path)

init_W = InitCell('randn')
init_U = InitCell('ortho')
init_b = InitCell('zeros')

model.inputs = trdata.theano_vars()
x, y = model.inputs
if debug:
    x.tag.test_value = np.zeros((10, batch_size, res), dtype=np.float32)
    y.tag.test_value = np.zeros((10, batch_size, res), dtype=np.float32)

inputs = [x, y]
inputs_dim = {'x':256, 'y':256}

h1 = GFLSTM(name='h1',
Esempio n. 3
0
    Picklize
)
from cle.cle.train.opt import Adam
from cle.cle.utils import init_tparams, OrderedDict
from cle.datasets.bouncing_balls import BouncingBalls


data_path = '/data/lisatmp3/chungjun/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
save_path = '/u/chungjun/repos/cle/saved/'

batch_size = 128
frame_size = 256
debug = 0

model = Model()
train_data = BouncingBalls(name='train',
                           path=data_path)

valid_data = BouncingBalls(name='valid',
                           path=data_path)

x, y = train_data.theano_vars()

if debug:
    x.tag.test_value = np.zeros((10, batch_size, frame_size), dtype=np.float32)
    y.tag.test_value = np.zeros((10, batch_size, frame_size), dtype=np.float32)

init_W = InitCell('randn')
init_U = InitCell('ortho')
init_b = InitCell('zeros')

h1 = GFLSTM(name='h1',
Esempio n. 4
0
                               Picklize)
from cle.cle.train.opt import Adam
from cle.cle.utils import unpack, OrderedDict
from cle.datasets.bouncing_balls import BouncingBalls

#data_path = '/data/lisatmp3/chungjun/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
#save_path = '/u/chungjun/repos/cle/saved/'
data_path = '/home/junyoung/data/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
save_path = '/home/junyoung/repos/cle/saved/'

batch_size = 128
res = 256
debug = 0

model = Model()
trdata = BouncingBalls(name='train', path=data_path)

init_W = InitCell('randn')
init_U = InitCell('ortho')
init_b = InitCell('zeros')

model.inputs = trdata.theano_vars()
x, y = model.inputs
if debug:
    x.tag.test_value = np.zeros((10, batch_size, res), dtype=np.float32)
    y.tag.test_value = np.zeros((10, batch_size, res), dtype=np.float32)

inputs = [x, y]
inputs_dim = {'x': 256, 'y': 256}

h1 = GFLSTM(name='h1',
Esempio n. 5
0
from cle.datasets.bouncing_balls import BouncingBalls


#data_path = '$your_data_path'
data_path = '/data/lisatmp3/chungjun/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
#save_path = '$your_model_path'
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)
Esempio n. 6
0
from cle.cle.utils import unpickle, tolist, OrderedDict
from cle.datasets.bouncing_balls import BouncingBalls

#data_path = '$your_data_path'
data_path = '/data/lisatmp3/chungjun/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
#save_path = '$your_model_path'
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)
Esempio n. 7
0
from cle.cle.train.opt import Adam
from cle.cle.utils import unpack, OrderedDict
from cle.datasets.bouncing_balls import BouncingBalls


#data_path = '/data/lisatmp3/chungjun/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
#save_path = '/u/chungjun/repos/cle/saved/'
data_path = '/home/junyoung/data/bouncing_balls/bouncing_ball_2balls_16wh_20len_50000cases.npy'
save_path = '/home/junyoung/repos/cle/saved/'

batch_size = 128
res = 256
debug = 0

model = Model()
train_data = BouncingBalls(name='train',
                           path=data_path)

# Choose the random initialization method
init_W = InitCell('randn')
init_U = InitCell('ortho')
init_b = InitCell('zeros')

# Define nodes: objects
model.inputs = train_data.theano_vars()
x, y = model.inputs
# You must use THEANO_FLAGS="compute_test_value=raise" python -m ipdb
if debug:
    x.tag.test_value = np.zeros((10, batch_size, res), dtype=np.float32)
    y.tag.test_value = np.zeros((10, batch_size, res), dtype=np.float32)

inputs = [x, y]