Skip to content

Instantly share code, notes, and snippets.

View domluna's full-sized avatar
🐺
howling time

Dominique Luna domluna

🐺
howling time
View GitHub Profile
@domluna
domluna / README
Last active July 14, 2017 00:15
Proportional Cross-Entropy Method on CartPole-v0
To replicate run
python cem.py --algorithm pcem --outdir CartPole-v0-pcem
The --outdir argument is optional. If left as is results will be written to /tmp/CartPole-v0-pcem.
@domluna
domluna / .zshrc
Created May 6, 2016 02:55
new zsh config with zgen
# User configuration
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
# add cuda tools to command path
export PATH=/usr/local/cuda/bin:${PATH}
export MANPATH=/usr/local/cuda/man:${MANPATH}
# add cuda libraries to library path
@domluna
domluna / README.md
Last active February 28, 2018 12:08
Vanilla policy gradient, no baseline

Run with defaults

python vpg.py

@domluna
domluna / conv_tf.py
Created May 26, 2016 17:42
For reference of using tf.get_variable
def conv2d(inputs, filter, strides, name='conv2d'):
k = tf.get_variable('W', filter, initializer=xavier_initializer_conv2d())
b = tf.get_variable('b', filter[-1], initializer=tf.constant_initializer(0.0))
conv = tf.nn.conv2d(inputs, k, strides, 'SAME')
bias_add = tf.nn.bias_add(conv, b)
return tf.nn.relu(bias_add, name=name)
def vision_model(frames, n_frames):
with tf.variable_scope('Conv1') as scope:
@domluna
domluna / foo.py
Created June 2, 2016 05:57
Tensorflow grayscale + resizing. Session + feed dict is for having a static op.
def rgb2y_resize(input_shape, new_height, new_width, session):
img = tf.placeholder(tf.float32, shape=input_shape)
reshaped = tf.reshape(img, [1] + list(input_shape))
rgb2y = tf.image.rgb_to_grayscale(reshaped)
bilinear = tf.image.resize_bilinear(rgb2y, [new_height, new_width])
squeezed = tf.squeeze(bilinear)
return lambda x: session.run(squeezed, feed_dict={img: x})
@domluna
domluna / foo.py
Last active April 12, 2018 23:37
Print the size in bytes of a Tensorflow GraphDef
import tensorflow as tf
def main():
files = ['model-' + str(x) for x in range(20000, 70000, 10000)]
for f in files:
with tf.Graph().as_default():
sess = tf.Session()
saver = tf.train.import_meta_graph('./test_graph_size/' + f + '.meta')
saver.restore(sess, './test_graph_size/' + f)
print(sess.graph_def.ByteSize())
@domluna
domluna / CMakeError.log
Created June 11, 2016 16:21
vizdoom install errors
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/dom/src/ViZDoom/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_0b041/fast"
/usr/bin/make -f CMakeFiles/cmTC_0b041.dir/build.make CMakeFiles/cmTC_0b041.dir/build
make[1]: Entering directory '/home/dom/src/ViZDoom/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_0b041.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTC_0b041.dir/CheckSymbolExists.c.o -c /home/dom/src/ViZDoom/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_0b041
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0b041.dir/link.txt --verbose=1
@domluna
domluna / rgb2gray_resize.py
Last active June 13, 2016 17:00
example of rgb2gray + resizing images
from __future__ import absolute_import
from __future__ import print_function
from __future__ import absolute_import
import warnings
from skimage.color import rgb2gray
from skimage.transform import resize
from skimage import img_as_ubyte
@domluna
domluna / gist:efe1f842239661e490384c9fb4f588fc
Created June 25, 2016 15:32
Gym monitor multiple envs error
[2016-06-25 11:30:22,674] Creating monitor directory /tmp/tmp_EkGLw/monitor
[2016-06-25 11:30:22,924] Starting new video recorder writing to /tmp/tmp_EkGLw/monitor/openaigym.video.0.22978.video000000.mp4
[2016-06-25 11:30:22,932] Starting new video recorder writing to /tmp/tmp_EkGLw/monitor/openaigym.video.1.22978.video000000.mp4
[2016-06-25 11:30:22,934] Starting new video recorder writing to /tmp/tmp_EkGLw/monitor/openaigym.video.2.22978.video000000.mp4
[2016-06-25 11:30:22,940] Starting new video recorder writing to /tmp/tmp_EkGLw/monitor/openaigym.video.3.22978.video000000.mp4
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
[1] 22978 abort (core dumped) python examples/run_a3c.py --name Acrobot-v0 --learning_rate 0.05 4
@domluna
domluna / .flowconfig
Created June 26, 2016 17:47
Sample flowconfig from Ian Sinnott
[ignore]
.*/node_modules/fbjs/.*
[include]
[libs]
[options]
module.name_mapper.extension='css' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'
module.name_mapper.extension='styl' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'