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-02-17 16:04:07 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2025-02-17 16:04:07 +0800
Commit
87a968b55d9e1d7ed21c275a1b9e1ffa2815cdb5
87a968b5
1 parent
b5d89d7b
Add Go API for FireRedAsr AED Model (#1879)
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
40 行增加
和
0 行删除
.github/workflows/test-go.yaml
go-api-examples/non-streaming-decode-files/main.go
go-api-examples/non-streaming-decode-files/run-fire-red-asr.sh
scripts/go/_internal/non-streaming-decode-files/run-fire-red-asr.sh
scripts/go/sherpa_onnx.go
.github/workflows/test-go.yaml
查看文件 @
87a968b
...
...
@@ -160,6 +160,10 @@ jobs:
go build
ls -lh
echo "Test FireRedAsr"
./run-fire-red-asr.sh
rm -rf sherpa-onnx-fire-red-asr-*
echo "Test Moonshine"
./run-moonshine.sh
rm -rf sherpa-onnx-*
...
...
go-api-examples/non-streaming-decode-files/main.go
查看文件 @
87a968b
...
...
@@ -28,6 +28,9 @@ func main() {
flag
.
StringVar
(
&
config
.
ModelConfig
.
NemoCTC
.
Model
,
"nemo-ctc"
,
""
,
"Path to the NeMo 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"
)
flag
.
StringVar
(
&
config
.
ModelConfig
.
Whisper
.
Encoder
,
"whisper-encoder"
,
""
,
"Path to the whisper encoder model"
)
flag
.
StringVar
(
&
config
.
ModelConfig
.
Whisper
.
Decoder
,
"whisper-decoder"
,
""
,
"Path to the whisper decoder model"
)
flag
.
StringVar
(
&
config
.
ModelConfig
.
Whisper
.
Language
,
"whisper-language"
,
""
,
"Language of the input wave. You can leave it empty "
)
...
...
go-api-examples/non-streaming-decode-files/run-fire-red-asr.sh
0 → 100755
查看文件 @
87a968b
#!/usr/bin/env bash
set
-ex
if
[
! -f ./sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/encoder.int8.onnx
]
;
then
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2
tar xvf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2
rm sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2
ls -lh sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16
fi
go mod tidy
go build
./non-streaming-decode-files
\
--fire-red-asr-encoder
=
./sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/encoder.int8.onnx
\
--fire-red-asr-decoder
=
./sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/decoder.int8.onnx
\
--tokens
=
./sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/tokens.txt
\
./sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/test_wavs/0.wav
...
...
scripts/go/_internal/non-streaming-decode-files/run-fire-red-asr.sh
0 → 120000
查看文件 @
87a968b
../../../../go-api-examples/non-streaming-decode-files/run-fire-red-asr.sh
\ No newline at end of file
...
...
scripts/go/sherpa_onnx.go
查看文件 @
87a968b
...
...
@@ -385,6 +385,11 @@ type OfflineWhisperModelConfig struct {
TailPaddings
int
}
type
OfflineFireRedAsrModelConfig
struct
{
Encoder
string
Decoder
string
}
type
OfflineMoonshineModelConfig
struct
{
Preprocessor
string
Encoder
string
...
...
@@ -416,6 +421,7 @@ type OfflineModelConfig struct {
Tdnn
OfflineTdnnModelConfig
SenseVoice
OfflineSenseVoiceModelConfig
Moonshine
OfflineMoonshineModelConfig
FireRedAsr
OfflineFireRedAsrModelConfig
Tokens
string
// Path to tokens.txt
// Number of threads to use for neural network computation
...
...
@@ -538,6 +544,12 @@ func NewOfflineRecognizer(config *OfflineRecognizerConfig) *OfflineRecognizer {
c
.
model_config
.
moonshine
.
cached_decoder
=
C
.
CString
(
config
.
ModelConfig
.
Moonshine
.
CachedDecoder
)
defer
C
.
free
(
unsafe
.
Pointer
(
c
.
model_config
.
moonshine
.
cached_decoder
))
c
.
model_config
.
fire_red_asr
.
encoder
=
C
.
CString
(
config
.
ModelConfig
.
FireRedAsr
.
Encoder
)
defer
C
.
free
(
unsafe
.
Pointer
(
c
.
model_config
.
fire_red_asr
.
encoder
))
c
.
model_config
.
fire_red_asr
.
decoder
=
C
.
CString
(
config
.
ModelConfig
.
FireRedAsr
.
Decoder
)
defer
C
.
free
(
unsafe
.
Pointer
(
c
.
model_config
.
fire_red_asr
.
decoder
))
c
.
model_config
.
tokens
=
C
.
CString
(
config
.
ModelConfig
.
Tokens
)
defer
C
.
free
(
unsafe
.
Pointer
(
c
.
model_config
.
tokens
))
...
...
请
注册
或
登录
后发表评论