Skip to content

Instantly share code, notes, and snippets.

@reuben
reuben / keybase.md
Created February 2, 2017 21:32
keybase.md

Keybase proof

I hereby claim:

  • I am reuben on github.
  • I am reuben_ (https://keybase.io/reuben_) on keybase.
  • I have a public key whose fingerprint is B19B 574B E186 B1BF CD23 9A86 B21F EB8E D85D 838C

To claim this, I am signing this object:

def model(batch_x, seq_length, dropout):
def clipped_relu(x):
return tf.minimum(tf.nn.relu(x), relu_clip)
with slim.arg_scope([slim.variable], device="/cpu:0"):
with slim.arg_scope([slim.fully_connected], activation_fn=clipped_relu):
with slim.arg_scope([slim.dropout], keep_prob=(1.0 - dropout)):
fc_1 = slim.dropout(slim.fully_connected(batch_x, n_hidden_1))
fc_2 = slim.dropout(slim.fully_connected(fc_1, n_hidden_2))
fc_3 = slim.dropout(slim.fully_connected(fc_2, n_hidden_3))
import tensorflow as tf
q1 = tf.FIFOQueue(capacity=100, dtypes=[tf.int32], shapes=[[]])
q2 = tf.FIFOQueue(capacity=100, dtypes=[tf.int32], shapes=[[]])
q3 = tf.FIFOQueue(capacity=100, dtypes=[tf.int32], shapes=[[]])
idx = tf.placeholder(tf.int32)
def deq1():
return tf.Print(q1.dequeue(), [1], "deq1 called")
Epoch: 0006 avg_cer= 0.353960361
################################################################################
Training WER: 0.918583
--------------------------------------------------------------------------------
- WER: 0.333333
- loss: 6.105622
- source: "the day before"
- result: "the day befr"
--------------------------------------------------------------------------------
################################################################################
Training WER: 1.155599
--------------------------------------------------------------------------------
- WER: 0.333333
- loss: 6.089048
- source: "this is the"
- result: "this is thef"
--------------------------------------------------------------------------------
- WER: 0.500000
- loss: 3.750518
Epoch: 0001 avg_cer= 0.778651515
################################################################################
Training WER: 0.996094
--------------------------------------------------------------------------------
- WER: 1.000000
- loss: 2.899460
- source: "and"
- result: "an"
--------------------------------------------------------------------------------
import tensorflow as tf
import numpy as np
import os
from util.audio import audiofile_to_input_vector
from util.text import *
from glob import glob
from threading import Thread
from Queue import Queue
diff --git a/util/importers/fisher.py b/util/importers/fisher.py
index 8cc4e70..53f65b3 100644
--- a/util/importers/fisher.py
+++ b/util/importers/fisher.py
@@ -150,10 +150,11 @@ def _maybe_convert_wav(data_dir, original_data, converted_data):
for root, dirnames, filenames in os.walk(source_dir):
for filename in fnmatch.filter(filenames, "*.sph"):
sph_file = os.path.join(root, filename)
- wav_filename = os.path.splitext(os.path.basename(sph_file))[0] + ".wav"
- wav_file = os.path.join(target_dir, wav_filename)
curl -LO https://www.ldc.upenn.edu/sites/www.ldc.upenn.edu/files/ctools/sph2pipe_v2.5.tar.gz
tar xf sph2pipe_v2.5.tar.gz
pushd sph2pipe_v2.5
gcc -o sph2pipe *.c -lm
sudo cp sph2pipe /usr/bin
popd
rm -r sph2pipe_v2.5{,.tar.gz}
@reuben
reuben / 1_rsa_encrypt.py
Last active May 17, 2016 22:33
RSA toy impl
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
def rand_prime(n):
n = n+1 if n % 2 == 0 else n
while True:
p = random.randrange(n, 2*n, 2)
if all(p % n != 0 for n in range(3, int((p ** 0.5) + 1), 2)):