Skip to content

Commit

Permalink
Add Windows ARM64 support (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt200-ok authored Jan 16, 2025
1 parent 23a8c3f commit 30af671
Show file tree
Hide file tree
Showing 45 changed files with 202 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ body:
- Web (WASM)
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Windows (x86_64, arm64)
- Raspberry Pi
default: 0
validations:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/c-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
make_file: ["Unix Makefiles"]
include:
- machine: rpi3-32
platform: raspberry-pi
Expand All @@ -100,14 +101,18 @@ jobs:
- machine: rpi5-64
platform: raspberry-pi
arch: cortex-a76-aarch64
- machine: pv-windows-arm64
platform: windows
arch: arm64
make_file: "MinGW Makefiles"

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Create build directory
run: cmake -B ./build
run: cmake -G "${{ matrix.make_file }}" -B ./build

- name: Build demo
run: cmake --build ./build --target leopard_demo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-32, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ jobs:
binding-framework: net8.0
test-framework: net8.0
exclude:
- os: ubuntu-latest
dotnet-version: 2.1.x
- os: ubuntu-latest
dotnet-version: 3.0.x
- os: ubuntu-latest
dotnet-version: 3.1.x
- os: ubuntu-latest
dotnet-version: 5.0.x
- os: macos-latest
dotnet-version: 2.1.x
- os: macos-latest
Expand All @@ -84,6 +92,12 @@ jobs:
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Set up .NET (8)
if: ${{ matrix.os == 'ubuntu-latest' && matrix.dotnet-version == '6.0.x' }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Build binding
run: dotnet build Leopard/Leopard.csproj --framework ${{ matrix.binding-framework }} -v n

Expand All @@ -97,7 +111,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/java-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,24 @@ jobs:
- name: Machine state after
working-directory: resources/scripts
run: bash machine-state.sh

perf-windows-arm64:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [pv-windows-arm64]
include:
- machine: pv-windows-arm64
init_performance_threshold_sec: 4.0
proc_performance_threshold_sec: 0.9

steps:
- uses: actions/checkout@v3

- name: Build
run: ./gradlew assemble

- name: Test
run: ./gradlew test --info --tests LeopardPerformanceTest -DpvTestingAccessKey="${{secrets.PV_VALID_ACCESS_KEY}}" -DnumTestIterations="20" -DinitPerformanceThresholdSec="${{matrix.init_performance_threshold_sec}}" -DprocPerformanceThresholdSec="${{matrix.proc_performance_threshold_sec}}"
2 changes: 1 addition & 1 deletion .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejs-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/nodejs-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,24 @@ jobs:
- name: Machine state after
working-directory: resources/scripts
run: bash machine-state.sh

perf-windows-arm64:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [pv-windows-arm64]
include:
- machine: pv-windows-arm64
init_performance_threshold_sec: 2.5
proc_performance_threshold_sec: 1.1

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: yarn install

- name: Test
run: yarn test test/perf.test.ts --access_key=${{secrets.PV_VALID_ACCESS_KEY}} --num_test_iterations=20 --init_performance_threshold_sec=${{matrix.init_performance_threshold_sec}} --proc_performance_threshold_sec=${{matrix.proc_performance_threshold_sec}}
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
38 changes: 9 additions & 29 deletions .github/workflows/python-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand All @@ -62,65 +62,45 @@ jobs:
run: python3 leopard_demo_file.py --access_key ${{secrets.PV_VALID_ACCESS_KEY}} --wav_paths ../../resources/audio_samples/test.wav

build-subtitle-demo:
if: false # YouTube: "Sign in to confirm you’re not a bot."
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.machine }}
defaults:
run:
working-directory: demo/python-subtitle

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10']
machine: [pv-linux, pv-windows]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Pre-build dependencies
run: python -m pip install --upgrade pip

- name: Install dependencies
run: pip install -r requirements.txt
run: python3 -m pip install -r requirements.txt

- name: Test
run: python main.py
run: python3 main.py
--access_key ${{secrets.PV_VALID_ACCESS_KEY}}
--youtube_url https://www.youtube.com/watch?v=b7wzFEDU0U8
--subtitle_path test.txt

build-youtube-demo:
if: false # YouTube: "Sign in to confirm you’re not a bot."
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.machine }}
defaults:
run:
working-directory: demo/python-youtube

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10']
machine: [pv-linux, pv-windows]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Pre-build dependencies
run: python -m pip install --upgrade pip

- name: Install dependencies
run: pip install -r requirements.txt
run: python3 -m pip install -r requirements.txt

- name: Test
run: python main.py
run: python3 main.py
--access_key ${{secrets.PV_VALID_ACCESS_KEY}}
--url https://www.youtube.com/watch?v=b7wzFEDU0U8
--transcript_path test.txt
21 changes: 21 additions & 0 deletions .github/workflows/python-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,24 @@ jobs:
- name: Machine state after
working-directory: resources/scripts
run: bash machine-state.sh

perf-windows-arm64:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [pv-windows-arm64]
include:
- machine: pv-windows-arm64
init_performance_threshold_sec: 3.5
proc_performance_threshold_sec: 0.7

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: pip install -r requirements.txt

- name: Test
run: python3 test_leopard_perf.py ${{secrets.PV_VALID_ACCESS_KEY}} 20 ${{matrix.init_performance_threshold_sec}} ${{matrix.proc_performance_threshold_sec}}
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Leopard is an on-device speech-to-text engine. Leopard is:
- [Accurate](https://picovoice.ai/docs/benchmark/stt/)
- [Compact and Computationally-Efficient](https://github.com/Picovoice/speech-to-text-benchmark#rtf)
- Cross-Platform:
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64)
- Android and iOS
- Chrome, Safari, Firefox, and Edge
- Raspberry Pi (3, 4, 5)
Expand Down
56 changes: 29 additions & 27 deletions binding/dotnet/Leopard/Leopard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;netcoreapp3.0;netstandard2.0</TargetFrameworks>
<Version>2.0.3</Version>
<Version>2.0.4</Version>
<Authors>Picovoice</Authors>
<Company/>
<Product>Leopard Speech-to-Text Engine</Product>
Expand All @@ -19,7 +19,7 @@
- Private; All voice processing runs locally.
- Accurate
- Compact and Computationally-Efficient
- Cross-Platform: Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), and Raspberry Pi (3, 4, 5)
- Cross-Platform: Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5)
</Description>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageIcon>pv_circle_512.png</PackageIcon>
Expand Down Expand Up @@ -56,17 +56,6 @@
<Link>lib\windows\amd64\libpv_leopard.dll</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\linux\x86_64\libpv_leopard.so">
<PackagePath>
build/netstandard2.0/libpv_leopard.so;
build/netcoreapp3.0/lib/linux/x86_64/libpv_leopard.so;
build/net6.0/lib/linux/x86_64/libpv_leopard.so;
build/net8.0/lib/linux/x86_64/libpv_leopard.so;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\linux\x86_64\libpv_leopard.so</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\mac\x86_64\libpv_leopard.dylib">
<PackagePath>
build/netstandard2.0/libpv_leopard.dylib;
Expand All @@ -80,20 +69,6 @@
</Content>
</ItemGroup>

<!--.NET Core 3.0+ libs-->
<ItemGroup>
<Content Include="..\..\..\lib\raspberry-pi\**\*">
<PackagePath>
build/netcoreapp3.0/lib/raspberry-pi;
build/net6.0/lib/raspberry-pi;
build/net8.0/lib/raspberry-pi;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\raspberry-pi\%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>

<!--.NET Core 6.0+ libs-->
<ItemGroup>
<Content Include="..\..\..\lib\mac\arm64\libpv_leopard.dylib">
Expand All @@ -105,6 +80,33 @@
<Link>lib\mac\arm64\libpv_leopard.dylib</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\windows\arm64\libpv_leopard.dll">
<PackagePath>
build/net6.0/lib/windows/arm64/libpv_leopard.dll;
build/net8.0/lib/windows/arm64/libpv_leopard.dll;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\windows\arm64\libpv_leopard.dll</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\linux\x86_64\libpv_leopard.so">
<PackagePath>
build/net6.0/lib/linux/x86_64/libpv_leopard.so;
build/net8.0/lib/linux/x86_64/libpv_leopard.so;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\linux\x86_64\libpv_leopard.so</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\raspberry-pi\**\*">
<PackagePath>
build/net6.0/lib/raspberry-pi;
build/net8.0/lib/raspberry-pi;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\raspberry-pi\%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>

<!--Resources-->
Expand Down
4 changes: 4 additions & 0 deletions binding/dotnet/Leopard/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public static string PvLibraryPath(string libName)
{
return Path.Combine(AppContext.BaseDirectory, $"lib/{_env}/amd64/{libName}.dll");
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && _arch == Architecture.Arm64)
{
return Path.Combine(AppContext.BaseDirectory, $"lib/{_env}/arm64/{libName}.dll");
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && _arch == Architecture.X64)
{
return Path.Combine(AppContext.BaseDirectory, $"lib/{_env}/x86_64/{libName}.dylib");
Expand Down
Loading

0 comments on commit 30af671

Please sign in to comment.