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
zhaomingwork
2023-08-05 10:32:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-08-05 10:32:48 +0800
Commit
5c9aebd5839cca2ba44384019d393212ece61882
5c9aebd5
1 parent
92976b04
For java ci actions (#231)
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
130 行增加
和
3 行删除
.github/workflows/run-java-test.yaml
java-api-examples/Makefile
java-api-examples/README.md
java-api-examples/runtest.sh
java-api-examples/src/DecodeFile.java
.github/workflows/run-java-test.yaml
0 → 100644
查看文件 @
5c9aebd
name
:
run-java-test
on
:
push
:
branches
:
-
master
paths
:
-
'
.github/workflows/run-java-test.yaml'
-
'
CMakeLists.txt'
-
'
cmake/**'
-
'
java-api-examples/**'
-
'
sherpa-onnx/csrc/*'
-
'
sherpa-onnx/jni/*'
pull_request
:
branches
:
-
master
paths
:
-
'
.github/workflows/run-java-test.yaml'
-
'
CMakeLists.txt'
-
'
cmake/**'
-
'
java-api-examples/**'
-
'
sherpa-onnx/csrc/*'
-
'
sherpa-onnx/jni/*'
concurrency
:
group
:
jni-${{ github.ref }}
cancel-in-progress
:
true
permissions
:
contents
:
read
jobs
:
jni
:
runs-on
:
${{ matrix.os }}
strategy
:
fail-fast
:
false
matrix
:
os
:
[
ubuntu-latest
]
steps
:
-
uses
:
actions/checkout@v2
with
:
fetch-depth
:
0
-
name
:
Display java version
shell
:
bash
run
:
|
java -version
echo "JAVA_HOME is: ${JAVA_HOME}"
-
name
:
Run java test
shell
:
bash
run
:
|
cd ./java-api-examples
./runtest.sh
...
...
java-api-examples/Makefile
查看文件 @
5c9aebd
...
...
@@ -73,10 +73,10 @@ runmic:
java -cp ./lib/sherpaonnx.jar
:
build $(RUNJFLAGS) DecodeMic
runsrv
:
java -cp
$(BUILD_DIR)
:lib/Java-WebSocket-1.5.3.jar:lib/slf4j-simple-1.7.25.jar:lib/slf4j-api-1.7.25.jar:../lib/sherpaonnx.jar
$(RUNJFLAGS)
websocketsrv.AsrWebsocketServer
/sherpa-onnx/20230515/zhaoming/sherpa-onnx/build/lib/libsherpa-onnx-jni.so ./modelconfig
.cfg
java -cp
$(BUILD_DIR)
:lib/Java-WebSocket-1.5.3.jar:lib/slf4j-simple-1.7.25.jar:lib/slf4j-api-1.7.25.jar:../lib/sherpaonnx.jar
$(RUNJFLAGS)
websocketsrv.AsrWebsocketServer
../build/lib/libsherpa-onnx-jni.so ./modeltest
.cfg
runclient
:
java -cp
$(BUILD_DIR)
:lib/Java-WebSocket-1.5.3.jar:lib/slf4j-simple-1.7.25.jar:lib/slf4j-api-1.7.25.jar:../lib/sherpaonnx.jar
$(RUNJFLAGS)
websocketsrv.AsrWebsocketClient
/sherpa-onnx/20230515/zhaoming/sherpa-onnx
/build/lib/libsherpa-onnx-jni.so 127.0.0.1 8890 ./test.wav 32
java -cp
$(BUILD_DIR)
:lib/Java-WebSocket-1.5.3.jar:lib/slf4j-simple-1.7.25.jar:lib/slf4j-api-1.7.25.jar:../lib/sherpaonnx.jar
$(RUNJFLAGS)
websocketsrv.AsrWebsocketClient
..
/build/lib/libsherpa-onnx-jni.so 127.0.0.1 8890 ./test.wav 32
buildlib
:
$(LIB_FILES:.java=.class)
...
...
java-api-examples/README.md
查看文件 @
5c9aebd
...
...
@@ -185,3 +185,9 @@ json result example: {"text":"甚至出现交易几乎停滞的情况","eof":"tr
make runclient /
**
change path
in
Makefile according to your env
**
/
```
7 runtest
this script will download model, compile codes and run test
```
bash
cd
sherpa-onnx/java-api-examples
runtest.sh
```
\ No newline at end of file
...
...
java-api-examples/runtest.sh
0 → 100755
查看文件 @
5c9aebd
#!/usr/bin/env bash
#
# This scripts shows how to test java for sherpa-onnx
# Note: This scripts runs only on Linux and macOS
set
-e
log
()
{
# This function is from espnet
local
fname
=
${
BASH_SOURCE
[1]##*/
}
echo
-e
"
$(
date
'+%Y-%m-%d %H:%M:%S'
)
(
${
fname
}
:
${
BASH_LINENO
[0]
}
:
${
FUNCNAME
[1]
}
)
$*
"
}
echo
"PATH:
$PATH
"
log
"------------------------------------------------------------"
log
"Run download model"
log
"------------------------------------------------------------"
repo_url
=
https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
log
"Start testing
${
repo_url
}
"
repo
=
$(
basename
$repo_url
)
log
"download dir is
$(
basename
$repo_url
)
"
if
[
! -d
$repo
]
;
then
log
"Download pretrained model and test-data from
$repo_url
"
GIT_LFS_SKIP_SMUDGE
=
1 git clone
$repo_url
pushd
$repo
git lfs pull --include
"*.onnx"
ls -lh
*
.onnx
popd
fi
log
$(
pwd
)
sed -e
's?/sherpa/?'
$(
pwd
)
'/?g'
modelconfig.cfg > modeltest.cfg
log
"display model cfg"
cat modeltest.cfg
cd
..
export
JAVA_HOME
=
$(
readlink -f /usr/bin/javac | sed
"s:/bin/javac::"
)
mkdir -p build
cd
build
cmake -DCMAKE_BUILD_TYPE
=
Release -DBUILD_SHARED_LIBS
=
ON -DSHERPA_ONNX_ENABLE_JNI
=
ON ..
make -j4
ls -lh lib
export
LD_LIBRARY_PATH
=
$PWD
/build/lib:
$LD_LIBRARY_PATH
cd
../java-api-examples
make all
make runfile
...
...
java-api-examples/src/DecodeFile.java
查看文件 @
5c9aebd
...
...
@@ -159,7 +159,7 @@ public class DecodeFile {
String
appDir
=
System
.
getProperty
(
"user.dir"
);
System
.
out
.
println
(
"appdir="
+
appDir
);
String
fileName
=
appDir
+
"/test.wav"
;
String
cfgPath
=
appDir
+
"/model
config
.cfg"
;
String
cfgPath
=
appDir
+
"/model
test
.cfg"
;
String
soPath
=
appDir
+
"/../build/lib/libsherpa-onnx-jni.so"
;
OnlineRecognizer
.
setSoPath
(
soPath
);
DecodeFile
rcgDemo
=
new
DecodeFile
(
fileName
);
...
...
请
注册
或
登录
后发表评论