Skip to content

Commit a219f9f

Browse files
committed
examples : add note about WHISPER_WASM_SINGLE_FILE
This commit adds a note to the README files of the WASM examples about the `WHISPER_WASM_SINGLE_FILE` option. The motivation for this is that currently this option is not documented and might be surprising to users who expect a separate .wasm file to be generated. Refs: ggml-org#3290
1 parent 1f5cf0b commit a219f9f

4 files changed

Lines changed: 40 additions & 0 deletions

File tree

examples/bench.wasm/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ cp bin/libbench.js /path/to/html/
3232
cp bin/libbench.worker.js /path/to/html/
3333
```
3434

35+
> 📝 **Note:** By default this example is built with `WHISPER_WASM_SINGLE_FILE=ON`
36+
> which means that that a separate .wasm file will not be generated. Instead, the
37+
> WASM module is embedded in the main JS file as a base64 encoded string. To
38+
> generate a separate .wasm file, you need to disable this option by passing
39+
> `-DWHISPER_WASM_SINGLE_FILE=OFF`:
40+
> ```console
41+
> emcmake cmake .. -DWHISPER_WASM_SINGLE_FILE=OFF
42+
> ```
43+
> This will generate a `libbench.wasm` file in the build/bin directory.
44+
3545
> 📝 **Note:** As of Emscripten 3.1.58 (April 2024), separate worker.js files are no
3646
> longer generated and the worker is embedded in the main JS file. So the worker
3747
> file will not be geneated for versions later than `3.1.58`.

examples/command.wasm/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ cp bin/libcommand.js /path/to/html/
3232
cp bin/libcommand.worker.js /path/to/html/
3333
```
3434

35+
> 📝 **Note:** By default this example is built with `WHISPER_WASM_SINGLE_FILE=ON`
36+
> which means that that a separate .wasm file will not be generated. Instead, the
37+
> WASM module is embedded in the main JS file as a base64 encoded string. To
38+
> generate a separate .wasm file, you need to disable this option by passing
39+
> `-DWHISPER_WASM_SINGLE_FILE=OFF`:
40+
> ```console
41+
> emcmake cmake .. -DWHISPER_WASM_SINGLE_FILE=OFF
42+
> ```
43+
> This will generate a `libcommand.wasm` file in the build/bin directory.
44+
3545
> 📝 **Note:** As of Emscripten 3.1.58 (April 2024), separate worker.js files are no
3646
> longer generated and the worker is embedded in the main JS file. So the worker
3747
> file will not be geneated for versions later than `3.1.58`.

examples/stream.wasm/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ cp bin/libstream.js /path/to/html/
3030
cp bin/libstream.worker.js /path/to/html/
3131
```
3232

33+
> 📝 **Note:** By default this example is built with `WHISPER_WASM_SINGLE_FILE=ON`
34+
> which means that that a separate .wasm file will not be generated. Instead, the
35+
> WASM module is embedded in the main JS file as a base64 encoded string. To
36+
> generate a separate .wasm file, you need to disable this option by passing
37+
> `-DWHISPER_WASM_SINGLE_FILE=OFF`:
38+
> ```console
39+
> emcmake cmake .. -DWHISPER_WASM_SINGLE_FILE=OFF
40+
> ```
41+
> This will generate a `libstream.wasm` file in the build/bin directory.
42+
3343
> 📝 **Note:** As of Emscripten 3.1.58 (April 2024), separate worker.js files are no
3444
> longer generated and the worker is embedded in the main JS file. So the worker
3545
> file will not be geneated for versions later than `3.1.58`.

examples/whisper.wasm/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ cp bin/libmain.js /path/to/html/
5252
cp bin/libmain.worker.js /path/to/html/
5353
```
5454

55+
> 📝 **Note:** By default this example is built with `WHISPER_WASM_SINGLE_FILE=ON`
56+
> which means that that a separate .wasm file will not be generated. Instead, the
57+
> WASM module is embedded in the main JS file as a base64 encoded string. To
58+
> generate a separate .wasm file, you need to disable this option by passing
59+
> `-DWHISPER_WASM_SINGLE_FILE=OFF`:
60+
> ```console
61+
> emcmake cmake .. -DWHISPER_WASM_SINGLE_FILE=OFF
62+
> ```
63+
> This will generate a `libmain.wasm` file in the build/bin directory.
64+
5565
> 📝 **Note:** As of Emscripten 3.1.58 (April 2024), separate worker.js files are no
5666
> longer generated and the worker is embedded in the main JS file. So the worker
5767
> file will not be geneated for versions later than `3.1.58`.

0 commit comments

Comments
 (0)