-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add C# API for FireRedAsr Model (#1875)
- Loading branch information
1 parent
7ad44bc
commit d95d431
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/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 | ||
|
||
dotnet run \ | ||
--num-threads=2 \ | ||
--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 \ | ||
--files ./sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/test_wavs/0.wav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// Copyright (c) 2025 Xiaomi Corporation (authors: Fangjun Kuang) | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
namespace SherpaOnnx | ||
{ | ||
[StructLayout(LayoutKind.Sequential)] | ||
public struct OfflineFireRedAsrModelConfig | ||
{ | ||
public OfflineFireRedAsrModelConfig() | ||
{ | ||
Encoder = ""; | ||
Decoder = ""; | ||
} | ||
[MarshalAs(UnmanagedType.LPStr)] | ||
public string Encoder; | ||
|
||
[MarshalAs(UnmanagedType.LPStr)] | ||
public string Decoder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters