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
2025-04-03 00:02:09 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2025-04-03 00:02:09 +0800
Commit
ba7d8b63f06a821001d9c9b9d42de2b97f95376d
ba7d8b63
1 parent
2dc0f919
Add Go API for Dolphin CTC models (#2090)
显示空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
36 行增加
和
3 行删除
.github/workflows/test-go.yaml
c-api-examples/vad-moonshine-c-api.c
c-api-examples/vad-sense-voice-c-api.c
c-api-examples/vad-whisper-c-api.c
go-api-examples/non-streaming-decode-files/main.go
go-api-examples/non-streaming-decode-files/run-dolphin-ctc-base.sh
scripts/go/_internal/non-streaming-decode-files/run-dolphin-ctc-base.sh
scripts/go/sherpa_onnx.go
.github/workflows/test-go.yaml
查看文件 @
ba7d8b6
...
...
@@ -179,6 +179,10 @@ jobs:
go build
ls -lh
echo "Test Dolphin CTC"
./run-dolphin-ctc-base.sh
rm -rf sherpa-onnx-dolphin-*
echo "Test FireRedAsr"
./run-fire-red-asr.sh
rm -rf sherpa-onnx-fire-red-asr-*
...
...
c-api-examples/vad-moonshine-c-api.c
查看文件 @
ba7d8b6
...
...
@@ -86,7 +86,7 @@ int32_t main() {
vadConfig
.
num_threads
=
1
;
vadConfig
.
debug
=
1
;
SherpaOnnxVoiceActivityDetector
*
vad
=
const
SherpaOnnxVoiceActivityDetector
*
vad
=
SherpaOnnxCreateVoiceActivityDetector
(
&
vadConfig
,
30
);
if
(
vad
==
NULL
)
{
...
...
c-api-examples/vad-sense-voice-c-api.c
查看文件 @
ba7d8b6
...
...
@@ -87,7 +87,7 @@ int32_t main() {
vadConfig
.
num_threads
=
1
;
vadConfig
.
debug
=
1
;
SherpaOnnxVoiceActivityDetector
*
vad
=
const
SherpaOnnxVoiceActivityDetector
*
vad
=
SherpaOnnxCreateVoiceActivityDetector
(
&
vadConfig
,
30
);
if
(
vad
==
NULL
)
{
...
...
c-api-examples/vad-whisper-c-api.c
查看文件 @
ba7d8b6
...
...
@@ -84,7 +84,7 @@ int32_t main() {
vadConfig
.
num_threads
=
1
;
vadConfig
.
debug
=
1
;
SherpaOnnxVoiceActivityDetector
*
vad
=
const
SherpaOnnxVoiceActivityDetector
*
vad
=
SherpaOnnxCreateVoiceActivityDetector
(
&
vadConfig
,
30
);
if
(
vad
==
NULL
)
{
...
...
go-api-examples/non-streaming-decode-files/main.go
查看文件 @
ba7d8b6
...
...
@@ -28,6 +28,8 @@ func main() {
flag
.
StringVar
(
&
config
.
ModelConfig
.
NemoCTC
.
Model
,
"nemo-ctc"
,
""
,
"Path to the NeMo CTC model"
)
flag
.
StringVar
(
&
config
.
ModelConfig
.
Dolphin
.
Model
,
"dolphin-model"
,
""
,
"Path to the Dolphin CTC model"
)
flag
.
StringVar
(
&
config
.
ModelConfig
.
FireRedAsr
.
Encoder
,
"fire-red-asr-encoder"
,
""
,
"Path to the FireRedAsr encoder model"
)
flag
.
StringVar
(
&
config
.
ModelConfig
.
FireRedAsr
.
Decoder
,
"fire-red-asr-decoder"
,
""
,
"Path to the FireRedAsr decoder model"
)
...
...
go-api-examples/non-streaming-decode-files/run-dolphin-ctc-base.sh
0 → 100755
查看文件 @
ba7d8b6
#!/usr/bin/env bash
set
-ex
if
[
! -f ./sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02/model.int8.onnx
]
;
then
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02.tar.bz2
tar xvf sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02.tar.bz2
rm sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02.tar.bz2
ls -lh sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02
fi
go mod tidy
go build
./non-streaming-decode-files
\
--dolphin-model ./sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02/model.int8.onnx
\
--tokens ./sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02/tokens.txt
\
--debug 0
\
./sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02/test_wavs/0.wav
...
...
scripts/go/_internal/non-streaming-decode-files/run-dolphin-ctc-base.sh
0 → 120000
查看文件 @
ba7d8b6
../../../../go-api-examples/non-streaming-decode-files/run-dolphin-ctc-base.sh
\ No newline at end of file
...
...
scripts/go/sherpa_onnx.go
查看文件 @
ba7d8b6
...
...
@@ -377,6 +377,10 @@ type OfflineNemoEncDecCtcModelConfig struct {
Model
string
// Path to the model, e.g., model.onnx or model.int8.onnx
}
type
OfflineDolphinModelConfig
struct
{
Model
string
// Path to the model, e.g., model.onnx or model.int8.onnx
}
type
OfflineWhisperModelConfig
struct
{
Encoder
string
Decoder
string
...
...
@@ -422,6 +426,7 @@ type OfflineModelConfig struct {
SenseVoice
OfflineSenseVoiceModelConfig
Moonshine
OfflineMoonshineModelConfig
FireRedAsr
OfflineFireRedAsrModelConfig
Dolphin
OfflineDolphinModelConfig
Tokens
string
// Path to tokens.txt
// Number of threads to use for neural network computation
...
...
@@ -512,6 +517,8 @@ func newCOfflineRecognizerConfig(config *OfflineRecognizerConfig) *C.struct_Sher
c
.
model_config
.
fire_red_asr
.
encoder
=
C
.
CString
(
config
.
ModelConfig
.
FireRedAsr
.
Encoder
)
c
.
model_config
.
fire_red_asr
.
decoder
=
C
.
CString
(
config
.
ModelConfig
.
FireRedAsr
.
Decoder
)
c
.
model_config
.
dolphin
.
model
=
C
.
CString
(
config
.
ModelConfig
.
Dolphin
.
Model
)
c
.
model_config
.
tokens
=
C
.
CString
(
config
.
ModelConfig
.
Tokens
)
c
.
model_config
.
num_threads
=
C
.
int
(
config
.
ModelConfig
.
NumThreads
)
...
...
请
注册
或
登录
后发表评论