Skip to content

Commit

Permalink
Merge pull request #25 from fmetze/master
Browse files Browse the repository at this point in the history
Clean-up of dynamic compilation plus a grab bag of other things
  • Loading branch information
yajiemiao committed Dec 30, 2015
2 parents 75289d6 + fdd2117 commit 95a2c61
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# Compiled Object files
*.o

# Compiled Static libraries
*.a
# Compiled Static and Dynamic libraries
*.a *.so

# Make dependencies
.depend.mk
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ Refer to RESULTS under each [example setup](asr_egs/).

### References

For more informaiton, refer to the following paper(s):
For more information, please refer to the following paper(s):

[EESEN: End-to-End Speech Recognition using Deep RNN Models and WFST-based Decoding](http://arxiv.org/abs/1507.08240), ASRU 2015.
Yajie Miao, Mohammad Gowayyed, and Florian Metze, "[EESEN: End-to-End Speech Recognition using Deep RNN Models and WFST-based Decoding](http://arxiv.org/abs/1507.08240)," in Proc. ASRU 2015.
2 changes: 1 addition & 1 deletion src/feat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ OBJFILES = srfft.o cmvn.o feature-functions.o feature-mfcc.o feature-plp.o featu

LIBNAME = feat

ADDLIBS = ../util/util.a ../cpucompute/cpucompute.a ../base/base.a ../thread/thread.a
ADDLIBS = ../util/util.a ../cpucompute/cpucompute.a ../base/base.a

include ../makefiles/default_rules.mk

2 changes: 1 addition & 1 deletion src/featbin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ EXTRA_CXXFLAGS = -Wno-sign-compare
include ../config.mk

BINFILES = compute-mfcc-feats compute-plp-feats compute-fbank-feats \
compute-cmvn-stats add-deltas apply-cmvn copy-feats extract-segments feat-to-len \
compute-cmvn-stats add-deltas apply-cmvn copy-feats extract-segments feat-to-len feat-to-dim \
compute-kaldi-pitch-feats process-kaldi-pitch-feats paste-feats

OBJFILES =
Expand Down
69 changes: 69 additions & 0 deletions src/featbin/feat-to-dim.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// featbin/feat-to-dim.cc

// Copyright 2009-2011 Microsoft Corporation

// See ../../COPYING for clarification regarding multiple authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing permissions and
// limitations under the License.

#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "cpucompute/matrix.h"


int main(int argc, char *argv[]) {
try {
using namespace eesen;

const char *usage =
"Reads an archive of features. If second argument is wxfilename, writes\n"
"the feature dimension of the first feature file; if second argument is\n"
"wspecifier, writes an archive of the feature dimension, indexed by utterance\n"
"id.\n"
"Usage: feat-to-dim [options] <feat-rspecifier> (<dim-wspecifier>|<dim-wxfilename>)\n"
"e.g.: feat-to-dim scp:feats.scp -\n";

ParseOptions po(usage);

po.Read(argc, argv);

if (po.NumArgs() != 2) {
po.PrintUsage();
exit(1);
}

std::string rspecifier = po.GetArg(1);
std::string wspecifier_or_wxfilename = po.GetArg(2);

SequentialBaseFloatMatrixReader kaldi_reader(rspecifier);

if (ClassifyWspecifier(wspecifier_or_wxfilename, NULL, NULL, NULL)
!= kNoWspecifier) {
Int32Writer dim_writer(wspecifier_or_wxfilename);
for (; !kaldi_reader.Done(); kaldi_reader.Next())
dim_writer.Write(kaldi_reader.Key(), kaldi_reader.Value().NumCols());
} else {
if (kaldi_reader.Done())
KALDI_ERR << "Could not read any features (empty archive?)";
Output ko(wspecifier_or_wxfilename, false); // text mode.
ko.Stream() << kaldi_reader.Value().NumCols() << "\n";
}
return 0;
} catch(const std::exception &e) {
std::cerr << e.what();
return -1;
}
}


2 changes: 1 addition & 1 deletion src/net/ctc-loss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void Ctc::Eval(const CuMatrixBase<BaseFloat> &net_out, const std::vector<int32>

// progressive reporting
{
if (sequences_progress_ > report_step_) {
if (sequences_progress_ >= report_step_) {
KALDI_VLOG(1) << "After " << sequences_num_ << " sequences (" << frames_/(100.0 * 3600) << "Hr): "
<< "Obj(log[Pzx]) = " << obj_progress_/sequences_progress_
<< " TokenAcc = " << 100.0*(1.0 - error_num_progress_/ref_num_progress_) << "%";
Expand Down
2 changes: 1 addition & 1 deletion src/netbin/train-ctc-parallel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) {
try {
const char *usage =
"Perform one iteration of CTC training by SGD.\n"
"The updates are done per-utternace and by processing multiple utterances in parallel.\n"
"The updates are done per-utterance and by processing multiple utterances in parallel.\n"
"\n"
"Usage: train-ctc-parallel [options] <feature-rspecifier> <labels-rspecifier> <model-in> [<model-out>]\n"
"e.g.: \n"
Expand Down
12 changes: 8 additions & 4 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
CXX = g++
# CXX = clang++ # Uncomment this line to build with Clang.

OPENFST_VERSION = 1.3.4
# OPENFST_VERSION = 1.3.4
# Uncomment the next line to build with OpenFst-1.4.1.
# OPENFST_VERSION = 1.4.1
OPENFST_VERSION = 1.4.1
# Note: OpenFst >= 1.4 requires C++11 support, hence you will need to use a
# relatively recent C++ compiler, e.g. gcc >= 4.6, clang >= 3.0.

Expand Down Expand Up @@ -92,6 +92,7 @@ openfst-$(OPENFST_VERSION): openfst-$(OPENFST_VERSION).tar.gz

openfst-$(OPENFST_VERSION).tar.gz:
wget http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-$(OPENFST_VERSION).tar.gz || \
curl -s http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-$(OPENFST_VERSION).tar.gz -o openfst-$(OPENFST_VERSION).tar.gz || \
wget -T 10 -t 3 http://www.openslr.org/resources/2/openfst-$(OPENFST_VERSION).tar.gz

sclite: sclite_compiled
Expand All @@ -113,7 +114,8 @@ sctk: sctk-2.4.9-20141015-1634Z.tar.bz2
rm -rf sctk && ln -s sctk-2.4.9 sctk

sctk-2.4.9-20141015-1634Z.tar.bz2:
wget -T 10 -t 3 ftp://jaguar.ncsl.nist.gov/pub/sctk-2.4.9-20141015-1634Z.tar.bz2|| \
wget -T 10 -t 3 ftp://jaguar.ncsl.nist.gov/pub/sctk-2.4.9-20141015-1634Z.tar.bz2 || \
curl -s ftp://jaguar.ncsl.nist.gov/pub/sctk-2.4.9-20141015-1634Z.tar.bz2 -o sctk-2.4.9-20141015-1634Z.tar.bz2 || \
wget --no-check-certificate -T 10 http://www.openslr.org/resources/4/sctk-2.4.9-20141015-1634Z.tar.bz2


Expand All @@ -124,7 +126,8 @@ ATLAS/include/cblas.h: | atlas3.8.3.tar.gz

atlas3.8.3.tar.gz:
wget -T 10 ftp://ftp.vim.org/vol/2/metalab/distributions/tinycorelinux/2.x/tce/src/libatlas/atlas3.8.3.tar.gz || \
wget -T 10 http://sourceforge.net/projects/math-atlas/files/Stable/3.8.3/atlas3.8.3.tar.gz || \
curl -s ftp://ftp.vim.org/vol/2/metalab/distributions/tinycorelinux/2.x/tce/src/libatlas/atlas3.8.3.tar.gz -o atlas3.8.3.tar.gz || \
wget -T 10 http://sourceforge.net/projects/math-atlas/files/Stable/3.8.3/atlas3.8.3.tar.gz || \
wget --no-check-certificate -T 10 -t 3 http://www.danielpovey.com/files/kaldi/atlas3.8.3.tar.gz

sph2pipe: sph2pipe_compiled
Expand All @@ -140,6 +143,7 @@ sph2pipe_v2.5: sph2pipe_v2.5.tar.gz

sph2pipe_v2.5.tar.gz:
wget -T 10 -t 3 http://www.openslr.org/resources/3/sph2pipe_v2.5.tar.gz || \
curl -s http://www.openslr.org/resources/3/sph2pipe_v2.5.tar.gz -o sph2pipe_v2.5.tar.gz || \
wget --no-check-certificate -T 10 https://sourceforge.net/projects/kaldi/files/sph2pipe_v2.5.tar.gz

openblas: openblas_compiled
Expand Down
9 changes: 8 additions & 1 deletion tools/extras/check_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ if ! echo "#include <zlib.h>" | gcc -E - >&/dev/null; then
add_packages zlib-devel zlib1g-dev zlib-devel
fi

for f in make gcc automake libtool autoconf patch grep bzip2 gzip wget git; do
if ! which wget >&/dev/null; then
if ! which curl >&/dev/null; then
echo "$0: wget is not installed."
add_packages wget wget wget
fi
fi

for f in make gcc automake libtool autoconf patch grep bzip2 gzip git; do
if ! which $f >&/dev/null; then
echo "$0: $f is not installed."
add_packages $f $f $f
Expand Down

0 comments on commit 95a2c61

Please sign in to comment.