-
Notifications
You must be signed in to change notification settings - Fork 477
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 Moonshine models. (#1483)
* Also, return timestamps for non-streaming ASR.
- Loading branch information
1 parent
cdd8e1b
commit 3622104
Showing
6 changed files
with
143 additions
and
8 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,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
if [ ! -f ./sherpa-onnx-moonshine-tiny-en-int8/tokens.txt ]; then | ||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 | ||
tar xvf sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 | ||
rm sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 | ||
fi | ||
|
||
dotnet run \ | ||
--num-threads=2 \ | ||
--moonshine-preprocessor=./sherpa-onnx-moonshine-tiny-en-int8/preprocess.onnx \ | ||
--moonshine-encoder=./sherpa-onnx-moonshine-tiny-en-int8/encode.int8.onnx \ | ||
--moonshine-uncached-decoder=./sherpa-onnx-moonshine-tiny-en-int8/uncached_decode.int8.onnx \ | ||
--moonshine-cached-decoder=./sherpa-onnx-moonshine-tiny-en-int8/cached_decode.int8.onnx \ | ||
--tokens=./sherpa-onnx-moonshine-tiny-en-int8/tokens.txt \ | ||
--files ./sherpa-onnx-moonshine-tiny-en-int8/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
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,29 @@ | ||
/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
namespace SherpaOnnx | ||
{ | ||
[StructLayout(LayoutKind.Sequential)] | ||
public struct OfflineMoonshineModelConfig | ||
{ | ||
public OfflineMoonshineModelConfig() | ||
{ | ||
Preprocessor = ""; | ||
Encoder = ""; | ||
UncachedDecoder = ""; | ||
CachedDecoder = ""; | ||
} | ||
[MarshalAs(UnmanagedType.LPStr)] | ||
public string Preprocessor; | ||
|
||
[MarshalAs(UnmanagedType.LPStr)] | ||
public string Encoder; | ||
|
||
[MarshalAs(UnmanagedType.LPStr)] | ||
public string UncachedDecoder; | ||
|
||
[MarshalAs(UnmanagedType.LPStr)] | ||
public string CachedDecoder; | ||
} | ||
} |
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