Skip to content

Instantly share code, notes, and snippets.

Jaemin Cho j-min

Block or report user

Report or block j-min

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@odashi
odashi / chainer_encoder_decoder.py
Last active Jan 1, 2017
Training and generation processes for neural encoder-decoder machine translation.
View chainer_encoder_decoder.py
#!/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
@wookayin
wookayin / reload-tensorflow-flags.py
Last active Mar 12, 2018
Reset tensorflow tf.app.flags, in ipython notebook
View reload-tensorflow-flags.py
# use the following snippet in your ipython notebook shell
import argparse
import tensorflow as tf
tf.app.flags.FLAGS = tf.python.platform.flags._FlagValues()
tf.app.flags._global_parser = argparse.ArgumentParser()
@ckinsey
ckinsey / chain.py
Last active Aug 19, 2018
Chain.py Builds the Markov Models from Slack
View chain.py
import json
import markovify
import re
import time
from slackclient import SlackClient
BOT_TOKEN = "insert bot token here"
@volkancirik
volkancirik / treernn.py
Last active Oct 9, 2018
Pytorch TreeRNN
View treernn.py
"""
TreeLSTM[1] implementation in Pytorch
Based on dynet benchmarks :
https://github.com/neulab/dynet-benchmark/blob/master/dynet-py/treenn.py
https://github.com/neulab/dynet-benchmark/blob/master/chainer/treenn.py
Other References:
https://github.com/pytorch/examples/tree/master/word_language_model
https://github.com/pfnet/chainer/blob/29c67fe1f2140fa8637201505b4c5e8556fad809/chainer/functions/activation/slstm.py
https://github.com/stanfordnlp/treelstm
@danijar
danijar / blog_tensorflow_sequence_classification.py
Last active Apr 29, 2019
TensorFlow Sequence Classification
View blog_tensorflow_sequence_classification.py
# Example for my blog post at:
# https://danijar.com/introduction-to-recurrent-networks-in-tensorflow/
import functools
import sets
import tensorflow as tf
def lazy_property(function):
attribute = '_' + function.__name__
@spitis
spitis / bnlstm.py
Created Feb 2, 2017
Batch normalized LSTM Cell for Tensorflow
View bnlstm.py
"""adapted from https://github.com/OlavHN/bnlstm to store separate population statistics per state"""
import tensorflow as tf, numpy as np
RNNCell = tf.nn.rnn_cell.RNNCell
class BNLSTMCell(RNNCell):
'''Batch normalized LSTM as described in arxiv.org/abs/1603.09025'''
def __init__(self, num_units, is_training_tensor, max_bn_steps, initial_scale=0.1, activation=tf.tanh, decay=0.95):
"""
* max bn steps is the maximum number of steps for which to store separate population stats
"""
@nikitakit
nikitakit / tf_beam_decoder.py
Last active Aug 16, 2019
Tensorflow Beam Search
View tf_beam_decoder.py
"""
Beam decoder for tensorflow
Sample usage:
```
from tf_beam_decoder import beam_decoder
decoded_sparse, decoded_logprobs = beam_decoder(
cell=cell,
@monikkinom
monikkinom / rnn-lstm.py
Last active Sep 3, 2019
Tensorflow RNN-LSTM implementation to count number of set bits in a binary string
View rnn-lstm.py
#Source code with the blog post at http://monik.in/a-noobs-guide-to-implementing-rnn-lstm-using-tensorflow/
import numpy as np
import random
from random import shuffle
import tensorflow as tf
# from tensorflow.models.rnn import rnn_cell
# from tensorflow.models.rnn import rnn
NUM_EXAMPLES = 10000
@VikingPenguinYT
VikingPenguinYT / dropout_bayesian_approximation_tensorflow.py
Last active Oct 29, 2019
Implementing Dropout as a Bayesian Approximation in TensorFlow
View dropout_bayesian_approximation_tensorflow.py
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.contrib.distributions import Bernoulli
class VariationalDense:
"""Variational Dense Layer Class"""
def __init__(self, n_in, n_out, model_prob, model_lam):
self.model_prob = model_prob
@danijar
danijar / blog_tensorflow_variable_sequence_labelling.py
Last active Oct 31, 2019
TensorFlow Variable-Length Sequence Labelling
View blog_tensorflow_variable_sequence_labelling.py
# Working example for my blog post at:
# http://danijar.com/variable-sequence-lengths-in-tensorflow/
import functools
import sets
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell
from tensorflow.models.rnn import rnn
def lazy_property(function):
You can’t perform that action at this time.