ggerganov commited on
Commit
679d38e
·
unverified ·
1 Parent(s): ff21a60

talk.wasm : add audio pre-processing + bump memory

Browse files
examples/talk.wasm/CMakeLists.txt CHANGED
@@ -31,8 +31,8 @@ set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \
31
  --bind \
32
  -s USE_PTHREADS=1 \
33
  -s PTHREAD_POOL_SIZE=8 \
34
- -s INITIAL_MEMORY=1400MB \
35
- -s TOTAL_MEMORY=1400MB \
36
  -s FORCE_FILESYSTEM=1 \
37
  -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \
38
  ${EXTRA_FLAGS} \
 
31
  --bind \
32
  -s USE_PTHREADS=1 \
33
  -s PTHREAD_POOL_SIZE=8 \
34
+ -s INITIAL_MEMORY=1600MB \
35
+ -s TOTAL_MEMORY=1600MB \
36
  -s FORCE_FILESYSTEM=1 \
37
  -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \
38
  ${EXTRA_FLAGS} \
examples/talk.wasm/README.md CHANGED
@@ -34,7 +34,7 @@ In order to run this demo efficiently, you need to have the following:
34
  - Latest Chrome or Firefox browser (Safari is not supported)
35
  - Run this on a desktop or laptop with modern CPU (a mobile phone will likely not be good enough)
36
  - Speak phrases that are no longer than 10 seconds - this is the audio context of the AI
37
- - The web-page uses about 1.4GB of RAM
38
 
39
  Notice that this demo is using the smallest GPT-2 model, so the generated text responses are not always very good.
40
  Also, the prompting strategy can likely be improved to achieve better results.
 
34
  - Latest Chrome or Firefox browser (Safari is not supported)
35
  - Run this on a desktop or laptop with modern CPU (a mobile phone will likely not be good enough)
36
  - Speak phrases that are no longer than 10 seconds - this is the audio context of the AI
37
+ - The web-page uses about 1.6GB of RAM
38
 
39
  Notice that this demo is using the smallest GPT-2 model, so the generated text responses are not always very good.
40
  Also, the prompting strategy can likely be improved to achieve better results.
examples/talk.wasm/gpt-2.cpp CHANGED
@@ -513,7 +513,7 @@ bool gpt2_eval(
513
  const int n_head = hparams.n_head;
514
  const int n_vocab = hparams.n_vocab;
515
 
516
- static size_t buf_size = 512u*1024*1024;
517
  static void * buf = malloc(buf_size);
518
 
519
  if (mem_per_token > 0 && mem_per_token*N > buf_size) {
 
513
  const int n_head = hparams.n_head;
514
  const int n_vocab = hparams.n_vocab;
515
 
516
+ static size_t buf_size = 640u*1024*1024;
517
  static void * buf = malloc(buf_size);
518
 
519
  if (mem_per_token > 0 && mem_per_token*N > buf_size) {
examples/talk.wasm/index-tmpl.html CHANGED
@@ -504,7 +504,13 @@
504
 
505
  function startRecording() {
506
  if (!context) {
507
- context = new AudioContext({sampleRate: 16000, noiseSuppression: true});
 
 
 
 
 
 
508
  }
509
 
510
  Module.set_status("");
 
504
 
505
  function startRecording() {
506
  if (!context) {
507
+ context = new AudioContext({
508
+ sampleRate: 16000,
509
+ channelCount: 1,
510
+ echoCancellation: true,
511
+ autoGainControl: true,
512
+ noiseSuppression: true,
513
+ });
514
  }
515
 
516
  Module.set_status("");