Skip to content

Commit

Permalink
Refactor WebAssembly for nodejs (k2-fsa#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Mar 2, 2024
1 parent a65643b commit ac6825f
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 29 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/wasm-simd-hf-space-de-tts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
path: ./sherpa-onnx-wasm-simd-*.tar.bz2

- name: Publish to ModelScope
if: false
# if: false
env:
MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
uses: nick-fields/retry@v2
Expand All @@ -92,6 +92,9 @@ jobs:
git clone http://www.modelscope.cn/studios/k2-fsa/web-assembly-tts-sherpa-onnx-de.git ms
cd ms
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down Expand Up @@ -126,6 +129,8 @@ jobs:
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-tts-sherpa-onnx-de huggingface
cd huggingface
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/wasm-simd-hf-space-en-asr-zipformer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
path: ./sherpa-onnx-wasm-simd-*.tar.bz2

- name: Publish to ModelScope
if: false
# if: false
env:
MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
uses: nick-fields/retry@v2
Expand All @@ -93,6 +93,8 @@ jobs:
git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-en.git ms
cd ms
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down Expand Up @@ -127,6 +129,8 @@ jobs:
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-en huggingface
cd huggingface
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/wasm-simd-hf-space-en-tts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
path: ./sherpa-onnx-wasm-simd-*.tar.bz2

- name: Publish to ModelScope
if: false
# if: false
env:
MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
uses: nick-fields/retry@v2
Expand All @@ -89,6 +89,8 @@ jobs:
git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-tts-sherpa-onnx-en.git ms
cd ms
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down Expand Up @@ -123,6 +125,8 @@ jobs:
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-tts-sherpa-onnx-en huggingface
cd huggingface
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ jobs:
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer huggingface
cd huggingface
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand All @@ -115,7 +117,7 @@ jobs:
git push https://csukuangfj:[email protected]/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer main
- name: Publish to ModelScope
if: false
# if: false
env:
MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
uses: nick-fields/retry@v2
Expand All @@ -134,6 +136,8 @@ jobs:
git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer.git ms
cd ms
rm -fv *.js
rm -fv *.data
git config lfs.locksverify true
git fetch
git pull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
path: ./sherpa-onnx-wasm-simd-*.tar.bz2

- name: Publish to ModelScope
if: false
# if: false
env:
MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
uses: nick-fields/retry@v2
Expand All @@ -100,6 +100,8 @@ jobs:
git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en-paraformer.git ms
cd ms
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down Expand Up @@ -134,6 +136,8 @@ jobs:
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en-paraformer huggingface
cd huggingface
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
path: ./sherpa-onnx-wasm-simd-*.tar.bz2

- name: Publish to ModelScope
if: false
# if: false
env:
MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
uses: nick-fields/retry@v2
Expand All @@ -91,6 +91,8 @@ jobs:
git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en.git ms
cd ms
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down Expand Up @@ -125,6 +127,8 @@ jobs:
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en huggingface
cd huggingface
rm -fv *.js
rm -fv *.data
git fetch
git pull
git merge -m "merge remote" --ff origin main
Expand Down
16 changes: 8 additions & 8 deletions wasm/asr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ if (NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ".js")
endif()
# set(CMAKE_EXECUTABLE_SUFFIX ".html")

add_executable(sherpa-onnx-wasm-asr-main sherpa-onnx-wasm-asr-main.cc)
target_link_libraries(sherpa-onnx-wasm-asr-main sherpa-onnx-c-api)
install(TARGETS sherpa-onnx-wasm-asr-main DESTINATION bin/wasm/asr)
add_executable(sherpa-onnx-wasm-main-asr sherpa-onnx-wasm-main-asr.cc)
target_link_libraries(sherpa-onnx-wasm-main-asr sherpa-onnx-c-api)
install(TARGETS sherpa-onnx-wasm-main-asr DESTINATION bin/wasm/asr)

install(
FILES
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-asr-main>/sherpa-onnx-wasm-asr-main.js"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-asr>/sherpa-onnx-wasm-main-asr.js"
"index.html"
"sherpa-onnx.js"
"app.js"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-asr-main>/sherpa-onnx-wasm-asr-main.wasm"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-asr-main>/sherpa-onnx-wasm-asr-main.data"
"sherpa-onnx-asr.js"
"app-asr.js"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-asr>/sherpa-onnx-wasm-main-asr.wasm"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-asr>/sherpa-onnx-wasm-main-asr.data"
DESTINATION
bin/wasm/asr
)
File renamed without changes.
6 changes: 3 additions & 3 deletions wasm/asr/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h1>
<section flex="1" overflow="auto" id="sound-clips">
</section>

<script src="sherpa-onnx.js"></script>
<script src="app.js"></script>
<script src="sherpa-onnx-wasm-asr-main.js"></script>
<script src="sherpa-onnx-asr.js"></script>
<script src="app-asr.js"></script>
<script src="sherpa-onnx-wasm-main-asr.js"></script>
</body>
File renamed without changes.
File renamed without changes.
17 changes: 8 additions & 9 deletions wasm/tts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@ if (NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ".js")
endif()
# set(CMAKE_EXECUTABLE_SUFFIX ".html")

add_executable(sherpa-onnx-wasm-main sherpa-onnx-wasm-main.cc)
target_link_libraries(sherpa-onnx-wasm-main sherpa-onnx-c-api)
install(TARGETS sherpa-onnx-wasm-main DESTINATION bin/wasm/tts)
add_executable(sherpa-onnx-wasm-main-tts sherpa-onnx-wasm-main-tts.cc)
target_link_libraries(sherpa-onnx-wasm-main-tts sherpa-onnx-c-api)
install(TARGETS sherpa-onnx-wasm-main-tts DESTINATION bin/wasm/tts)

install(
FILES
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.js"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-tts>/sherpa-onnx-wasm-main-tts.js"
"index.html"
"sherpa-onnx.js"
"app.js"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.wasm"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.data"
# "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.html"
"sherpa-onnx-tts.js"
"app-tts.js"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-tts>/sherpa-onnx-wasm-main-tts.wasm"
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-tts>/sherpa-onnx-wasm-main-tts.data"
DESTINATION
bin/wasm/tts
)
File renamed without changes.
6 changes: 3 additions & 3 deletions wasm/tts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1>
<section flex="1" overflow="auto" id="sound-clips">
</section>

<script src="app.js"></script>
<script src="sherpa-onnx.js"></script>
<script src="sherpa-onnx-wasm-main.js"></script>
<script src="app-tts.js"></script>
<script src="sherpa-onnx-tts.js"></script>
<script src="sherpa-onnx-wasm-main-tts.js"></script>
</body>
File renamed without changes.
File renamed without changes.

0 comments on commit ac6825f

Please sign in to comment.