Fix building for .Net (#463)
This commit is contained in:
123
.github/workflows/dot-net.yaml
vendored
123
.github/workflows/dot-net.yaml
vendored
@@ -1,130 +1,45 @@
|
|||||||
name: dot-net
|
name: release-nuget-package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dot-net
|
|
||||||
- fix-dot-net
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: dot-net-${{ github.ref }}
|
group: release-nuget-package
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-libs:
|
release-nuget-package:
|
||||||
name: dot-net for ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
|
|
||||||
# for a list of versions
|
|
||||||
- name: Build wheels
|
|
||||||
uses: pypa/cibuildwheel@v2.11.4
|
|
||||||
env:
|
|
||||||
CIBW_BEFORE_BUILD: "pip install -U cmake numpy"
|
|
||||||
CIBW_BUILD: "cp38-*64"
|
|
||||||
CIBW_SKIP: "cp27-* cp35-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686"
|
|
||||||
CIBW_BUILD_VERBOSITY: 3
|
|
||||||
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH='/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib'
|
|
||||||
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
|
|
||||||
|
|
||||||
- name: Display wheels
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
ls -lh ./wheelhouse/*.whl
|
|
||||||
unzip -l ./wheelhouse/*.whl
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.os }}-wheels
|
fetch-depth: 0
|
||||||
path: ./wheelhouse/*.whl
|
|
||||||
|
|
||||||
build-nuget-packages:
|
- name: Setup .NET
|
||||||
name: build-nuget-packages
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build-libs
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Retrieve artifact from ubuntu-latest
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ubuntu-latest-wheels
|
|
||||||
path: ./linux
|
|
||||||
|
|
||||||
- name: Retrieve artifact from macos-latest
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: macos-latest-wheels
|
|
||||||
path: ./macos
|
|
||||||
|
|
||||||
- name: Retrieve artifact from windows-latest
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: windows-latest-wheels
|
|
||||||
path: ./windows
|
|
||||||
|
|
||||||
- name: Display wheels
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
tree .
|
|
||||||
|
|
||||||
- name: Unzip Ubuntu wheels
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cd linux
|
|
||||||
unzip ./*.whl
|
|
||||||
tree .
|
|
||||||
|
|
||||||
- name: Unzip macOS wheels
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cd macos
|
|
||||||
unzip ./*.whl
|
|
||||||
tree .
|
|
||||||
|
|
||||||
- name: Unzip Windows wheels
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cd windows
|
|
||||||
unzip ./*.whl
|
|
||||||
tree .
|
|
||||||
|
|
||||||
- name: Setup .NET Core 3.1
|
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: 3.1.x
|
dotnet-version: |
|
||||||
|
6.0.x
|
||||||
- name: Setup .NET 7.0
|
7.0.x
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
|
||||||
dotnet-version: 7.0.x
|
|
||||||
|
|
||||||
- name: Check dotnet
|
- name: Check dotnet
|
||||||
run: dotnet --info
|
run: dotnet --info
|
||||||
|
|
||||||
- name: build nuget packages
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd scripts/dotnet
|
cd scripts/dotnet
|
||||||
./run.sh
|
./run.sh
|
||||||
ls -lh packages
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
ls -lh /tmp/packages
|
||||||
name: upload nuget packages
|
|
||||||
with:
|
|
||||||
name: nuget-packages
|
|
||||||
path: scripts/dotnet/packages/*.nupkg
|
|
||||||
|
|
||||||
- name: publish .Net packages to nuget.org
|
- name: publish .Net packages to nuget.org
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
||||||
@@ -133,13 +48,5 @@ jobs:
|
|||||||
API_KEY: ${{ secrets.NUGET_API_KEY }}
|
API_KEY: ${{ secrets.NUGET_API_KEY }}
|
||||||
run: |
|
run: |
|
||||||
# API_KEY is valid until 2024.05.02
|
# API_KEY is valid until 2024.05.02
|
||||||
cd scripts/dotnet/packages
|
cd /tmp/packages
|
||||||
dotnet nuget push ./org.k2fsa.sherpa.onnx.*.nupkg --skip-duplicate --api-key $API_KEY --source https://api.nuget.org/v3/index.json
|
dotnet nuget push ./org.k2fsa.sherpa.onnx.*.nupkg --skip-duplicate --api-key $API_KEY --source https://api.nuget.org/v3/index.json
|
||||||
|
|
||||||
- name: Release nuget packages
|
|
||||||
if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
|
||||||
uses: svenstaro/upload-release-action@v2
|
|
||||||
with:
|
|
||||||
file_glob: true
|
|
||||||
overwrite: true
|
|
||||||
file: scripts/dotnet/packages/*.nupkg
|
|
||||||
|
|||||||
57
.github/workflows/test-dot-net-nuget.yaml
vendored
Normal file
57
.github/workflows/test-dot-net-nuget.yaml
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
name: test-dot-net-nuget
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
schedule:
|
||||||
|
# minute (0-59)
|
||||||
|
# hour (0-23)
|
||||||
|
# day of the month (1-31)
|
||||||
|
# month (1-12)
|
||||||
|
# day of the week (0-6)
|
||||||
|
# nightly build at 23:50 UTC time every day
|
||||||
|
- cron: "50 23 * * *"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: test-dot-net-nuget
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-dot-net-nuget:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup .NET 6.0
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: 6.0.x
|
||||||
|
|
||||||
|
- name: Check dotnet
|
||||||
|
run: dotnet --info
|
||||||
|
|
||||||
|
- name: Decode a file
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd dotnet-examples/
|
||||||
|
|
||||||
|
cd online-decode-files
|
||||||
|
./run-transducer.sh
|
||||||
|
./run-paraformer.sh
|
||||||
|
|
||||||
|
cd ../offline-decode-files
|
||||||
|
./run-nemo-ctc.sh
|
||||||
|
./run-paraformer.sh
|
||||||
|
./run-zipformer.sh
|
||||||
|
./run-whisper.sh
|
||||||
|
./run-tdnn-yesno.sh
|
||||||
122
.github/workflows/test-dot-net.yaml
vendored
122
.github/workflows/test-dot-net.yaml
vendored
@@ -4,28 +4,13 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
|
||||||
- '.github/workflows/test-dot-net'
|
|
||||||
- 'dotnet-examples/**'
|
|
||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
|
||||||
- '.github/workflows/test-dot-net'
|
|
||||||
- 'dotnet-examples/**'
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
schedule:
|
|
||||||
# minute (0-59)
|
|
||||||
# hour (0-23)
|
|
||||||
# day of the month (1-31)
|
|
||||||
# month (1-12)
|
|
||||||
# day of the week (0-6)
|
|
||||||
# nightly build at 23:50 UTC time every day
|
|
||||||
- cron: "50 23 * * *"
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: test-dot-net
|
group: test-dot-net
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -34,31 +19,124 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-dot-net:
|
build-libs:
|
||||||
|
name: ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
python-version: ["3.8"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup .NET Core 3.1
|
- name: ccache
|
||||||
uses: actions/setup-dotnet@v1
|
uses: hendrikmuhs/ccache-action@v1.2
|
||||||
with:
|
with:
|
||||||
dotnet-version: 3.1.x
|
key: ${{ matrix.os }}-release-shared
|
||||||
|
|
||||||
- name: Setup .NET 6.0
|
- name: Build sherpa-onnx
|
||||||
uses: actions/setup-dotnet@v1
|
shell: bash
|
||||||
|
run: |
|
||||||
|
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||||
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
||||||
|
cmake --version
|
||||||
|
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
cmake --build . --target install --config Release
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: 6.0.x
|
name: ${{ matrix.os }}
|
||||||
|
path: ./build/install/lib/
|
||||||
|
|
||||||
|
test-dot-net:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
needs: [build-libs]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
python-version: ["3.8"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install Python dependencies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
python3 -m pip install --upgrade pip Jinja2
|
||||||
|
|
||||||
|
- name: Retrieve artifact from ubuntu-latest
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ubuntu-latest
|
||||||
|
path: /tmp/linux
|
||||||
|
|
||||||
|
- name: Retrieve artifact from macos-latest
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: macos-latest
|
||||||
|
path: /tmp/macos
|
||||||
|
|
||||||
|
- name: Retrieve artifact from windows-latest
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: windows-latest
|
||||||
|
path: /tmp/windows
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v3
|
||||||
|
with:
|
||||||
|
dotnet-version: |
|
||||||
|
6.0.x
|
||||||
|
7.0.x
|
||||||
|
|
||||||
- name: Check dotnet
|
- name: Check dotnet
|
||||||
run: dotnet --info
|
run: dotnet --info
|
||||||
|
|
||||||
|
- name: Display files
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "----------/tmp/----------"
|
||||||
|
ls -lh /tmp/
|
||||||
|
|
||||||
|
echo "----------/tmp/linux----------"
|
||||||
|
ls -lh /tmp/linux
|
||||||
|
|
||||||
|
echo "----------/tmp/macos----------"
|
||||||
|
ls -lh /tmp/macos
|
||||||
|
|
||||||
|
echo "----------/tmp/windows----------"
|
||||||
|
ls -lh /tmp/windows
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd scripts/dotnet
|
||||||
|
./run.sh
|
||||||
|
|
||||||
|
- name: Copy files
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cp -v scripts/dotnet/examples/offline-decode-files.csproj dotnet-examples/offline-decode-files/
|
||||||
|
cp -v scripts/dotnet/examples/online-decode-files.csproj dotnet-examples/online-decode-files/
|
||||||
|
cp -v scripts/dotnet/examples/speech-recognition-from-microphone.csproj dotnet-examples/speech-recognition-from-microphone/
|
||||||
|
|
||||||
|
ls -lh /tmp
|
||||||
|
|
||||||
- name: Decode a file
|
- name: Decode a file
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
3
scripts/dotnet/examples/README.md
Normal file
3
scripts/dotnet/examples/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Introduction
|
||||||
|
|
||||||
|
Files in this directory are used exclusively by CI.
|
||||||
20
scripts/dotnet/examples/offline-decode-files.csproj
Normal file
20
scripts/dotnet/examples/offline-decode-files.csproj
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<RootNamespace>offline_decode_files</RootNamespace>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||||
|
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
21
scripts/dotnet/examples/online-decode-files.csproj
Normal file
21
scripts/dotnet/examples/online-decode-files.csproj
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<RootNamespace>online_decode_files</RootNamespace>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||||
|
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<RootNamespace>speech_recognition_from_microphone</RootNamespace>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||||
|
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" />
|
||||||
|
<PackageReference Include="PortAudioSharp2" Version="*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -33,12 +33,18 @@ def get_dict():
|
|||||||
|
|
||||||
def process_linux(s):
|
def process_linux(s):
|
||||||
libs = [
|
libs = [
|
||||||
|
"libespeak-ng.so",
|
||||||
|
"libkaldi-decoder-core.so",
|
||||||
"libkaldi-native-fbank-core.so",
|
"libkaldi-native-fbank-core.so",
|
||||||
"libonnxruntime.so.1.16.2",
|
"libonnxruntime.so.1.16.3",
|
||||||
|
"libpiper_phonemize.so.1",
|
||||||
"libsherpa-onnx-c-api.so",
|
"libsherpa-onnx-c-api.so",
|
||||||
"libsherpa-onnx-core.so",
|
"libsherpa-onnx-core.so",
|
||||||
|
"libsherpa-onnx-fst.so.6",
|
||||||
|
"libsherpa-onnx-kaldifst-core.so",
|
||||||
|
"libucd.so",
|
||||||
]
|
]
|
||||||
prefix = f"{SHERPA_ONNX_DIR}/linux/sherpa_onnx/lib/"
|
prefix = "/tmp/linux/"
|
||||||
libs = [prefix + lib for lib in libs]
|
libs = [prefix + lib for lib in libs]
|
||||||
libs = "\n ;".join(libs)
|
libs = "\n ;".join(libs)
|
||||||
|
|
||||||
@@ -55,12 +61,18 @@ def process_linux(s):
|
|||||||
|
|
||||||
def process_macos(s):
|
def process_macos(s):
|
||||||
libs = [
|
libs = [
|
||||||
|
"libespeak-ng.dylib",
|
||||||
|
"libkaldi-decoder-core.dylib",
|
||||||
"libkaldi-native-fbank-core.dylib",
|
"libkaldi-native-fbank-core.dylib",
|
||||||
"libonnxruntime.1.16.2.dylib",
|
"libonnxruntime.1.16.3.dylib",
|
||||||
|
"libpiper_phonemize.1.dylib",
|
||||||
"libsherpa-onnx-c-api.dylib",
|
"libsherpa-onnx-c-api.dylib",
|
||||||
"libsherpa-onnx-core.dylib",
|
"libsherpa-onnx-core.dylib",
|
||||||
|
"libsherpa-onnx-fst.6.dylib",
|
||||||
|
"libsherpa-onnx-kaldifst-core.dylib",
|
||||||
|
"libucd.dylib",
|
||||||
]
|
]
|
||||||
prefix = f"{SHERPA_ONNX_DIR}/macos/sherpa_onnx/lib/"
|
prefix = f"/tmp/macos/"
|
||||||
libs = [prefix + lib for lib in libs]
|
libs = [prefix + lib for lib in libs]
|
||||||
libs = "\n ;".join(libs)
|
libs = "\n ;".join(libs)
|
||||||
|
|
||||||
@@ -77,30 +89,23 @@ def process_macos(s):
|
|||||||
|
|
||||||
def process_windows(s):
|
def process_windows(s):
|
||||||
libs = [
|
libs = [
|
||||||
|
"espeak-ng.dll",
|
||||||
|
"kaldi-decoder-core.dll",
|
||||||
"kaldi-native-fbank-core.dll",
|
"kaldi-native-fbank-core.dll",
|
||||||
"onnxruntime.dll",
|
"onnxruntime.dll",
|
||||||
|
"piper_phonemize.dll",
|
||||||
"sherpa-onnx-c-api.dll",
|
"sherpa-onnx-c-api.dll",
|
||||||
"sherpa-onnx-core.dll",
|
"sherpa-onnx-core.dll",
|
||||||
|
"sherpa-onnx-fst.lib",
|
||||||
|
"sherpa-onnx-kaldifst-core.lib",
|
||||||
|
"ucd.dll",
|
||||||
]
|
]
|
||||||
|
|
||||||
version = get_version()
|
version = get_version()
|
||||||
|
|
||||||
prefix1 = f"{SHERPA_ONNX_DIR}/windows/sherpa_onnx/lib/"
|
prefix = "/tmp/windows/"
|
||||||
prefix2 = f"{SHERPA_ONNX_DIR}/windows/sherpa_onnx/"
|
libs = [prefix + lib for lib in libs]
|
||||||
prefix3 = f"{SHERPA_ONNX_DIR}/windows/"
|
libs = "\n ;".join(libs)
|
||||||
prefix4 = f"{SHERPA_ONNX_DIR}/windows/sherpa_onnx-{version}.data/data/bin/"
|
|
||||||
print(prefix1, prefix2, prefix3, prefix4)
|
|
||||||
|
|
||||||
lib_list = []
|
|
||||||
for lib in libs:
|
|
||||||
for prefix in [prefix1, prefix2, prefix3, prefix4]:
|
|
||||||
f = Path(prefix) / lib
|
|
||||||
if f.is_file():
|
|
||||||
lib_list.append(str(f))
|
|
||||||
break
|
|
||||||
|
|
||||||
print("lib_list", lib_list)
|
|
||||||
libs = "\n ;".join(lib_list)
|
|
||||||
|
|
||||||
d = get_dict()
|
d = get_dict()
|
||||||
d["dotnet_rid"] = "win-x64"
|
d["dotnet_rid"] = "win-x64"
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ namespace SherpaOnnx
|
|||||||
|
|
||||||
DecodingMethod = "greedy_search";
|
DecodingMethod = "greedy_search";
|
||||||
MaxActivePaths = 4;
|
MaxActivePaths = 4;
|
||||||
|
HotwordsFile = "";
|
||||||
|
HotwordsScore = 1.5F;
|
||||||
|
|
||||||
}
|
}
|
||||||
public FeatureConfig FeatConfig;
|
public FeatureConfig FeatConfig;
|
||||||
@@ -148,6 +150,11 @@ namespace SherpaOnnx
|
|||||||
public string DecodingMethod;
|
public string DecodingMethod;
|
||||||
|
|
||||||
public int MaxActivePaths;
|
public int MaxActivePaths;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.LPStr)]
|
||||||
|
public string HotwordsFile;
|
||||||
|
|
||||||
|
public float HotwordsScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OfflineRecognizerResult
|
public class OfflineRecognizerResult
|
||||||
|
|||||||
@@ -3,6 +3,75 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
SHERPA_ONNX_DIR=$(cd $SCRIPT_DIR/../.. && pwd)
|
||||||
|
echo "SCRIPT_DIR: $SCRIPT_DIR"
|
||||||
|
echo "SHERPA_ONNX_DIR: $SHERPA_ONNX_DIR"
|
||||||
|
|
||||||
|
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" $SHERPA_ONNX_DIR/CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
|
|
||||||
|
mkdir -p /tmp/
|
||||||
|
pushd /tmp
|
||||||
|
|
||||||
|
mkdir -p linux macos windows
|
||||||
|
|
||||||
|
if [ ! -f /tmp/linux/libsherpa-onnx-core.so ]; then
|
||||||
|
echo "---linux x86_64---"
|
||||||
|
cd linux
|
||||||
|
mkdir wheel
|
||||||
|
cd wheel
|
||||||
|
curl -OL https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
||||||
|
unzip sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
||||||
|
cp -v sherpa_onnx/lib/*.so* ../
|
||||||
|
cd ..
|
||||||
|
rm -v libpiper_phonemize.so libpiper_phonemize.so.1.2.0
|
||||||
|
rm -v libsherpa-onnx-fst.so
|
||||||
|
rm -v libonnxruntime.so
|
||||||
|
rm -v libcargs.so
|
||||||
|
rm -rf wheel
|
||||||
|
ls -lh
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f /tmp/macos/libsherpa-onnx-core.dylib ]; then
|
||||||
|
echo "---macOS x86_64---"
|
||||||
|
cd macos
|
||||||
|
mkdir wheel
|
||||||
|
cd wheel
|
||||||
|
curl -OL https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_10_14_x86_64.whl
|
||||||
|
unzip sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-macosx_10_14_x86_64.whl
|
||||||
|
cp -v sherpa_onnx/lib/*.dylib ../
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rm -v libcargs.dylib
|
||||||
|
rm -v libonnxruntime.dylib
|
||||||
|
rm -v libpiper_phonemize.1.2.0.dylib libpiper_phonemize.dylib
|
||||||
|
rm -v libsherpa-onnx-fst.dylib
|
||||||
|
rm -rf wheel
|
||||||
|
ls -lh
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -f /tmp/windows/libsherpa-onnx-core.dll ]; then
|
||||||
|
echo "---windows x64---"
|
||||||
|
cd windows
|
||||||
|
mkdir wheel
|
||||||
|
cd wheel
|
||||||
|
curl -OL https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win_amd64.whl
|
||||||
|
unzip sherpa_onnx-${SHERPA_ONNX_VERSION}-cp38-cp38-win_amd64.whl
|
||||||
|
cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.dll ../
|
||||||
|
cp -v sherpa_onnx-${SHERPA_ONNX_VERSION}.data/data/bin/*.lib ../
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rm -rf wheel
|
||||||
|
ls -lh
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
mkdir -p macos linux windows all
|
mkdir -p macos linux windows all
|
||||||
|
|
||||||
cp ./online.cs all
|
cp ./online.cs all
|
||||||
@@ -31,3 +100,6 @@ dotnet pack -c Release -o ../packages
|
|||||||
popd
|
popd
|
||||||
|
|
||||||
ls -lh packages
|
ls -lh packages
|
||||||
|
|
||||||
|
mkdir /tmp/packages
|
||||||
|
cp -v packages/*.nupkg /tmp/packages
|
||||||
|
|||||||
Reference in New Issue
Block a user