Skip to content

Instantly share code, notes, and snippets.

View igormq's full-sized avatar

Igor Macedo Quintanilha igormq

View GitHub Profile
@igormq
igormq / example_classification_rnn.py
Created February 6, 2017 19:49
An example of classification using RNN
# Compatibility imports
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import tensorflow as tf
import scipy.io.wavfile as wav
import numpy as np
@igormq
igormq / tf_beam_decoder.py
Created June 27, 2016 21:03 — forked from nikitakit/tf_beam_decoder.py
Tensorflow Beam Search
import tensorflow as tf
def beam_decoder(decoder_inputs, initial_state, cell, loop_function, scope=None,
beam_size=7, done_token=0
):
"""
Beam search decoder
Args:
decoder_inputs: A list of 2D Tensors [batch_size x input_size].
@igormq
igormq / beamsearch.py
Created June 27, 2016 21:01 — forked from udibr/beamsearch.py
beam search for Keras RNN
# variation to https://github.com/ryankiros/skip-thoughts/blob/master/decoding/search.py
def keras_rnn_predict(samples, empty=empty, rnn_model=model, maxlen=maxlen):
"""for every sample, calculate probability for every possible label
you need to supply your RNN model and maxlen - the length of sequences it can handle
"""
data = sequence.pad_sequences(samples, maxlen=maxlen, value=empty)
return rnn_model.predict(data, verbose=0)
def beamsearch(predict=keras_rnn_predict,
# Working example for my blog post at:
# http://danijar.com/introduction-to-recurrent-networks-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):
require 'fileutils'
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku.
# The deploy branch is rebased onto master, so the push needs to be forced.
desc "Deploy app to Heroku after precompiling assets"
task :deploy do
deploy_branch = 'heroku'
remote = 'heroku'
deploy_repo_dir = "tmp/heroku_deploy"
@igormq
igormq / postinstall.sh
Created November 20, 2012 17:52 — forked from bamorim/postinstall.sh
My post-install script for Ubuntu.
#!/bin/bash
# Add some PPAs
sudo add-apt-repository -y ppa:webupd8team/sublime-text-2 #sublime text
sudo add-apt-repository -y ppa:tualatrix/ppa #ubuntu tweak
sudo add-apt-repository ppa:hertzog/nautilus-dropbox #nautilus-dropbox
sudo apt-get update
# upgrade dist
sudo apt-get upgrade