mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-10-26 05:43:59 +03:00
Improved wasm test_page
- test page can load all 5 language pairs - Use intgemm.aplha* models - start_server.sh script automatically enable simdwormhole via APIs that instantiate WASM module
This commit is contained in:
parent
d1ecd007a6
commit
bf28edad82
@ -32,6 +32,9 @@
|
||||
<label>Choose the model to use</label>
|
||||
<input type="radio" name="modellang" value="enes"/><label>English to Spanish</label>
|
||||
<input type="radio" name="modellang" value="esen" checked/><label>Spanish to English</label>
|
||||
<input type="radio" name="modellang" value="eten" checked/><label>Estonian to English</label>
|
||||
<input type="radio" name="modellang" value="enet" checked/><label>English to Estonian</label>
|
||||
<input type="radio" name="modellang" value="ende" checked/><label>English to German</label>
|
||||
<input type="button" id="load" value="Load Model"/>
|
||||
</div>
|
||||
|
||||
@ -70,7 +73,7 @@ En consecuencia, durante el año 2011 se introdujeron 180 proyectos de ley que r
|
||||
// Set the Model Configuration as YAML formatted string.
|
||||
// For available configuration options, please check: https://marian-nmt.github.io/docs/cmd/marian-decoder/
|
||||
const modelConfig = `models:
|
||||
- /${languagePair}/model.${languagePair}.intgemm.bin
|
||||
- /${languagePair}/model.${languagePair}.intgemm.alphas.bin
|
||||
vocabs:
|
||||
- /${vocabLanguagePair}/vocab.${vocabLanguagePair}.spm
|
||||
- /${vocabLanguagePair}/vocab.${vocabLanguagePair}.spm
|
||||
|
@ -1,8 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Start: Copying artifacts in local folder------"
|
||||
cp ../../build-wasm/wasm/bergamot-translator-worker.data .
|
||||
cp ../../build-wasm/wasm/bergamot-translator-worker.js .
|
||||
cp ../../build-wasm/wasm/bergamot-translator-worker.wasm .
|
||||
cp ../../build-wasm/wasm/bergamot-translator-worker.worker.js .
|
||||
echo "Done----"
|
||||
|
||||
echo "Start: Enabling wormhole via APIs that compile and instantiate wasm module-------"
|
||||
sed -i.bak 's/var result = WebAssembly.instantiateStreaming(response, info);/var result = WebAssembly.instantiateStreaming(response, info, {simdWormhole:true});/g' bergamot-translator-worker.js
|
||||
sed -i.bak 's/return WebAssembly.instantiate(binary, info);/return WebAssembly.instantiate(binary, info, {simdWormhole:true});/g' bergamot-translator-worker.js
|
||||
sed -i.bak 's/var module = new WebAssembly.Module(bytes);/var module = new WebAssembly.Module(bytes, {simdWormhole:true});/g' bergamot-translator-worker.js
|
||||
echo "Done: Enabling wormhole via APIs that compile and instantiate wasm module--------"
|
||||
|
||||
npm install
|
||||
echo "Start httpserver"
|
||||
node bergamot-httpserver.js
|
Loading…
Reference in New Issue
Block a user