Skip to content

Commit 478c195

Browse files
authored
Merge pull request #51 from xadh00m/master
Update Kaldi and Vosk
2 parents 732e7f2 + 1dbc632 commit 478c195

File tree

15 files changed

+10633
-12094
lines changed

15 files changed

+10633
-12094
lines changed

builder/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ RUN apt-get update \
1111
libc6-dev-i386
1212

1313
WORKDIR /opt/kaldi
14-
RUN git clone -b lookahead-1.8.0 --single-branch https://github.com/ccoreilly/kaldi . && \
15-
git checkout 75ecaef39
14+
RUN git clone -b vosk --single-branch https://github.com/alphacep/kaldi . && \
15+
git checkout 6417ac1dece94783e80dfbac0148604685d27579
1616
ADD kaldi.patch /tmp
1717
RUN git apply -v /tmp/kaldi.patch
1818

builder/kaldi.patch

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/src/Makefile b/src/Makefile
2-
index c50810297..4eb626551 100644
2+
index 69aebdb26..bd66c91eb 100644
33
--- a/src/Makefile
44
+++ b/src/Makefile
5-
@@ -31,7 +31,7 @@ include kaldi.mk
5+
@@ -41,7 +41,7 @@ KALDI_SONAME ?= libkaldi.so
66

77
# Reset the default goal, so that the all target will become default
88
.DEFAULT_GOAL :=
@@ -12,13 +12,13 @@ index c50810297..4eb626551 100644
1212

1313
mklibdir:
1414
diff --git a/src/configure b/src/configure
15-
index d6079d8a0..1518c33eb 100755
15+
index c74d67af8..cf1f8cdd0 100755
1616
--- a/src/configure
1717
+++ b/src/configure
18-
@@ -958,6 +958,33 @@ if $android ; then
19-
cat makefiles/android_openblas.mk >> kaldi.mk
18+
@@ -1022,6 +1022,34 @@ if $android ; then
2019

2120
echo "Successfully configured for Android with OpenBLAS from $OPENBLASROOT."
21+
2222
+elif [ "$(basename $CC)" == "emcc" ]; then
2323
+ # emscripten (WebAssembly)
2424
+
@@ -46,9 +46,10 @@ index d6079d8a0..1518c33eb 100755
4646
+ cat makefiles/wasm_clapack.mk >> kaldi.mk
4747
+ echo "Warning (CLAPACK): this part of the configure process is not properly tested and may not work."
4848
+ echo "Successfully configured for WebAssembly with CLAPACK libs from $CLAPACKROOT"
49-
49+
+
5050
elif [ "`uname`" == "Darwin" ]; then
5151
# Check for Darwin first, because we later call uname -o (for Cygwin)
52+
# which crashes on Darwin.
5253
diff --git a/src/ivector/ivector-extractor.cc b/src/ivector/ivector-extractor.cc
5354
index c3a122281..1ad75599d 100644
5455
--- a/src/ivector/ivector-extractor.cc
@@ -75,11 +76,10 @@ index c3a122281..1ad75599d 100644
7576
KALDI_LOG << "Done.";
7677
}
7778
diff --git a/src/makefiles/default_rules.mk b/src/makefiles/default_rules.mk
78-
index 42d4e9d12..de11a1913 100644
79+
index 3ae5ed5e2..cb56051af 100644
7980
--- a/src/makefiles/default_rules.mk
8081
+++ b/src/makefiles/default_rules.mk
81-
@@ -1,6 +1,10 @@
82-
82+
@@ -1,5 +1,9 @@
8383
SHELL := /bin/bash
8484

8585
+ifeq ($(notdir ${CC}), emcc)
@@ -89,7 +89,7 @@ index 42d4e9d12..de11a1913 100644
8989
ifeq ($(KALDI_FLAVOR), dynamic)
9090
ifeq ($(shell uname), Darwin)
9191
ifdef ANDROIDINC # cross-compiling enabled on host MacOS
92-
@@ -26,6 +30,11 @@ ifeq ($(KALDI_FLAVOR), dynamic)
92+
@@ -31,6 +35,11 @@ ifeq ($(KALDI_FLAVOR), dynamic)
9393
$(error Dynamic libraries not supported on this platform. Run configure with --static flag.)
9494
endif
9595
XDEPENDS =
@@ -101,31 +101,33 @@ index 42d4e9d12..de11a1913 100644
101101
else
102102
ifdef LIBNAME
103103
LIBFILE = $(LIBNAME).a
104-
@@ -33,14 +42,22 @@ else
104+
@@ -38,14 +47,22 @@ else
105105
XDEPENDS = $(ADDLIBS)
106106
endif
107107

108+
-all: $(LIBFILE) $(BINFILES)
109+
-
108110
+ifdef IS_EMSCRIPTEN
109-
+all: $(LIBFILE)
111+
+ all: $(LIBFILE)
110112
+else
111-
all: $(LIBFILE) $(BINFILES)
112-
-
113+
+ all: $(LIBFILE) $(BINFILES)
113114
+endif
114115

115116
ifdef LIBNAME
116117

118+
-$(LIBNAME).a: $(OBJFILES)
117119
+ifdef IS_EMSCRIPTEN
118-
+$(LIBNAME).bc: $(OBJFILES)
120+
+ $(LIBNAME).bc: $(OBJFILES)
119121
+ $(CXX) -o $(LIBNAME).bc $(OBJFILES)
120122
+else
121-
$(LIBNAME).a: $(OBJFILES)
123+
+ $(LIBNAME).a: $(OBJFILES)
122124
$(AR) -cr $(LIBNAME).a $(OBJFILES)
123125
$(RANLIB) $(LIBNAME).a
124126
+endif
125127

126128
ifeq ($(KALDI_FLAVOR), dynamic)
127129
# the LIBFILE is not the same as $(LIBNAME).a
128-
@@ -78,11 +95,14 @@ endif
130+
@@ -87,11 +104,14 @@ endif
129131
%.a:
130132
$(MAKE) -C ${@D} ${@F}
131133

@@ -143,20 +145,20 @@ index 42d4e9d12..de11a1913 100644
143145
-rm -f .depend.mk
144146
diff --git a/src/makefiles/wasm_clapack.mk b/src/makefiles/wasm_clapack.mk
145147
new file mode 100644
146-
index 000000000..7bd5a9f83
148+
index 000000000..fc10b9e9c
147149
--- /dev/null
148150
+++ b/src/makefiles/wasm_clapack.mk
149151
@@ -0,0 +1,32 @@
150152
+# WebAssembly/CLAPACK configuration
151153
+
152154
+ifndef DOUBLE_PRECISION
153-
+$(error DOUBLE_PRECISION not defined.)
155+
+ $(error DOUBLE_PRECISION not defined.)
154156
+endif
155157
+ifndef OPENFSTINC
156-
+$(error OPENFSTINC not defined.)
158+
+ $(error OPENFSTINC not defined.)
157159
+endif
158160
+ifndef OPENFSTLIBS
159-
+$(error OPENFSTLIBS not defined.)
161+
+ $(error OPENFSTLIBS not defined.)
160162
+endif
161163
+
162164
+CXXFLAGS = -std=c++17 -I.. -I$(OPENFSTINC) $(EXTRA_CXXFLAGS) \
@@ -179,9 +181,8 @@ index 000000000..7bd5a9f83
179181
+
180182
+LDFLAGS = $(EXTRA_LDFLAGS) $(OPENFSTLDFLAGS) -g
181183
+LDLIBS = $(EXTRA_LDLIBS) $(OPENFSTLIBS) $(CLAPACKLIBS) -lm # -lpthread -ldl
182-
\ No newline at end of file
183184
diff --git a/tools/Makefile b/tools/Makefile
184-
index eb07f7ad7..2c561f6fd 100644
185+
index 1ab7bbb8d..54113b5db 100644
185186
--- a/tools/Makefile
186187
+++ b/tools/Makefile
187188
@@ -78,11 +78,12 @@ else ifeq ($(OS),Windows_NT)
@@ -197,7 +198,7 @@ index eb07f7ad7..2c561f6fd 100644
197198
+ git apply -v ../openfst.patch && \
198199
autoreconf -i && \
199200
./configure --prefix=`pwd` $(OPENFST_CONFIGURE) CXX="$(CXX)" \
200-
CXXFLAGS="$(CXXFLAGS) $(openfst_add_CXXFLAGS)" \
201+
CXXFLAGS="$(openfst_add_CXXFLAGS) $(CXXFLAGS)" \
201202
diff --git a/tools/extras/check_dependencies.sh b/tools/extras/check_dependencies.sh
202203
index 155a376b6..97d9b2ff9 100755
203204
--- a/tools/extras/check_dependencies.sh
@@ -217,7 +218,7 @@ index 155a376b6..97d9b2ff9 100755
217218
echo "$0: $f is not installed."
218219
diff --git a/tools/openfst.patch b/tools/openfst.patch
219220
new file mode 100644
220-
index 000000000..80d607fdd
221+
index 000000000..3d016dc28
221222
--- /dev/null
222223
+++ b/tools/openfst.patch
223224
@@ -0,0 +1,45 @@

0 commit comments

Comments
 (0)