Skip to content

Commit

Permalink
Added Windows ARM64 support (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt200-ok authored Jan 14, 2025
1 parent 4d934a7 commit 77d9ae7
Show file tree
Hide file tree
Showing 26 changed files with 50 additions and 36 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 @@ -55,7 +55,7 @@ body:
- macOS (arm64, x86_64)
- Raspberry Pi
- Web (WASM)
- Windows (x86_64)
- Windows (x86_64, arm64)
validations:
required: true
- type: input
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/c-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,22 @@ jobs:
- xpu: gpu
machine: pv-windows-igpu
make_file: "MinGW Makefiles"
- xpu: cpu
machine: pv-windows-arm64
make_file: "MinGW Makefiles"

steps:
- uses: actions/checkout@v3

- name: Setup Python virtualenv (*nix)
if: ${{ matrix.machine != 'pv-windows' && matrix.machine != 'pv-windows-igpu' }}
if: ${{ matrix.machine != 'pv-windows' && matrix.machine != 'pv-windows-igpu' && matrix.machine != 'pv-windows-arm64' }}
run: |
python3 -m venv binding/python/.venv
. binding/python/.venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Setup Python virtualenv (windows)
if: ${{ matrix.machine == 'pv-windows' || matrix.machine == 'pv-windows-igpu' }}
if: ${{ matrix.machine == 'pv-windows' || matrix.machine == 'pv-windows-igpu' || matrix.machine == 'pv-windows-arm64' }}
run: |
python3 -m venv binding\python\.venv --symlinks
binding\python\.venv\Scripts\activate
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 @@ -30,7 +30,7 @@ jobs:
fail-fast: false
matrix:
xpu: [ cpu ]
machine: [ rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows ]
machine: [ rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows, pv-windows-arm64 ]
include:
- xpu: gpu
machine: pv-linux
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
fail-fast: false
matrix:
xpu: [ "cpu" ]
machine: [ rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows ]
machine: [ rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows, pv-windows-arm64 ]
include:
- xpu: gpu
machine: pv-linux
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/python-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fail-fast: false
matrix:
xpu: [ cpu ]
machine: [ rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows ]
machine: [ rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows, pv-windows-arm64 ]
include:
- xpu: gpu
machine: pv-linux
Expand All @@ -39,21 +39,21 @@ jobs:
- uses: actions/checkout@v3

- name: Setup Python virtualenv (*nix)
if: ${{ matrix.machine != 'pv-windows' && matrix.machine != 'pv-windows-igpu' }}
if: ${{ matrix.machine != 'pv-windows' && matrix.machine != 'pv-windows-igpu' && matrix.machine != 'pv-windows-arm64' }}
run: |
python3 -m venv .venv
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Setup Python virtualenv (windows)
if: ${{ matrix.machine == 'pv-windows' || matrix.machine == 'pv-windows-igpu' }}
if: ${{ matrix.machine == 'pv-windows' || matrix.machine == 'pv-windows-igpu' || matrix.machine == 'pv-windows-arm64' }}
run: |
python3 -m venv .venv --symlinks
.venv\Scripts\activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Install Python dependencies
run: python3 -m pip install -r requirements.txt
run: python3 -m pip install -r requirements.txt --force-reinstall

- name: Download resource files
run: curl http://${{secrets.PV_CICD_RES_SERVER_AUTHORITY}}/github/picollm/res/phi2-290.pllm/04-d5f2aa0/phi2-290.pllm -o phi2-290.pllm
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
fail-fast: false
matrix:
xpu: [ "cpu" ]
machine: [ rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows ]
machine: [ rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-linux, pv-ios, pv-windows, pv-windows-arm64 ]
include:
- xpu: gpu
machine: pv-linux
Expand All @@ -47,14 +47,14 @@ jobs:
- uses: actions/checkout@v3

- name: Setup Python virtualenv (*nix)
if: ${{ matrix.machine != 'pv-windows' && matrix.machine != 'pv-windows-igpu' }}
if: ${{ matrix.machine != 'pv-windows' && matrix.machine != 'pv-windows-igpu' && matrix.machine != 'pv-windows-arm64' }}
run: |
python3 -m venv binding/python/.venv
. binding/python/.venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Setup Python virtualenv (windows)
if: ${{ matrix.machine == 'pv-windows' || matrix.machine == 'pv-windows-igpu' }}
if: ${{ matrix.machine == 'pv-windows' || matrix.machine == 'pv-windows-igpu' || matrix.machine == 'pv-windows-arm64' }}
run: |
python3 -m venv binding\python\.venv --symlinks
binding\python\.venv\Scripts\activate
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ models. picoLLM Inference Engine is:
- Accurate; picoLLM Compression improves GPTQ by [significant margins](https://picovoice.ai/blog/picollm-towards-optimal-llm-quantization/)
- Private; LLM inference runs 100% locally.
- Cross-Platform
- Linux (x86_64), macOS (arm64, x86_64), and Windows (x86_64)
- Linux (x86_64), macOS (arm64, x86_64), and Windows (x86_64, arm64)
- Raspberry Pi (5 and 4)
- Android and iOS
- Chrome, Safari, Edge, and Firefox
Expand Down
2 changes: 1 addition & 1 deletion binding/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ models. picoLLM Inference Engine is:
## Compatibility

- Node.js 16+
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64), and Raspberry Pi (5 and 4).
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64, arm64), and Raspberry Pi (5 and 4).

## Installation

Expand Down
2 changes: 1 addition & 1 deletion binding/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@picovoice/picollm-node",
"version": "1.2.3",
"version": "1.2.4",
"description": "Picovoice picoLLM Node.js binding",
"main": "dist/index.js",
"types": "dist/types/index.d.ts",
Expand Down
10 changes: 7 additions & 3 deletions binding/nodejs/src/platforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ SYSTEM_TO_LIBRARY_PATH.set(
`${SYSTEM_WINDOWS}/${X86_64}`,
`${PLATFORM_WINDOWS}/amd64/pv_picollm.node`
);
SYSTEM_TO_LIBRARY_PATH.set(
`${SYSTEM_WINDOWS}/${ARM_64}`,
`${PLATFORM_WINDOWS}/arm64/pv_picollm.node`
);

function absoluteLibraryPath(libraryPath: string): string {
return path.resolve(__dirname, LIBRARY_PATH_PREFIX, libraryPath);
Expand Down Expand Up @@ -125,7 +129,7 @@ export function getPlatform(): string {
return PLATFORM_MAC;
}

if (system === SYSTEM_WINDOWS && arch === X86_64) {
if (system === SYSTEM_WINDOWS && (arch === X86_64 || arch === ARM_64)) {
return PLATFORM_WINDOWS;
}

Expand Down Expand Up @@ -176,9 +180,9 @@ export function getSystemLibraryPath(): string {
break;
}
case SYSTEM_WINDOWS: {
if (arch === X86_64) {
if (arch === X86_64 || arch === ARM_64) {
return absoluteLibraryPath(
SYSTEM_TO_LIBRARY_PATH.get(`${SYSTEM_WINDOWS}/${X86_64}`)
SYSTEM_TO_LIBRARY_PATH.get(`${SYSTEM_WINDOWS}/${arch}`)
);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion binding/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ models. picoLLM Inference Engine is:
## Compatibility

- Python 3.8+
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64), and Raspberry Pi (5 and 4).
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64, arm64), and Raspberry Pi (5 and 4).

## Installation

Expand Down
6 changes: 4 additions & 2 deletions binding/python/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def pv_library_path(relative: str) -> str:
relative,
'lib/raspberry-pi/%s/libpv_picollm.so' % _PV_MACHINE)
elif _PV_SYSTEM == 'Windows':
library_file = os.path.join(os.path.dirname(__file__), relative, 'lib/windows/amd64/libpv_picollm.dll')
return library_file
if _PV_MACHINE.lower() == 'amd64':
return os.path.join(os.path.dirname(__file__), relative, 'lib/windows/amd64/libpv_picollm.dll')
elif _PV_MACHINE.lower() == 'arm64':
return os.path.join(os.path.dirname(__file__), relative, 'lib/windows/arm64/libpv_picollm.dll')

raise NotImplementedError('Unsupported platform.')

Expand Down
3 changes: 2 additions & 1 deletion binding/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
include picollm/lib/mac/x86_64/*.dylib
include picollm/lib/raspberry-pi/**/*.so
include picollm/lib/windows/amd64/*.dll
include picollm/lib/windows/arm64/*.dll
"""

with open(os.path.join(os.path.dirname(__file__), 'MANIFEST.in'), 'w') as f:
Expand All @@ -53,7 +54,7 @@

setuptools.setup(
name="picollm",
version="1.2.3",
version="1.2.4",
author="Picovoice",
author_email="[email protected]",
description="picoLLM Inference Engine",
Expand Down
2 changes: 1 addition & 1 deletion demo/c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Compatibility

- C99-compatible compiler
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64), and Raspberry Pi (5 and 4).
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64, arm64), and Raspberry Pi (5 and 4).

## Requirements

Expand Down
5 changes: 4 additions & 1 deletion demo/c/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ def pv_library_path(relative: str) -> str:
relative,
'lib/raspberry-pi/%s/libpv_picollm.so' % _PV_MACHINE)
elif _PV_SYSTEM == 'Windows':
library_file = os.path.join(os.path.dirname(__file__), relative, 'lib/windows/amd64/libpv_picollm.dll')
if _PV_MACHINE.lower() == 'amd64':
library_file = os.path.join(os.path.dirname(__file__), relative, 'lib/windows/amd64/libpv_picollm.dll')
elif _PV_MACHINE.lower() == 'arm64':
library_file = os.path.join(os.path.dirname(__file__), relative, 'lib/windows/arm64/libpv_picollm.dll')
os.environ["PATH"] += os.pathsep + os.path.join(os.path.dirname(library_file))
return library_file

Expand Down
2 changes: 1 addition & 1 deletion demo/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ models. picoLLM Inference Engine is:
## Compatibility

- Node.js 16+
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64), and Raspberry Pi (5 and 4).
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64, arm64), and Raspberry Pi (5 and 4).

## Installation

Expand Down
4 changes: 2 additions & 2 deletions demo/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@picovoice/picollm-node-demo",
"version": "1.2.3",
"version": "1.2.4",
"description": "Picovoice PicoLLM Node.js chat and completion demos",
"scripts": {
"chat": "node chat.js",
Expand All @@ -19,7 +19,7 @@
"author": "Picovoice Inc.",
"license": "Apache-2.0",
"dependencies": {
"@picovoice/picollm-node": "~1.2.3",
"@picovoice/picollm-node": "~1.2.4",
"commander": "^6.1.0",
"prettier": "^2.6.2"
},
Expand Down
8 changes: 4 additions & 4 deletions demo/nodejs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# yarn lockfile v1


"@picovoice/picollm-node@~1.2.3":
version "1.2.3"
resolved "https://registry.yarnpkg.com/@picovoice/picollm-node/-/picollm-node-1.2.3.tgz#e987159a308ee44b5d947213ee4401d6ff30e6ed"
integrity sha512-WdtrmMbxAUS8SDr98VRG+LulGe8UvRclu0+bBnOnYdOfEG7+XWHzC1ddsXRyN9mdmpPJj5T0xxQ1uk9dN2j+aw==
"@picovoice/picollm-node@~1.2.4":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@picovoice/picollm-node/-/picollm-node-1.2.4.tgz#f0dc0db5195737d731df99c91dde3e4ce1bc4ca5"
integrity sha512-UlJtMkn8Rl9QdPklGCngGAJaCMwnVQQRHucinZ33gplezRWCsgFRW8SdqE7D7EyK8bILJwc67Ngdtg19kyI08w==

commander@^6.1.0:
version "6.2.1"
Expand Down
2 changes: 1 addition & 1 deletion demo/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ models. picoLLM Inference Engine is:
## Compatibility

- Python 3.8+
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64), and Raspberry Pi (5 and 4).
- Runs on Linux (x86_64), macOS (arm64, x86_64), Windows (x86_64, arm64), and Raspberry Pi (5 and 4).

## Installation

Expand Down
2 changes: 1 addition & 1 deletion demo/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
picollm==1.2.3
picollm==1.2.4
4 changes: 2 additions & 2 deletions demo/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@

setuptools.setup(
name="picollmdemo",
version="1.2.3",
version="1.2.4",
author="Picovoice",
author_email="[email protected]",
description="picoLLM Inference Engine demos",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/Picovoice/picollm",
packages=["picollmdemo"],
install_requires=["picollm==1.2.3"],
install_requires=["picollm==1.2.4"],
include_package_data=True,
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
Binary file added lib/node/windows/arm64/libomp.dll
Binary file not shown.
Binary file modified lib/node/windows/arm64/pv_picollm.node
Binary file not shown.
Binary file added lib/windows/arm64/libomp.dll
Binary file not shown.
Binary file modified lib/windows/arm64/libpv_picollm.dll
Binary file not shown.
3 changes: 2 additions & 1 deletion resources/.test/test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
" Asset, and I am going to sing it,\n\n\n\nI will sing",
" bread.\n\nThe song is a parody of the song \"Banana Bread\"",
" bread.\n\nBanana bread is a delicious treat. It is made with bananas",
" bread.\n\nThe song is called \"Banana Bread\". It is about making"
" bread.\n\nThe song is called \"Banana Bread\". It is about making",
" bread.\n\nReferences\n\nExternal links\n\nAmerican folk songs\nAmerican folk"
]
},
"with-top-choices": {
Expand Down

0 comments on commit 77d9ae7

Please sign in to comment.