Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2024-03-06 18:21:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-03-06 18:21:50 +0800
Commit
f70fdd156c92fef376fe7b3e55d6de91f993456b
f70fdd15
1 parent
bdf92439
Support using T-head-Semi/csi-nn2 for RISC-V (#637)
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
71 行增加
和
35 行删除
.github/workflows/riscv64-linux.yaml
build-riscv64-linux-gnu.sh
cmake/onnxruntime-linux-riscv64.cmake
.github/workflows/riscv64-linux.yaml
查看文件 @
f70fdd1
...
...
@@ -38,7 +38,7 @@ jobs:
fail-fast
:
false
matrix
:
os
:
[
ubuntu-latest
]
lib_type
:
[
s
tatic
,
shared
]
lib_type
:
[
s
hared
]
#, static
]
steps
:
-
uses
:
actions/checkout@v4
...
...
@@ -55,45 +55,35 @@ jobs:
uses
:
actions/cache@v4
with
:
path
:
qemu-install
key
:
qemu-riscv-install-20240225
-
name
:
install-qemu-build-deps
if
:
steps.cache-qemu.outputs.cache-hit != 'true'
run
:
|
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
-
name
:
checkout-qemu
if
:
steps.cache-qemu.outputs.cache-hit != 'true'
uses
:
actions/checkout@v3
with
:
repository
:
qemu/qemu
path
:
qemu
key
:
qemu-riscv-xuantie-install-20240306
-
name
:
qemu
if
:
steps.cache-qemu.outputs.cache-hit != 'true'
run
:
|
cd qemu
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=riscv64-linux-user --disable-system
make -j2
make install
ls -lh $GITHUB_WORKSPACE/qemu-install
ls -lh $GITHUB_WORKSPACE/qemu-install/bin
# https://pypi.org/project/xuantie-qemu/#files
wget -q https://files.pythonhosted.org/packages/21/f4/733f29c435987e8bb264a6504c7a4ea4c04d0d431b38a818ab63eef082b9/xuantie_qemu-20230825-py3-none-manylinux1_x86_64.whl
unzip xuantie_qemu-20230825-py3-none-manylinux1_x86_64.whl
mkdir -p qemu-install/bin
cp -v ./qemu/qemu-riscv64 ./qemu-install/bin
-
name
:
cache-toolchain
id
:
cache-toolchain
uses
:
actions/cache@v4
with
:
path
:
toolchain
key
:
riscv64-glibc-ubuntu-20.04-gcc-nightly-2023.10.17-nightly
key
:
Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz
-
name
:
Download toolchain
if
:
steps.cache-toolchain.outputs.cache-hit != 'true'
shell
:
bash
run
:
|
wget -q https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1663142514282/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz
mkdir $GITHUB_WORKSPACE/toolchain
wget -q https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.10.17/riscv64-glibc-ubuntu-20.04-gcc-nightly-2023.10.17-nightly.tar.gz
tar xvf ./riscv64-glibc-ubuntu-20.04-gcc-nightly-2023.10.17-nightly.tar.gz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain
tar xvf ./Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain
ls -lh $GITHUB_WORKSPACE/toolchain/bin
-
name
:
Display toolchain info
shell
:
bash
...
...
@@ -139,6 +129,7 @@ jobs:
export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/sysroot
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/toolchain/sysroot/lib
ls -lh ./build-riscv64-linux-gnu/bin
...
...
@@ -154,6 +145,44 @@ jobs:
qemu-riscv64 ./build-riscv64-linux-gnu/bin/sherpa-onnx-offline-tts --help
readelf -d ./build-riscv64-linux-gnu/bin/sherpa-onnx-offline-tts
-
name
:
Test streaming speech recognition
shell
:
bash
run
:
|
export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/sysroot
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/toolchain/sysroot/lib
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23.tar.bz2
tar xvf sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23.tar.bz2
rm sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23.tar.bz2
qemu-riscv64 ./build-riscv64-linux-gnu/bin/sherpa-onnx \
--tokens=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/tokens.txt \
--encoder=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/encoder-epoch-99-avg-1.onnx \
--decoder=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/decoder-epoch-99-avg-1.onnx \
--joiner=./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/joiner-epoch-99-avg-1.onnx \
./sherpa-onnx-streaming-zipformer-zh-14M-2023-02-23/test_wavs/0.wav
-
name
:
Test offline tts
shell
:
bash
run
:
|
export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/sysroot
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/toolchain/sysroot/lib
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-lessac-medium.tar.bz2
tar xf vits-piper-en_US-lessac-medium.tar.bz2
rm vits-piper-en_US-lessac-medium.tar.bz2
qemu-riscv64 ./build-riscv64-linux-gnu/bin/sherpa-onnx-offline-tts \
--vits-model=./vits-piper-en_US-lessac-medium/en_US-lessac-medium.onnx \
--vits-data-dir=./vits-piper-en_US-lessac-medium/espeak-ng-data \
--vits-tokens=./vits-piper-en_US-lessac-medium/tokens.txt \
--output-filename=./liliana-piper-en_US-lessac-medium.wav \
'liliana, the most beautiful and lovely assistant of our team!'
-
name
:
Copy files
shell
:
bash
run
:
|
...
...
@@ -191,6 +220,12 @@ jobs:
path
:
sherpa-onnx-*linux-riscv64-shared.tar.bz2
-
uses
:
actions/upload-artifact@v4
if
:
matrix.lib_type == 'shared'
with
:
name
:
wave
path
:
./*.wav
-
uses
:
actions/upload-artifact@v4
if
:
matrix.lib_type == 'static'
with
:
name
:
sherpa-onnx-linux-riscv64-static
...
...
build-riscv64-linux-gnu.sh
查看文件 @
f70fdd1
#!/usr/bin/env bash
set
-ex
if
!
command
-v riscv64-unknown-linux-gnu-g++ &> /dev/null;
then
echo
"Please install the toolchain first."
...
...
@@ -42,8 +43,8 @@ export CPLUS_INCLUDE_PATH=$PWD/alsa-lib/include:$CPLUS_INCLUDE_PATH
export
SHERPA_ONNX_ALSA_LIB_DIR
=
$PWD
/alsa-lib/src/.libs
if
[[
x
"
$BUILD_SHARED_LIBS
"
==
x
""
]]
;
then
# By default, use static link
BUILD_SHARED_LIBS
=
OFF
# By default, use shared libraries
BUILD_SHARED_LIBS
=
ON
fi
cmake
\
...
...
cmake/onnxruntime-linux-riscv64.cmake
查看文件 @
f70fdd1
...
...
@@ -14,19 +14,19 @@ if(NOT BUILD_SHARED_LIBS)
message
(
FATAL_ERROR
"This file is for building shared libraries. BUILD_SHARED_LIBS:
${
BUILD_SHARED_LIBS
}
"
)
endif
()
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.18.0/onnxruntime-linux-riscv64-1.18.0.zip"
)
set
(
onnxruntime_URL2
"https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.18.0/onnxruntime-linux-riscv64-1.18.0.zip"
)
set
(
onnxruntime_HASH
"SHA256=81a11b54d1d71f4b3161b00cba8576a07594abd218aa5c0d82382960ada06092"
)
set
(
onnxruntime_URL
"https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.14.1/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip"
)
set
(
onnxruntime_URL2
"https://hub.nuaa.cf/csukuangfj/onnxruntime-libs/releases/download/v1.14.1/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip"
)
set
(
onnxruntime_HASH
"SHA256=c2cbc5af081ff82f46640befd85433811486daaf28e702163c6e4e75020fde81"
)
# If you don't have access to the Internet,
# please download onnxruntime to one of the following locations.
# You can add more if you want.
set
(
possible_file_locations
$ENV{HOME}/Downloads/onnxruntime-linux-riscv64-1.18.0.zip
${
CMAKE_SOURCE_DIR
}
/onnxruntime-linux-riscv64-1.18.0.zip
${
CMAKE_BINARY_DIR
}
/onnxruntime-linux-riscv64-1.18.0.zip
/tmp/onnxruntime-linux-riscv64-1.18.0.zip
/star-fj/fangjun/download/github/onnxruntime-linux-riscv64-1.18.0.zip
$ENV{HOME}/Downloads/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip
${
CMAKE_SOURCE_DIR
}
/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip
${
CMAKE_BINARY_DIR
}
/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip
/tmp/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip
/star-fj/fangjun/download/github/onnxruntime-linux-riscv64-glibc2_17-Release-1.14.1.zip
)
foreach
(
f IN LISTS possible_file_locations
)
...
...
@@ -65,7 +65,7 @@ add_library(onnxruntime SHARED IMPORTED)
set_target_properties
(
onnxruntime PROPERTIES
IMPORTED_LOCATION
${
location_onnxruntime
}
INTERFACE_INCLUDE_DIRECTORIES
"
${
onnxruntime_SOURCE_DIR
}
/include/
onnxruntime
"
INTERFACE_INCLUDE_DIRECTORIES
"
${
onnxruntime_SOURCE_DIR
}
/include/"
)
file
(
GLOB onnxruntime_lib_files
"
${
onnxruntime_SOURCE_DIR
}
/lib/libonnxruntime*"
)
...
...
请
注册
或
登录
后发表评论