Skip to content

Commit aea89fe

Browse files
authored
Upload wasm files to huggingface (#302)
1 parent 72ea103 commit aea89fe

File tree

3 files changed

+212
-3
lines changed

3 files changed

+212
-3
lines changed

.github/workflows/build-wasm-simd.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ jobs:
8888
run: |
8989
SHERPA_NCNN_VERSION=v$(grep "SHERPA_NCNN_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
9090
91-
mv build-wasm-simd/install/bin/wasm sherpa-ncnn-wasm-simd
92-
ls -lh sherpa-ncnn-wasm-simd
93-
tar cjfv sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}.tar.bz2 ./sherpa-ncnn-wasm-simd
91+
mv build-wasm-simd/install/bin/wasm sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
92+
ls -lh sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
93+
tar cjfv sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}.tar.bz2 ./sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
94+
9495
9596
- name: Upload wasm files
9697
uses: actions/upload-artifact@v4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: wasm-simd-hf-space-en
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: wasm-simd-hf-space-en-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
wasm-simd-hf-space-en:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Install emsdk
27+
uses: mymindstorm/setup-emsdk@v14
28+
29+
- name: View emsdk version
30+
shell: bash
31+
run: |
32+
emcc -v
33+
echo "--------------------"
34+
emcc --check
35+
36+
- name: Download model files
37+
shell: bash
38+
run: |
39+
cd wasm/assets
40+
ls -lh
41+
echo "----------"
42+
wget -q https://github.com/k2-fsa/sherpa-ncnn/releases/download/models/sherpa-ncnn-streaming-zipformer-en-2023-02-13.tar.bz2
43+
tar xvf sherpa-ncnn-streaming-zipformer-en-2023-02-13.tar.bz2
44+
mv -v sherpa-ncnn-streaming-zipformer-en-2023-02-13/*pnnx.ncnn.param .
45+
mv -v sherpa-ncnn-streaming-zipformer-en-2023-02-13/*pnnx.ncnn.bin .
46+
mv -v sherpa-ncnn-streaming-zipformer-en-2023-02-13/tokens.txt .
47+
48+
rm -rf sherpa-ncnn-streaming-zipformer-en-2023-02-13
49+
rm -v sherpa-ncnn-streaming-zipformer-en-2023-02-13.tar.bz2
50+
51+
ls -lh
52+
53+
- name: Build sherpa-ncnn for WebAssembly
54+
shell: bash
55+
run: |
56+
./build-wasm-simd.sh
57+
58+
- name: collect files
59+
shell: bash
60+
run: |
61+
SHERPA_NCNN_VERSION=v$(grep "SHERPA_NCNN_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
62+
63+
mv build-wasm-simd/install/bin/wasm sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
64+
ls -lh sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
65+
tar cjfv sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}.tar.bz2 ./sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
66+
67+
- name: Upload wasm files
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: sherpa-ncnn-wasm-simd-en
71+
path: ./sherpa-ncnn-wasm-simd-*.tar.bz2
72+
73+
- name: Publish to huggingface
74+
env:
75+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
76+
uses: nick-fields/retry@v2
77+
with:
78+
max_attempts: 20
79+
timeout_seconds: 200
80+
shell: bash
81+
command: |
82+
SHERPA_NCNN_VERSION=v$(grep "SHERPA_NCNN_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
83+
84+
git config --global user.email "[email protected]"
85+
git config --global user.name "Fangjun Kuang"
86+
87+
rm -rf huggingface
88+
export GIT_LFS_SKIP_SMUDGE=1
89+
90+
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-ncnn-en huggingface
91+
cd huggingface
92+
git fetch
93+
git pull
94+
git merge -m "merge remote" --ff origin main
95+
96+
cp -v ../sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}/* .
97+
98+
git status
99+
git lfs track "*.data"
100+
git lfs track "*.wasm"
101+
102+
git add .
103+
git commit -m "update model"
104+
git push https://csukuangfj:[email protected]/spaces/k2-fsa/web-assembly-asr-sherpa-ncnn-en main
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: wasm-simd-hf-space-zh-en
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: wasm-simd-hf-space-zh-en-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
wasm-simd-hf-space-zh-en:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Install emsdk
27+
uses: mymindstorm/setup-emsdk@v14
28+
29+
- name: View emsdk version
30+
shell: bash
31+
run: |
32+
emcc -v
33+
echo "--------------------"
34+
emcc --check
35+
36+
- name: Download model files
37+
shell: bash
38+
run: |
39+
cd wasm/assets
40+
ls -lh
41+
echo "----------"
42+
wget -q https://github.com/k2-fsa/sherpa-ncnn/releases/download/models/sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13.tar.bz2
43+
tar xvf sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13.tar.bz2
44+
mv -v sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/*pnnx.ncnn.param .
45+
mv -v sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/*pnnx.ncnn.bin .
46+
mv -v sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13/tokens.txt .
47+
48+
rm -rf sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13
49+
rm -v sherpa-ncnn-streaming-zipformer-bilingual-zh-en-2023-02-13.tar.bz2
50+
51+
ls -lh
52+
53+
- name: Build sherpa-ncnn for WebAssembly
54+
shell: bash
55+
run: |
56+
./build-wasm-simd.sh
57+
58+
- name: collect files
59+
shell: bash
60+
run: |
61+
SHERPA_NCNN_VERSION=v$(grep "SHERPA_NCNN_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
62+
63+
mv build-wasm-simd/install/bin/wasm sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
64+
ls -lh sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
65+
tar cjfv sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}.tar.bz2 ./sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}
66+
67+
- name: Upload wasm files
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: sherpa-ncnn-wasm-simd-zh-en
71+
path: ./sherpa-ncnn-wasm-simd-*.tar.bz2
72+
73+
- name: Publish to huggingface
74+
env:
75+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
76+
uses: nick-fields/retry@v2
77+
with:
78+
max_attempts: 20
79+
timeout_seconds: 200
80+
shell: bash
81+
command: |
82+
SHERPA_NCNN_VERSION=v$(grep "SHERPA_NCNN_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
83+
84+
git config --global user.email "[email protected]"
85+
git config --global user.name "Fangjun Kuang"
86+
87+
rm -rf huggingface
88+
export GIT_LFS_SKIP_SMUDGE=1
89+
90+
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-ncnn-zh-en huggingface
91+
cd huggingface
92+
git fetch
93+
git pull
94+
git merge -m "merge remote" --ff origin main
95+
96+
cp -v ../sherpa-ncnn-wasm-simd-${SHERPA_NCNN_VERSION}/* .
97+
98+
git status
99+
git lfs track "*.data"
100+
git lfs track "*.wasm"
101+
102+
git add .
103+
git commit -m "update model"
104+
git push https://csukuangfj:[email protected]/spaces/k2-fsa/web-assembly-asr-sherpa-ncnn-zh-en main

0 commit comments

Comments
 (0)