Skip to content

Instantly share code, notes, and snippets.

View skaasj's full-sized avatar

Sungjin Ahn skaasj

View GitHub Profile
@skaasj
skaasj / chainer_encoder_decoder.py
Created September 28, 2015 14:06 — forked from odashi/chainer_encoder_decoder.py
Training and generation processes for neural encoder-decoder machine translation.
#!/usr/bin/python3
import datetime
import sys
import math
import numpy as np
from argparse import ArgumentParser
from collections import defaultdict
from chainer import FunctionSet, Variable, functions, optimizers
@skaasj
skaasj / min-char-rnn.py
Created September 27, 2015 12:50 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@skaasj
skaasj / gist:8d2f1ef9976d8b7ca514
Created September 27, 2015 12:50 — forked from karpathy/gist:587454dc0146a6ae21fc
An efficient, batched LSTM.
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):
@skaasj
skaasj / conv_deconv_vae.py
Last active September 17, 2015 16:24 — forked from kastnerkyle/conv_deconv_vae.py
Convolutional Variational Autoencoder, modified from Alec Radford at (https://gist.github.com/Newmu/a56d5446416f5ad2bbac)
# Alec Radford, Indico, Kyle Kastner
# License: MIT
"""
Convolutional VAE in a single file.
Bringing in code from IndicoDataSolutions and Alec Radford (NewMu)
Additionally converted to use default conv2d interface instead of explicit cuDNN
"""
import theano
import theano.tensor as T
from theano.compat.python2x import OrderedDict
@skaasj
skaasj / vae.py
Last active September 17, 2015 16:23 — forked from kastnerkyle/vae.py
VAE in a single file
# Alec Radford, Indico, Kyle Kastner
# License: MIT
"""
VAE in a single file.
Bringing in code from IndicoDataSolutions and Alec Radford (NewMu)
"""
import theano
import theano.tensor as T
from theano.compat.python2x import OrderedDict
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams