]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
talk.wasm : add audio pre-processing + bump memory
authorGeorgi Gerganov <redacted>
Wed, 23 Nov 2022 22:34:00 +0000 (00:34 +0200)
committerGeorgi Gerganov <redacted>
Wed, 23 Nov 2022 22:34:00 +0000 (00:34 +0200)
examples/talk.wasm/CMakeLists.txt
examples/talk.wasm/README.md
examples/talk.wasm/gpt-2.cpp
examples/talk.wasm/index-tmpl.html

index 6731d62e68a6e05f6783dc4ad7be0b2387f8b43b..35f62234af3ea23fa910a28018cb3d0da277f322 100644 (file)
@@ -31,8 +31,8 @@ set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \
     --bind \
     -s USE_PTHREADS=1 \
     -s PTHREAD_POOL_SIZE=8 \
-    -s INITIAL_MEMORY=1400MB \
-    -s TOTAL_MEMORY=1400MB \
+    -s INITIAL_MEMORY=1600MB \
+    -s TOTAL_MEMORY=1600MB \
     -s FORCE_FILESYSTEM=1 \
     -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \
     ${EXTRA_FLAGS} \
index c1b16c307a69bf748ac08a8e2adf2a1fe8b7f08f..1ee272adc0558b749adc0242d5a352c4a4d6f638 100644 (file)
@@ -34,7 +34,7 @@ In order to run this demo efficiently, you need to have the following:
 - Latest Chrome or Firefox browser (Safari is not supported)
 - Run this on a desktop or laptop with modern CPU (a mobile phone will likely not be good enough)
 - Speak phrases that are no longer than 10 seconds - this is the audio context of the AI
-- The web-page uses about 1.4GB of RAM
+- The web-page uses about 1.6GB of RAM
 
 Notice that this demo is using the smallest GPT-2 model, so the generated text responses are not always very good.
 Also, the prompting strategy can likely be improved to achieve better results.
index 2e25c070e2985103ca58d91ef696d2ec453afef1..c6526e44fd6ec7a8406e3acdb28aae74030877fc 100644 (file)
@@ -513,7 +513,7 @@ bool gpt2_eval(
     const int n_head  = hparams.n_head;
     const int n_vocab = hparams.n_vocab;
 
-    static size_t buf_size = 512u*1024*1024;
+    static size_t buf_size = 640u*1024*1024;
     static void * buf = malloc(buf_size);
 
     if (mem_per_token > 0 && mem_per_token*N > buf_size) {
index c8c9e112d30c09849b5aede3f419061b579abe3a..f07a57cae84143fc260d49ba9140ae060f31fc75 100644 (file)
 
             function startRecording() {
                 if (!context) {
-                    context = new AudioContext({sampleRate: 16000, noiseSuppression: true});
+                    context = new AudioContext({
+                        sampleRate: 16000,
+                        channelCount: 1,
+                        echoCancellation: true,
+                        autoGainControl:  true,
+                        noiseSuppression: true,
+                    });
                 }
 
                 Module.set_status("");