Skip to content

Instantly share code, notes, and snippets.

@cweng6
cweng6 / commands
Created September 7, 2019 22:53 — forked from RuABraun/commands
Using pybind11 to read in kaldi ark features from python
# Compile
g++ -O3 -Wall -shared -std=c++11 -fPIC util/python-rw.cc `py3 -m pybind11 --includes` -I. -Lbase/ -Lutil/ -Lmatrix/ -lkaldi-base -lkaldi-util -lkaldi-matrix -o python_rw.so
# edit LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/seni/git/kaldi/src/base:/home/seni/git/kaldi/src/util:/home/seni/git/kaldi/src/matrix
# Use
>>> import python_rw
>>> reader = python_rw.Pykread("ark:data/raw_fbank_train_cleaned_fbank.1.ark")
>>> k, m = reader.get()
>>> k
@cweng6
cweng6 / lstm-lm.py
Last active August 29, 2015 14:11 — forked from neubig/lstm-lm.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is a simplified implementation of the LSTM language model (by Graham Neubig)
#
# LSTM Neural Networks for Language Modeling
# Martin Sundermeyer, Ralf Schlüter, Hermann Ney
# InterSpeech 2012
#
# The structure of the model is extremely simple. At every time step we