Skip to content

Instantly share code, notes, and snippets.

View thomelane's full-sized avatar

Thom Lane thomelane

  • Vancouver
View GitHub Profile
@thomelane
thomelane / main.sh
Last active October 10, 2019 00:34
MXNet Commit Conda env
conda create --name myenv python=3 pip jupyter
source activate myenv
# Installing MXNet package
cd /home/ubuntu/incubator-mxnet/python
# after building shared library libmxnet.so
pip install -e .
# Adding env to Jupyter
# https://stackoverflow.com/questions/39604271/conda-environments-not-showing-up-in-jupyter-notebook
@thomelane
thomelane / main.txt
Last active July 30, 2018 17:42
Why Numpy, vs NDArray, vs Gluon NN
NDArray (vs Numpy):
+ Can use GPU
+ Can use with autograd.
+ More NN specific functions (convolutions, etc)
+ Contiguous memory, better use of the cache, more performant.
- Less functions implemented (although can often make with NDArray)
Gluon NN (vs NDArray)
+ Handles parameters for you (uses same functions under the hood)
@thomelane
thomelane / projects.txt
Last active December 18, 2018 03:02
MXNet Useful projects
mxnet_Realtime_Multi-Person_Pose_Estimation
Fully Convolutional Instance-aware Semantic Segmentation
@thomelane
thomelane / jupyter_gym_render.py
Created September 11, 2018 00:40
OpenAI Gym render in Jupyter
import gym
from IPython import display
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
env = gym.make('Breakout-v0')
env.reset()
img = plt.imshow(env.render(mode='rgb_array')) # only call this once
for _ in range(100):
@thomelane
thomelane / commands.md
Last active September 13, 2018 23:55
Coach Install on AWS EC2 p3.2xlarge

On local MacOS machine...

  1. Install XQuartz (https://www.xquartz.org/)
  2. Enable GLX for XQuartz, by running following in terminal;

defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

  1. Start AWS EC2 p3.2xlarge instance
  2. SSH onto instance using -X option, e.g. ssh -X -i keypair.pem ubuntu@instance-ip.com
  3. XQuartz window should open on local machine
@thomelane
thomelane / commands.txt
Last active September 17, 2018 01:35
GLX on P3
# dependencies
sudo apt install x11-apps
sudo apt install xorg
sudo apt install x11vnc
# for basic gui
sudo /usr/bin/X :0 &
DISPLAY=:0 xclock &
x11vnc -passwd testtest -display :0
# connect with vnc client (avaliable at localhost:5900 if ssh with port forwarding)
@thomelane
thomelane / xorg.conf
Created September 14, 2018 07:10
P3 xorg
Section "Files"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
@thomelane
thomelane / conv.py
Created September 20, 2018 23:11
[Convolutions on Medium] Used in Medium blog post series #python #convolutions
def apply_conv(data, kernel, conv):
"""
Args:
data (NDArray): input data.
kernel (NDArray): convolution's kernel parameters.
conv (Block): convolutional layer.
Returns:
NDArray: output data (after applying convolution).
"""
# add dimensions for batch and channels if necessary
@thomelane
thomelane / layouts.csv
Last active September 21, 2018 06:37
Convolution layouts on Medium
Convolution Input Layout Kernel Layout Output Layout
1D (batch_size,in_channels,width) (channels,in_channels,width) (batch_size,channels,width)
2D (batch_size,in_channels,height,width) (channels,in_channels,height,width) (batch_size,channels,height,width)
3D (batch_size,in_channels,depth,height,width) (channels,in_channels,depth,height,width) (batch_size,channels,depth,height,width)
@thomelane
thomelane / main.sh
Last active February 7, 2019 06:27
Git Commands
# Rename branch (local and remote)
git branch -m new_name
git push origin :old_name new_name
git push origin -u new_name
# checkout PR on github
git clone https://github.com/apache/incubator-mxnet.git
git fetch origin pull/13647/head:lipnet
git checkout lipnet