Openfst is patched by author.
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -20,7 +20,7 @@ index 80037d0..a964b2d 100644
|
|||||||
# if no wrapping of the blas library is needed, uncomment next line
|
# if no wrapping of the blas library is needed, uncomment next line
|
||||||
CC = emcc # -DNO_BLAS_WRAP
|
CC = emcc # -DNO_BLAS_WRAP
|
||||||
-CFLAGS = -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c -O3
|
-CFLAGS = -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c -O3
|
||||||
+CFLAGS = -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c -O3 -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals
|
+CFLAGS = -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c -O3 -fno-rtti -fno-exceptions -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals
|
||||||
LOADER = $(CC)
|
LOADER = $(CC)
|
||||||
LOADOPTS =
|
LOADOPTS =
|
||||||
NOOPT = -O0 -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c
|
NOOPT = -O0 -I$(TOPDIR)/INCLUDE -I$(TOPDIR)/../libf2c
|
||||||
@@ -33,7 +33,7 @@ index e071614..4647c2b 100644
|
|||||||
#
|
#
|
||||||
CC = emcc
|
CC = emcc
|
||||||
-CFLAGS = -I../libf2c -O3
|
-CFLAGS = -I../libf2c -O3
|
||||||
+CFLAGS = -I../libf2c -O3 -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals
|
+CFLAGS = -I../libf2c -O3 -fno-rtti -fno-exceptions -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals
|
||||||
DRVOPTS = $(OPTS)
|
DRVOPTS = $(OPTS)
|
||||||
NOOPT =
|
NOOPT =
|
||||||
LOADER = emcc
|
LOADER = emcc
|
||||||
@@ -46,7 +46,7 @@ index 6221401..d93b87f 100644
|
|||||||
CC = emcc
|
CC = emcc
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
-CFLAGS = -DNON_UNIX_STDIO -O3
|
-CFLAGS = -DNON_UNIX_STDIO -O3
|
||||||
+CFLAGS = -DNON_UNIX_STDIO -O3 -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals
|
+CFLAGS = -DNON_UNIX_STDIO -O3 -fno-rtti -fno-exceptions -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals
|
||||||
|
|
||||||
LD = wasm-ld
|
LD = wasm-ld
|
||||||
RANLIB = emranlib
|
RANLIB = emranlib
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
diff --git a/src/include/fst/bi-table.h b/src/include/fst/bi-table.h
|
|
||||||
index 7c5be23..4527001 100644
|
|
||||||
--- a/src/include/fst/bi-table.h
|
|
||||||
+++ b/src/include/fst/bi-table.h
|
|
||||||
@@ -327,7 +327,7 @@ class VectorHashBiTable {
|
|
||||||
}
|
|
||||||
|
|
||||||
VectorHashBiTable(const VectorHashBiTable<I, T, S, FP, H, HS> &table)
|
|
||||||
- : selector_(table.s_),
|
|
||||||
+ : selector_(table.selector_),
|
|
||||||
fp_(table.fp_),
|
|
||||||
h_(table.h_),
|
|
||||||
id2entry_(table.id2entry_),
|
|
||||||
diff --git a/src/include/fst/fst.h b/src/include/fst/fst.h
|
|
||||||
index 80e3948..57cf1fd 100644
|
|
||||||
--- a/src/include/fst/fst.h
|
|
||||||
+++ b/src/include/fst/fst.h
|
|
||||||
@@ -701,8 +701,8 @@ class FstImpl {
|
|
||||||
properties_.store(impl.properties_.load(std::memory_order_relaxed),
|
|
||||||
std::memory_order_relaxed);
|
|
||||||
type_ = impl.type_;
|
|
||||||
- isymbols_ = impl.isymbols_ ? impl.isymbols_->Copy() : nullptr;
|
|
||||||
- osymbols_ = impl.osymbols_ ? impl.osymbols_->Copy() : nullptr;
|
|
||||||
+ isymbols_.reset(impl.isymbols_ ? impl.isymbols_->Copy() : nullptr);
|
|
||||||
+ osymbols_.reset(impl.osymbols_ ? impl.osymbols_->Copy() : nullptr);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
+4
-1
@@ -2,7 +2,6 @@
|
|||||||
#include <emscripten/em_js.h>
|
#include <emscripten/em_js.h>
|
||||||
#include <emscripten/wasm_worker.h>
|
#include <emscripten/wasm_worker.h>
|
||||||
|
|
||||||
WorkerPool globalPool;
|
|
||||||
EM_JS(void, _fireEv, (int index, int content, int type), {
|
EM_JS(void, _fireEv, (int index, int content, int type), {
|
||||||
objs[index].dispatchEvent(new CustomEvent(type === 0 ? "0" : UTF8ToString(type), { "detail" : UTF8ToString(content) }));
|
objs[index].dispatchEvent(new CustomEvent(type === 0 ? "0" : UTF8ToString(type), { "detail" : UTF8ToString(content) }));
|
||||||
})
|
})
|
||||||
@@ -79,6 +78,9 @@ void Worker::startup(int _self, int _pool) {
|
|||||||
self.fn();
|
self.fn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static constexpr int workerStack{65536};
|
||||||
|
static std::array<std::byte, MAX_WORKERS * workerStack> stacks;
|
||||||
|
#undef MAX_WORKERS
|
||||||
WorkerPool::WorkerPool() {
|
WorkerPool::WorkerPool() {
|
||||||
for(int i = 0; i < workers.size(); i++) {
|
for(int i = 0; i < workers.size(); i++) {
|
||||||
workers[i].handle = emscripten_create_wasm_worker(&stacks[i * workerStack], workerStack);
|
workers[i].handle = emscripten_create_wasm_worker(&stacks[i * workerStack], workerStack);
|
||||||
@@ -96,3 +98,4 @@ void WorkerPool::exec(std::function<void()> fn) {
|
|||||||
emscripten_atomic_store_u32(&qLock, false);
|
emscripten_atomic_store_u32(&qLock, false);
|
||||||
emscripten_atomic_notify(&qLock, 1);
|
emscripten_atomic_notify(&qLock, 1);
|
||||||
}
|
}
|
||||||
|
WorkerPool globalPool;
|
||||||
+2
-5
@@ -30,19 +30,16 @@ struct Worker {
|
|||||||
#ifndef MAX_WORKERS
|
#ifndef MAX_WORKERS
|
||||||
#define MAX_WORKERS 1
|
#define MAX_WORKERS 1
|
||||||
#endif
|
#endif
|
||||||
static constexpr int workerStack{65536};
|
|
||||||
static std::array<std::byte, MAX_WORKERS * workerStack> stacks;
|
|
||||||
struct WorkerPool {
|
struct WorkerPool {
|
||||||
bool qLock{true}; // True is locked, false is unlocked
|
bool qLock{true}; // True is locked, false is unlocked
|
||||||
bool done{};
|
bool done{};
|
||||||
std::queue<std::function<void()>> taskQ;
|
std::queue<std::function<void()>> taskQ;
|
||||||
std::array<Worker, MAX_WORKERS> workers;
|
std::array<Worker, MAX_WORKERS> workers;
|
||||||
#undef MAX_WORKERS
|
|
||||||
WorkerPool();
|
WorkerPool();
|
||||||
~WorkerPool();
|
~WorkerPool();
|
||||||
void exec(std::function<void()> fn);
|
void exec(std::function<void()> fn);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern WorkerPool globalPool;
|
|
||||||
void fireEv(int index, const char* _content, const char* _type = nullptr);
|
void fireEv(int index, const char* _content, const char* _type = nullptr);
|
||||||
int untar(unsigned char* tar, int tarSize, const std::string& storepath);
|
int untar(unsigned char* tar, int tarSize, const std::string& storepath);
|
||||||
|
|
||||||
|
extern WorkerPool globalPool;
|
||||||
+33
-44
@@ -1,8 +1,17 @@
|
|||||||
diff --git a/src/model.cc b/src/model.cc
|
diff --git a/src/model.cc b/src/model.cc
|
||||||
index 035ffee..7f5148a 100644
|
index 035ffee..18edcd3 100644
|
||||||
--- a/src/model.cc
|
--- a/src/model.cc
|
||||||
+++ b/src/model.cc
|
+++ b/src/model.cc
|
||||||
@@ -74,38 +74,48 @@ static void KaldiLogHandler(const LogMessageEnvelope &env, const char *message)
|
@@ -23,7 +23,7 @@
|
||||||
|
#include <fst/register.h>
|
||||||
|
#include <fst/matcher-fst.h>
|
||||||
|
#include <fst/extensions/ngram/ngram-fst.h>
|
||||||
|
-
|
||||||
|
+#include <emscripten/console.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_MKL
|
||||||
|
// We need to set num threads
|
||||||
|
@@ -74,38 +74,37 @@ static void KaldiLogHandler(const LogMessageEnvelope &env, const char *message)
|
||||||
#else
|
#else
|
||||||
static void KaldiLogHandler(const LogMessageEnvelope &env, const char *message)
|
static void KaldiLogHandler(const LogMessageEnvelope &env, const char *message)
|
||||||
{
|
{
|
||||||
@@ -16,6 +25,20 @@ index 035ffee..7f5148a 100644
|
|||||||
- if (env.severity > LogMessageEnvelope::kInfo) {
|
- if (env.severity > LogMessageEnvelope::kInfo) {
|
||||||
- full_message << "VLOG[" << env.severity << "] (";
|
- full_message << "VLOG[" << env.severity << "] (";
|
||||||
- } else {
|
- } else {
|
||||||
|
- switch (env.severity) {
|
||||||
|
- case LogMessageEnvelope::kInfo:
|
||||||
|
- full_message << "LOG (";
|
||||||
|
- break;
|
||||||
|
- case LogMessageEnvelope::kWarning:
|
||||||
|
- full_message << "WARNING (";
|
||||||
|
- break;
|
||||||
|
- case LogMessageEnvelope::kAssertFailed:
|
||||||
|
- full_message << "ASSERTION_FAILED (";
|
||||||
|
- break;
|
||||||
|
- case LogMessageEnvelope::kError:
|
||||||
|
- default: // If not the ERROR, it still an error!
|
||||||
|
- full_message << "ERROR (";
|
||||||
|
- break;
|
||||||
+ // Modified default Kaldi logging so we can disable LOG messages.
|
+ // Modified default Kaldi logging so we can disable LOG messages.
|
||||||
+ std::stringstream full_message;
|
+ std::stringstream full_message;
|
||||||
+ if (env.severity > LogMessageEnvelope::kInfo) {
|
+ if (env.severity > LogMessageEnvelope::kInfo) {
|
||||||
@@ -36,35 +59,6 @@ index 035ffee..7f5148a 100644
|
|||||||
+ full_message << "ERROR (";
|
+ full_message << "ERROR (";
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
|
||||||
+ // Add other info from the envelope and the message text.
|
|
||||||
+ full_message << "VoskAPI" << ':'
|
|
||||||
+ << env.func << "():" << env.file << ':'
|
|
||||||
+ << env.line << ") " << message;
|
|
||||||
+ if(env.severity > LogMessageEnvelope::kInfo) {
|
|
||||||
+ emscripten_console_log(full_message.str().c_str());
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
switch (env.severity) {
|
|
||||||
case LogMessageEnvelope::kInfo:
|
|
||||||
- full_message << "LOG (";
|
|
||||||
- break;
|
|
||||||
+ emscripten_console_log(full_message.str().c_str());
|
|
||||||
+ break;
|
|
||||||
case LogMessageEnvelope::kWarning:
|
|
||||||
- full_message << "WARNING (";
|
|
||||||
- break;
|
|
||||||
- case LogMessageEnvelope::kAssertFailed:
|
|
||||||
- full_message << "ASSERTION_FAILED (";
|
|
||||||
- break;
|
|
||||||
- case LogMessageEnvelope::kError:
|
|
||||||
- default: // If not the ERROR, it still an error!
|
|
||||||
- full_message << "ERROR (";
|
|
||||||
- break;
|
|
||||||
+ emscripten_console_warn(full_message.str().c_str());
|
|
||||||
+ break;
|
|
||||||
+ default:
|
|
||||||
+ emscripten_console_error(full_message.str().c_str());
|
|
||||||
}
|
}
|
||||||
- }
|
- }
|
||||||
- // Add other info from the envelope and the message text.
|
- // Add other info from the envelope and the message text.
|
||||||
@@ -75,23 +69,18 @@ index 035ffee..7f5148a 100644
|
|||||||
- // Print the complete message to stderr.
|
- // Print the complete message to stderr.
|
||||||
- full_message << "\n";
|
- full_message << "\n";
|
||||||
- std::cerr << full_message.str();
|
- std::cerr << full_message.str();
|
||||||
|
+ // Add other info from the envelope and the message text.
|
||||||
|
+ full_message << "VoskAPI" << ':'
|
||||||
|
+ << env.func << "():" << env.file << ':'
|
||||||
|
+ << env.line << ") " << message;
|
||||||
|
+ if(env.severity >= LogMessageEnvelope::kInfo) emscripten_console_log(full_message.str().c_str());
|
||||||
|
+ else if(env.severity == LogMessageEnvelope::kWarning) emscripten_console_warn(full_message.str().c_str());
|
||||||
|
+ else emscripten_console_error(full_message.str().c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
diff --git a/src/model.h b/src/model.h
|
|
||||||
index 7fc09df..608d28a 100644
|
|
||||||
--- a/src/model.h
|
|
||||||
+++ b/src/model.h
|
|
||||||
@@ -32,6 +32,7 @@
|
|
||||||
#include "rnnlm/rnnlm-utils.h"
|
|
||||||
#include "rnnlm/rnnlm-lattice-rescoring.h"
|
|
||||||
#include <atomic>
|
|
||||||
+#include <emscripten/console.h>
|
|
||||||
|
|
||||||
using namespace kaldi;
|
|
||||||
using namespace std;
|
|
||||||
diff --git a/src/recognizer.cc b/src/recognizer.cc
|
diff --git a/src/recognizer.cc b/src/recognizer.cc
|
||||||
index 1da6e6b..44c4d8c 100644
|
index 55d9991..4802b92 100644
|
||||||
--- a/src/recognizer.cc
|
--- a/src/recognizer.cc
|
||||||
+++ b/src/recognizer.cc
|
+++ b/src/recognizer.cc
|
||||||
@@ -384,8 +384,9 @@ bool Recognizer::AcceptWaveform(const float *fdata, int len)
|
@@ -384,8 +384,9 @@ bool Recognizer::AcceptWaveform(const float *fdata, int len)
|
||||||
|
|||||||
+4
-4
@@ -85,8 +85,8 @@ class CommonModel extends EventTarget {
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let tarStart = Module._malloc(tar.byteLength)
|
let tarStart = _malloc(tar.byteLength)
|
||||||
Module.HEAPU8.set(new Uint8Array(tar), tarStart)
|
HEAPU8.set(new Uint8Array(tar), tarStart)
|
||||||
mdl.obj = new Module.CommonModel(objs.length - 1, normalMdl, "/" + storepath, id, tarStart, tar.byteLength)
|
mdl.obj = new Module.CommonModel(objs.length - 1, normalMdl, "/" + storepath, id, tarStart, tar.byteLength)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@@ -131,8 +131,8 @@ class Recognizer extends EventTarget {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
acceptWaveform(audioData) {
|
acceptWaveform(audioData) {
|
||||||
let start = Module._malloc(audioData.length * 4)
|
let start = _malloc(audioData.length * 4)
|
||||||
Module.HEAPF32.set(audioData, start / 4)
|
HEAPF32.set(audioData, start / 4)
|
||||||
this.obj.pushData(start, audioData.length)
|
this.obj.pushData(start, audioData.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,8 @@ if [ ! -d "$OPENFST" ]; then
|
|||||||
rm -rf /tmp/openfst &&
|
rm -rf /tmp/openfst &&
|
||||||
git clone --depth=1 https://github.com/alphacep/openfst /tmp/openfst &&
|
git clone --depth=1 https://github.com/alphacep/openfst /tmp/openfst &&
|
||||||
cd /tmp/openfst &&
|
cd /tmp/openfst &&
|
||||||
git apply "$SRC"/Openfst.patch
|
|
||||||
autoreconf -is &&
|
autoreconf -is &&
|
||||||
CXXFLAGS="-r -O3 -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals" LDFLAGS="-O3 -flto" emconfigure ./configure --prefix="$OPENFST" --enable-static --disable-shared --enable-lookahead-fsts --enable-ngram-fsts --disable-bin &&
|
CXXFLAGS="-r -O3 -fno-rtti -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals" emconfigure ./configure --prefix="$OPENFST" --enable-static --disable-shared --enable-lookahead-fsts --enable-ngram-fsts --disable-bin &&
|
||||||
emmake make -j"$JOBS" install &&
|
emmake make -j"$JOBS" install &&
|
||||||
echo "PACKAGE_VERSION = 1.8.0" >> "$OPENFST"/Makefile
|
echo "PACKAGE_VERSION = 1.8.0" >> "$OPENFST"/Makefile
|
||||||
fi
|
fi
|
||||||
@@ -59,7 +58,7 @@ if [ ! -d "$KALDI" ]; then
|
|||||||
git clone -b vosk --depth=1 https://github.com/alphacep/kaldi "$KALDI" &&
|
git clone -b vosk --depth=1 https://github.com/alphacep/kaldi "$KALDI" &&
|
||||||
cd "$KALDI"/src &&
|
cd "$KALDI"/src &&
|
||||||
git apply "$SRC"/Kaldi.patch &&
|
git apply "$SRC"/Kaldi.patch &&
|
||||||
CXXFLAGS="-O3 -UHAVE_EXECINFO_H -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals -Wno-unused-variable -Wno-unused-but-set-variable -g0" LDFLAGS="-O3 -lembind -flto -g0" emconfigure ./configure --use-cuda=no --with-cudadecoder=no --static --static-math=yes --static-fst=yes --debug-level=0 --fst-root="$OPENFST" --clapack-root="$CLAPACK_WASM" --host=WASM &&
|
CXXFLAGS="-O3 -UHAVE_EXECINFO_H -fno-rtti -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals -Wno-unused-variable -Wno-unused-but-set-variable -g0" LDFLAGS="-O3 -lembind -flto -g0" emconfigure ./configure --use-cuda=no --with-cudadecoder=no --static --static-math=yes --static-fst=yes --debug-level=0 --fst-root="$OPENFST" --clapack-root="$CLAPACK_WASM" --host=WASM &&
|
||||||
emmake make -j"$JOBS" online2 rnnlm
|
emmake make -j"$JOBS" online2 rnnlm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -67,13 +66,13 @@ if [ ! -d "$VOSK" ]; then
|
|||||||
git clone -b v0.3.50 --depth=1 https://github.com/alphacep/vosk-api "$VOSK" &&
|
git clone -b v0.3.50 --depth=1 https://github.com/alphacep/vosk-api "$VOSK" &&
|
||||||
cd "$VOSK"/src &&
|
cd "$VOSK"/src &&
|
||||||
git apply "$SRC"/Vosk.patch &&
|
git apply "$SRC"/Vosk.patch &&
|
||||||
VOSK_FILES="Recognizer.cc language_model.cc model.cc spk_model.cc vosk_api.cc" &&
|
VOSK_FILES="recognizer.cc language_model.cc model.cc spk_model.cc vosk_api.cc" &&
|
||||||
em++ -O3 -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals -Wno-deprecated -I. -I"$KALDI"/src -I"$OPENFST"/include "$VOSK_FILES" -c &&
|
em++ -O3 -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals -Wno-deprecated -I. -I"$KALDI"/src -I"$OPENFST"/include $VOSK_FILES -c &&
|
||||||
emar -rcs vosk.a "${VOSK_FILES//.cc/.o}"
|
emar -rcs vosk.a ${VOSK_FILES//.cc/.o}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$SRC" &&
|
cd "$SRC" &&
|
||||||
em++ Util.cc CommonModel.cc Recognizer.cc Bindings.cc -O3 -Wall -Werror -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti -DMAX_WORKERS="$MAX_THREADS" -sWASMFS -sWASM_BIGINT -sMODULARIZE -sTEXTDECODER=2 -sWASM_WORKERS=2 -sEVAL_CTORS=2 -sINITIAL_MEMORY="$INITIAL_MEMORY" -sALLOW_MEMORY_GROWTH -sPOLYFILL=0 -sEXIT_RUNTIME=0 -sINVOKE_RUN=0 -sSUPPORT_LONGJMP=0 -sEXPORTED_FUNCTIONS=_malloc -sEXPORT_NAME=loadVosklet -sMALLOC=emmalloc -sEXPORTED_RUNTIME_METHODS=UTF8ToString,stringToUTF8OnStack -sENVIRONMENT=web,worker -I. -I"$VOSK"/src -L"$KALDI"/src -l:online2/kaldi-online2.a -l:decoder/kaldi-decoder.a -l:ivector/kaldi-ivector.a -l:gmm/kaldi-gmm.a -l:tree/kaldi-tree.a -l:feat/kaldi-feat.a -l:cudamatrix/kaldi-cudamatrix.a -l:lat/kaldi-lat.a -l:lm/kaldi-lm.a -l:rnnlm/kaldi-rnnlm.a -l:hmm/kaldi-hmm.a -l:nnet3/kaldi-nnet3.a -l:transform/kaldi-transform.a -l:matrix/kaldi-matrix.a -l:fstext/kaldi-fstext.a -l:util/kaldi-util.a -l:base/kaldi-base.a -L"$OPENFST"/lib -l:libfst.a -l:libfstngram.a -L"$CLAPACK_WASM" -l:CBLAS/lib/cblas.a -l:CLAPACK-3.2.1/lapack.a -l:CLAPACK-3.2.1/libcblaswr.a -l:f2c_BLAS-3.8.0/blas.a -l:libf2c/libf2c.a -L"$VOSK"/src -l:vosk.a -lembind -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals --pre-js Wrapper.js -o ../Vosklet.js
|
em++ Util.cc CommonModel.cc Recognizer.cc Bindings.cc -O3 -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti -DMAX_WORKERS="$MAX_THREADS" -sWASMFS -sWASM_BIGINT -sMODULARIZE -sWASM_EXNREF -sTEXTDECODER=2 -sWASM_WORKERS=2 -sEVAL_CTORS=2 -sINITIAL_MEMORY="$INITIAL_MEMORY" -sALLOW_MEMORY_GROWTH -sPOLYFILL=0 -sEXIT_RUNTIME=0 -sINVOKE_RUN=0 -sSUPPORT_LONGJMP=0 -sEXPORTED_FUNCTIONS=_malloc -sEXPORT_NAME=loadVosklet -sMALLOC=emmalloc -sEXPORTED_RUNTIME_METHODS=UTF8ToString -sENVIRONMENT=web,worker -I. -I"$VOSK"/src -L"$KALDI"/src -l:online2/kaldi-online2.a -l:decoder/kaldi-decoder.a -l:ivector/kaldi-ivector.a -l:gmm/kaldi-gmm.a -l:tree/kaldi-tree.a -l:feat/kaldi-feat.a -l:cudamatrix/kaldi-cudamatrix.a -l:lat/kaldi-lat.a -l:lm/kaldi-lm.a -l:rnnlm/kaldi-rnnlm.a -l:hmm/kaldi-hmm.a -l:nnet3/kaldi-nnet3.a -l:transform/kaldi-transform.a -l:matrix/kaldi-matrix.a -l:fstext/kaldi-fstext.a -l:util/kaldi-util.a -l:base/kaldi-base.a -L"$OPENFST"/lib -l:libfst.a -l:libfstngram.a -L"$CLAPACK_WASM" -l:CBLAS/lib/cblas.a -l:CLAPACK-3.2.1/lapack.a -l:CLAPACK-3.2.1/libcblaswr.a -l:f2c_BLAS-3.8.0/blas.a -l:libf2c/libf2c.a -L"$VOSK"/src -l:vosk.a -lembind -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals --pre-js Wrapper.js -o ../Vosklet.js
|
||||||
cd .. &&
|
cd .. &&
|
||||||
rm -f Vosklet.worker.js
|
rm -f Vosklet.worker.js
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,10 @@ cd src &&
|
|||||||
MODE=1 && # 0: Ultra debug info, 1: Optimized release, else custom
|
MODE=1 && # 0: Ultra debug info, 1: Optimized release, else custom
|
||||||
echo "Mode = $MODE" &&
|
echo "Mode = $MODE" &&
|
||||||
if [ "$MODE" = 0 ]; then
|
if [ "$MODE" = 0 ]; then
|
||||||
em++ Util.cc CommonModel.cc Recognizer.cc Bindings.cc -O0 -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti -DMAX_WORKERS="$MAX_THREADS" -sWASMFS -sWASM_BIGINT -sMODULARIZE -sTEXTDECODER=2 -sWASM_WORKERS=2 -sEVAL_CTORS=2 -sSTACK_OVERFLOW_CHECK=2 -sASSERTIONS=2 -sINITIAL_MEMORY="$INITIAL_MEMORY" -sALLOW_MEMORY_GROWTH -sRUNTIME_DEBUG -sPOLYFILL=0 -sEXIT_RUNTIME=0 -sINVOKE_RUN=0 -sDISABLE_EXCEPTION_CATCHING=0 -sEXPORTED_FUNCTIONS=_malloc -sEXPORT_NAME=loadVosklet -sMALLOC=emmalloc -sEXPORTED_RUNTIME_METHODS=UTF8ToString -sENVIRONMENT=web,worker -I. -I"$VOSK"/src -L"$KALDI"/src -l:online2/kaldi-online2.a -l:decoder/kaldi-decoder.a -l:ivector/kaldi-ivector.a -l:gmm/kaldi-gmm.a -l:tree/kaldi-tree.a -l:feat/kaldi-feat.a -l:cudamatrix/kaldi-cudamatrix.a -l:lat/kaldi-lat.a -l:lm/kaldi-lm.a -l:rnnlm/kaldi-rnnlm.a -l:hmm/kaldi-hmm.a -l:nnet3/kaldi-nnet3.a -l:transform/kaldi-transform.a -l:matrix/kaldi-matrix.a -l:fstext/kaldi-fstext.a -l:util/kaldi-util.a -l:base/kaldi-base.a -L"$OPENFST"/lib -l:libfst.a -l:libfstngram.a -L"$CLAPACK_WASM" -l:CBLAS/lib/cblas.a -l:CLAPACK-3.2.1/lapack.a -l:CLAPACK-3.2.1/libcblaswr.a -l:f2c_BLAS-3.8.0/blas.a -l:libf2c/libf2c.a -L"$VOSK"/src -l:vosk.a -lembind -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals --pre-js Wrapper.js -o ../test.js
|
em++ Util.cc CommonModel.cc Recognizer.cc Bindings.cc -O0 -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti -DMAX_WORKERS="$MAX_THREADS" -sWASMFS -sWASM_BIGINT -sMODULARIZE -sWASM_EXNREF -sTEXTDECODER=2 -sWASM_WORKERS=2 -sEVAL_CTORS=2 -sSTACK_OVERFLOW_CHECK=2 -sASSERTIONS=2 -sINITIAL_MEMORY="$INITIAL_MEMORY" -sALLOW_MEMORY_GROWTH -sRUNTIME_DEBUG -sPOLYFILL=0 -sEXIT_RUNTIME=0 -sINVOKE_RUN=0 -sDISABLE_EXCEPTION_CATCHING=0 -sEXPORTED_FUNCTIONS=_malloc -sEXPORT_NAME=loadVosklet -sMALLOC=emmalloc -sEXPORTED_RUNTIME_METHODS=UTF8ToString -sENVIRONMENT=web,worker -I. -I"$VOSK"/src -L"$KALDI"/src -l:online2/kaldi-online2.a -l:decoder/kaldi-decoder.a -l:ivector/kaldi-ivector.a -l:gmm/kaldi-gmm.a -l:tree/kaldi-tree.a -l:feat/kaldi-feat.a -l:cudamatrix/kaldi-cudamatrix.a -l:lat/kaldi-lat.a -l:lm/kaldi-lm.a -l:rnnlm/kaldi-rnnlm.a -l:hmm/kaldi-hmm.a -l:nnet3/kaldi-nnet3.a -l:transform/kaldi-transform.a -l:matrix/kaldi-matrix.a -l:fstext/kaldi-fstext.a -l:util/kaldi-util.a -l:base/kaldi-base.a -L"$OPENFST"/lib -l:libfst.a -l:libfstngram.a -L"$CLAPACK_WASM" -l:CBLAS/lib/cblas.a -l:CLAPACK-3.2.1/lapack.a -l:CLAPACK-3.2.1/libcblaswr.a -l:f2c_BLAS-3.8.0/blas.a -l:libf2c/libf2c.a -L"$VOSK"/src -l:vosk.a -lembind -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals --pre-js Wrapper.js -o ../test.js
|
||||||
elif [ "$MODE" = 1 ]; then
|
elif [ "$MODE" = 1 ]; then
|
||||||
em++ Util.cc CommonModel.cc Recognizer.cc Bindings.cc -O3 -Wall -Werror -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti -DMAX_WORKERS="$MAX_THREADS" -sWASMFS -sWASM_BIGINT -sMODULARIZE -sTEXTDECODER=2 -sWASM_WORKERS=2 -sEVAL_CTORS=2 -sINITIAL_MEMORY="$INITIAL_MEMORY" -sALLOW_MEMORY_GROWTH -sPOLYFILL=0 -sEXIT_RUNTIME=0 -sINVOKE_RUN=0 -sSUPPORT_LONGJMP=0 -sEXPORTED_FUNCTIONS=_malloc -sEXPORT_NAME=loadVosklet -sMALLOC=emmalloc -sEXPORTED_RUNTIME_METHODS=UTF8ToString,stringToUTF8OnStack -sENVIRONMENT=web,worker -I. -I"$VOSK"/src -L"$KALDI"/src -l:online2/kaldi-online2.a -l:decoder/kaldi-decoder.a -l:ivector/kaldi-ivector.a -l:gmm/kaldi-gmm.a -l:tree/kaldi-tree.a -l:feat/kaldi-feat.a -l:cudamatrix/kaldi-cudamatrix.a -l:lat/kaldi-lat.a -l:lm/kaldi-lm.a -l:rnnlm/kaldi-rnnlm.a -l:hmm/kaldi-hmm.a -l:nnet3/kaldi-nnet3.a -l:transform/kaldi-transform.a -l:matrix/kaldi-matrix.a -l:fstext/kaldi-fstext.a -l:util/kaldi-util.a -l:base/kaldi-base.a -L"$OPENFST"/lib -l:libfst.a -l:libfstngram.a -L"$CLAPACK_WASM" -l:CBLAS/lib/cblas.a -l:CLAPACK-3.2.1/lapack.a -l:CLAPACK-3.2.1/libcblaswr.a -l:f2c_BLAS-3.8.0/blas.a -l:libf2c/libf2c.a -L"$VOSK"/src -l:vosk.a -lembind -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals --pre-js Wrapper.js -o ../test.js
|
em++ Util.cc CommonModel.cc Recognizer.cc Bindings.cc -O3 -Wall -Werror -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -fno-rtti -DMAX_WORKERS="$MAX_THREADS" -sWASMFS -sWASM_BIGINT -sMODULARIZE -sWASM_EXNREF -sTEXTDECODER=2 -sWASM_WORKERS=2 -sEVAL_CTORS=2 -sINITIAL_MEMORY="$INITIAL_MEMORY" -sALLOW_MEMORY_GROWTH -sPOLYFILL=0 -sEXIT_RUNTIME=0 -sINVOKE_RUN=0 -sSUPPORT_LONGJMP=0 -sEXPORTED_FUNCTIONS=_malloc -sEXPORT_NAME=loadVosklet -sMALLOC=emmalloc -sEXPORTED_RUNTIME_METHODS=UTF8ToString -sENVIRONMENT=web,worker -I. -I"$VOSK"/src -L"$KALDI"/src -l:online2/kaldi-online2.a -l:decoder/kaldi-decoder.a -l:ivector/kaldi-ivector.a -l:gmm/kaldi-gmm.a -l:tree/kaldi-tree.a -l:feat/kaldi-feat.a -l:cudamatrix/kaldi-cudamatrix.a -l:lat/kaldi-lat.a -l:lm/kaldi-lm.a -l:rnnlm/kaldi-rnnlm.a -l:hmm/kaldi-hmm.a -l:nnet3/kaldi-nnet3.a -l:transform/kaldi-transform.a -l:matrix/kaldi-matrix.a -l:fstext/kaldi-fstext.a -l:util/kaldi-util.a -l:base/kaldi-base.a -L"$OPENFST"/lib -l:libfst.a -l:libfstngram.a -L"$CLAPACK_WASM" -l:CBLAS/lib/cblas.a -l:CLAPACK-3.2.1/lapack.a -l:CLAPACK-3.2.1/libcblaswr.a -l:f2c_BLAS-3.8.0/blas.a -l:libf2c/libf2c.a -L"$VOSK"/src -l:vosk.a -lembind -flto -msimd128 -mreference-types -mnontrapping-fptoint -mextended-const -msign-ext -mmutable-globals --pre-js Wrapper.js -o ../test.js
|
||||||
fi
|
fi
|
||||||
sed -i 's/res.body/new Response(res.body.pipeThrough(new DecompressionStream("gzip"))).body/' ../test.js
|
cd .. &&
|
||||||
rm -f ../test.worker.js
|
sed -i 's/res.body/new Response(res.body.pipeThrough(new DecompressionStream("gzip"))).body/' test.js &&
|
||||||
|
rm -f test.worker.js
|
||||||
Reference in New Issue
Block a user