This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def compare_rl_and_gail(metric, window, ylabel=None, xlim=None, fs=15, ncol=2): | |
| df1 = df_rl[df_rl['config.rp_weight'] == 1.0] | |
| df2 = df_rl[df_rl['config.rp_weight'] == 0.0] | |
| df3 = df_gail[df_gail['config.rmt.top_k_percent'] == 0.] | |
| df4 = df_gail[df_gail['config.rmt.top_k_percent'] == 0.25] | |
| df5 = df_gail[df_gail['config.rmt.top_k_percent'] == 0.5] | |
| df6 = df_gail[df_gail['config.rmt.top_k_percent'] == 0.75] | |
| for i, df in enumerate([df1, df2, df3, df4, df5, df6]): | |
| value = 100 * pandas.rolling_mean(average_value(df, metric), window) | |
| print(value.iloc[-1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def plot_key_alphas(data, softmax=True, fixed_axis=True): | |
| f, axes = pyplot.subplots(1, 3) | |
| f.set_size_inches((15, 2)) | |
| for k in range(3): | |
| arr = numpy.array(data[k]) | |
| arr = arr[:, [4, 5, 7]] | |
| if softmax: | |
| arr = numpy.exp(arr) / numpy.exp(arr).sum(axis=1)[:, None] | |
| else: | |
| arr = arr / arr.sum(axis=1)[:, None] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def load_alpha_data(log_file): | |
| data = [[], [], []] | |
| with open(log_file) as log: | |
| for line in log: | |
| if line.startswith('data'): | |
| num = int(line[5]) | |
| row = [float(x) for x in line[7:].split()] | |
| data[num].append(row) | |
| return data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ModuleNotFoundError Traceback (most recent call last) | |
| <ipython-input-2-84c8d19d2bb4> in <module>() | |
| ----> 1 from shapeworld import Dataset | |
| 2 | |
| 3 dataset = Dataset.create(dtype='agreement', name='multishape') | |
| 4 generated = dataset.generate(n=128, mode='train', include_model=True) | |
| 5 | |
| ~/Dist/ShapeWorld/shapeworld/__init__.py in <module>() | |
| ----> 1 from shapeworld.dataset import Dataset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Traceback (most recent call last): | |
| File "/u/bahdanau/.conda/envs/py36clone/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2910, in run_code | |
| exec(code_obj, self.user_global_ns, self.user_ns) | |
| File "<ipython-input-2-84c8d19d2bb4>", line 1, in <module> | |
| from shapeworld import Dataset | |
| File "/u/bahdanau/Dist/ShapeWorld/shapeworld/__init__.py", line 1, in <module> | |
| from shapeworld.dataset import Dataset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Question: "Is there a cyan shiny thing of the same size as the block?" | |
| No | |
| Is there a cyan shiny thing of the same size as the block? no | |
| FiLM layer 0 | |
| (size, 6.938) (the, 5.774) (same, 3.317) (there, 3.068) (as, 3.067) (cyan, 2.567) (Is, 0.406) | |
| FiLM layer 1 | |
| (the, 6.826) (same, 4.392) (as, 4.130) (size, 3.484) (cyan, 2.280) (there, 2.038) (block, 0.408) (that, 0.262) (a, 0.135) (any, 0.112) | |
| FiLM layer 2 | |
| (the, 9.060) (size, 4.601) (as, 3.907) (same, 2.995) (cyan, 1.927) (there, 1.653) (of, 0.022) | |
| FiLM layer 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Using cuDNN version 5105 on context None | |
| Preallocating 14677/16308 Mb (0.900000) on cuda | |
| Mapped name None to device cuda: Tesla P100-SXM2-16GB (0000:0A:00.0) | |
| I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally | |
| I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally | |
| I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally | |
| I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally | |
| I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally | |
| /Tmp/lisa/os_v5/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py:913: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter. | |
| warnings.warn(self.msg_depr % (key, alt_key)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| import numpy | |
| import time | |
| # The computation graph (in fact just an LSTM language model) | |
| batch_size = 100 | |
| vocab_size = 50000 | |
| dim = 512 | |
| inputs = tf.placeholder(tf.int32, [batch_size, None], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| init_step = tf.constant(1) | |
| init_states = tf.TensorArray(tf.float32, size=n_steps, clear_after_read=False) | |
| init_states = init_states.write(0, tf.ones((128, 128))) | |
| def should_continue(step, states): | |
| return step < n_steps | |
| def iteration(step, states): | |
| previous_states = states.gather(tf.range(step)) | |
| return step + 1, states.write(step, tf.reduce_sum(previous_states, 0) + 1) | |
| _, states = tf.while_loop(should_continue, iteration, [init_step, init_states]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function profiling | |
| ================== | |
| Message: /u/bahdanau/Dist/fully-neural-lvsr/libs/blocks/blocks/monitoring/evaluators.py:181 | |
| Time in 100 calls to Function.__call__: 2.154827e-03s | |
| Time in Function.fn.__call__: 9.248257e-04s (42.919%) | |
| Total compile time: 4.125585e+00s | |
| Number of Apply nodes: 0 | |
| Theano Optimizer time: 6.079912e-03s | |
| Theano validate time: 0.000000e+00s | |
| Theano Linker time (includes C, CUDA code generation/compiling): 9.608269e-05s |