Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 1 addition & 44 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ on:
required: true
default: false
type: boolean
npu_sdk_run_id:
description: Optional override containing both locked Intel and AMD deployment SDKs
required: false
default: ""
type: string

permissions:
contents: read
Expand Down Expand Up @@ -47,10 +42,6 @@ jobs:
python tools/npm_release.py ensure-unpublished --version "$RELEASE_VERSION"

build-native:
# The locked AMD asset is attached to a draft until release publication.
permissions:
contents: write
actions: read
needs: validate
name: build ${{ matrix.id }}
strategy:
Expand Down Expand Up @@ -93,30 +84,6 @@ jobs:
- name: Bootstrap pinned native dependencies
shell: bash
run: python tools/bootstrap_dependencies.py --cache-dir .cache/dependencies
- name: Download distributable NPU SDKs
if: matrix.id == 'linux-x64' && inputs.npu_sdk_run_id != ''
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: npu-release-sdks
path: dist/npu-sdk
run-id: ${{ inputs.npu_sdk_run_id }}
github-token: ${{ github.token }}
- name: Prepare packaged Intel and opt-in AMD NPU payloads
if: matrix.id == 'linux-x64'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
if [[ ! -d dist/npu-sdk/openvino ]]; then
python tools/npu/build_openvino.py \
--package-cache .cache/npu-packages --output-dir dist/npu-sdk/openvino
fi
if [[ ! -d dist/npu-sdk/amdnpu ]]; then
python tools/npu/fetch_amdnpu.py \
--package-cache .cache/npu-packages --output-dir dist/npu-sdk/amdnpu
fi
python tools/npu/prepare_release.py --sdk-root dist/npu-sdk --github-env "$GITHUB_ENV" \
--require-provider openvino --require-provider amdnpu
- name: Fetch the pinned PDF renderer for npm bundling (Unix)
if: runner.os != 'Windows'
shell: bash
Expand Down Expand Up @@ -179,8 +146,6 @@ jobs:
-DLIGHT_OCR_DEPENDENCY_CACHE_DIR="$PWD/.cache/dependencies"
-DLIGHT_OCR_ONNXRUNTIME_FLAVOR=${{ matrix.runtime_flavor }}
-DLIGHT_OCR_WEBGPU_SDK_DIR="$PWD/dist/webgpu-sdk/${{ matrix.id }}"
-DLIGHT_OCR_OPENVINO_SDK_DIR="$OPENVINO_SDK_DIR"
-DLIGHT_OCR_AMDNPU_SDK_DIR="$AMDNPU_SDK_DIR"
-DLIGHT_OCR_BUILD_NODE=ON
-DLIGHT_OCR_BUILD_TESTS=OFF
-DLIGHT_OCR_BUILD_TOOLS=OFF
Expand Down Expand Up @@ -213,13 +178,6 @@ jobs:
- name: Stage native package input
shell: bash
run: |
npu_arguments=()
if [[ -n "${OPENVINO_SDK_DIR:-}" ]]; then
npu_arguments+=(--openvino-sdk-dir "$OPENVINO_SDK_DIR")
fi
if [[ -n "${AMDNPU_SDK_DIR:-}" ]]; then
npu_arguments+=(--amdnpu-sdk-dir "$AMDNPU_SDK_DIR")
fi
python tools/npm_release.py stage-native \
--platform-id "${{ matrix.id }}" \
--build-dir build-npm \
Expand All @@ -228,8 +186,7 @@ jobs:
--pdfium-dir .cache/pdfium-package/node_modules/pdfium-native \
--output-dir "dist/native-input/${{ matrix.id }}" \
--runtime-flavor "${{ matrix.runtime_flavor }}" \
--webgpu-artifact-manifest "dist/webgpu-sdk/${{ matrix.id }}/artifact-manifest.json" \
"${npu_arguments[@]}"
--webgpu-artifact-manifest "dist/webgpu-sdk/${{ matrix.id }}/artifact-manifest.json"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: native-${{ matrix.id }}
Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/npu-support-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: NPU support packages

on:
workflow_dispatch:
inputs:
version:
description: Patch version of the matching light-ocr release
default: '0.5.9'
required: true
type: string
publish_to_registry:
description: Publish both independent support packages under next
default: false
required: true
type: boolean

permissions:
contents: read

jobs:
build:
# The AMD deployment archive remains a draft asset until v0.5.9 ships.
permissions:
contents: write
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
provider: [openvino, amdnpu]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: '22'
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.11'
- name: Prepare the selected provider only
env:
GH_TOKEN: ${{ github.token }}
PROVIDER: ${{ matrix.provider }}
RELEASE_VERSION: ${{ inputs.version }}
run: |
test "$RELEASE_VERSION" = "$(cat VERSION)"
python tools/bootstrap_dependencies.py --cache-dir .cache/dependencies
if [[ "$PROVIDER" == openvino ]]; then
python tools/npu/build_openvino.py --package-cache .cache/npu --output-dir dist/sdk
else
python tools/npu/fetch_amdnpu.py --package-cache .cache/npu --output-dir dist/sdk
fi
- name: Build a separate CPU and NPU addon
env:
PROVIDER: ${{ matrix.provider }}
run: |
node_version="$(node -p process.versions.node)"
npx --yes node-gyp@11.4.2 install "$node_version" --devdir "$PWD/.cache/node-gyp"
sdk_option="LIGHT_OCR_${PROVIDER^^}_SDK_DIR"
cmake -S . -B build-support -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLIGHT_OCR_DEPENDENCY_CACHE_DIR="$PWD/.cache/dependencies" \
"-D$sdk_option=$PWD/dist/sdk" \
-DLIGHT_OCR_BUILD_NODE=ON -DLIGHT_OCR_BUILD_TESTS=OFF -DLIGHT_OCR_BUILD_TOOLS=OFF \
-DLIGHT_OCR_NODE_INCLUDE_DIR="$PWD/.cache/node-gyp/$node_version/include/node"
cmake --build build-support --parallel 2
- name: Package the independent support addon
env:
PROVIDER: ${{ matrix.provider }}
run: |
python tools/generate_release_metadata.py --build-dir build-support \
--output-dir reports/support --platform-id linux-x64 --model-free
python tools/npu/package_support.py --provider "$PROVIDER" \
--build-dir build-support --metadata-dir reports/support \
--sdk-dir dist/sdk --output-dir dist/package
mkdir -p dist/tarballs
npm pack ./dist/package --ignore-scripts --json --pack-destination dist/tarballs > dist/tarballs/pack-manifest.json
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: npu-support-${{ matrix.provider }}-${{ inputs.version }}
path: dist/tarballs/
retention-days: 90
if-no-files-found: error

publish:
needs: build
if: inputs.publish_to_registry
runs-on: ubuntu-24.04
environment: npm-release
permissions:
contents: read
id-token: write
steps:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: '22'
registry-url: https://registry.npmjs.org
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
pattern: npu-support-*-${{ inputs.version }}
path: dist/support
- name: Publish the explicitly installed support packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
for archive in dist/support/*/*.tgz; do
npm publish "$archive" --tag next --access public --provenance
done
17 changes: 9 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,27 @@ Release preparation; npm publication and GitHub Release are pending.

### Added

- Added a bundled Intel NPU backend (`provider: "openvino"`) for Linux x64.
- Added a separately installed Intel NPU backend (`provider: "openvino"`) for Linux x64.
Builds configured with `LIGHT_OCR_OPENVINO_SDK_DIR` load the OpenVINO C
runtime at run time, run detection and 20-bucket recognition on the NPU, and
place `openvino` first in the package Auto policy
(`openvino → webgpu → cpu`); hosts without an NPU skip it with
support explicit OpenVINO selection; default packages retain their existing
Auto policy; explicit requests on hosts without an NPU fail with
`adapter_unavailable`. Added a pinned native SDK extractor, package-local
runtime descriptor 2.1, numeric driver/compiler checks, and reviewed-evidence
release staging with optional device reports. The 0.5.9 Linux x64 build includes
pinned OpenVINO 2026.4.0 libraries. See
release staging with optional device reports. The optional OpenVINO support package includes
pinned OpenVINO 2026.4.0 libraries; default platform packages do not. See
[Intel NPU 加速技术方案](docs/intel-npu-acceleration.md).
- Added a bundled AMD NPU backend (`provider: "amdnpu"`) for Linux x64
- Added a separately installed AMD NPU backend (`provider: "amdnpu"`) for Linux x64
glibc and Ryzen AI STX/KRK devices. It isolates the vendor ORT runtime,
loads 20 immutable BF16 recognition contexts, and runs detection on CPU.
Added model compilation and SDK import tools, descriptor validation,
license/SBOM staging, and candidate/release workflows. AMD is excluded
from Auto and enabled only through `execution.provider: "amdnpu"` (or
`--provider amdnpu`). NPU device reports are optional for release;
`deviceValidated` remains false. The 0.5.9 Linux x64 build includes Ryzen AI 1.8
`deviceValidated` remains false. The optional AMD support package includes Ryzen AI 1.8
deployment libraries and real compiled contexts bound to Small 0.3.4.
Other platforms retain their existing providers. See [AMD NPU 加速技术方案](docs/amd-npu-acceleration.md)
Neither support package is automatically installed or selected by Auto.
The existing Small model bundle remains unchanged. See [AMD NPU 加速技术方案](docs/amd-npu-acceleration.md)
and [NPU SDK 构建与发布](docs/npu-runtime-release.md).

## [0.5.8] - 2026-09-24
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ error model, while each install contains only its selected model.
| Tiny | `@arcships/light-ocr-tiny@next` / `light-ocr-tiny` | ~6.3 MB | preview; 49 languages, no Japanese |
| Medium | `@arcships/light-ocr-medium@next` / `light-ocr-medium` | ~139 MB | preview; quality-first |

NPU support is installed separately through `@arcships/light-ocr-openvino-linux-x64-gnu` or `@arcships/light-ocr-amdnpu-linux-x64-gnu` and requires explicit provider selection. The default install contains neither provider's libraries nor compiled models; the existing Small model bundle stays unchanged. See the [NPU installation guide](docs/npu-runtime-release.md#用户安装与显式开启).

Tiny and Medium stay on `next`; they do not change what
`npm install @arcships/light-ocr` installs.

Expand Down
2 changes: 2 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ Small 继续作为稳定默认。Tiny 和 Medium 是 `next` tag 下的可选 pre
| Tiny | `@arcships/light-ocr-tiny@next` / `light-ocr-tiny` | 约 6.3 MB | Preview;49 种语言,不含日语 |
| Medium | `@arcships/light-ocr-medium@next` / `light-ocr-medium` | 约 139 MB | Preview;精度优先 |

NPU 支持通过单独安装的 `@arcships/light-ocr-openvino-linux-x64-gnu` / `@arcships/light-ocr-amdnpu-linux-x64-gnu` 提供,均需显式配置 provider。普通安装不含它们的运行库或编译模型,Small 模型制品保持不变。见 [NPU 安装说明](docs/npu-runtime-release.md#用户安装与显式开启)。

Tiny/Medium 保持在 `next`;它们不会改变
`npm install @arcships/light-ocr` 的安装内容。

Expand Down
4 changes: 2 additions & 2 deletions docs/amd-npu-acceleration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AMD NPU 加速技术方案

更新时间:2026-10-06。状态:Linux x64 glibc 后端与打包改造已实现,默认关闭、配置显式开启;0.5.9 发布输入已包含 Ryzen AI 1.8 的原生部署库与 Small 0.3.4 的 20 个真实 BF16 context。无需真机即可完成编译,尚未执行 AMD 设备推理。正式 npm 发布仍待完成。
更新时间:2026-10-06。状态:Linux x64 glibc 后端与打包改造已实现,默认关闭、配置显式开启;0.5.9 独立支持包的构建输入已包含 Ryzen AI 1.8 的原生部署库与 Small 0.3.4 的 20 个真实 BF16 context。无需真机即可完成编译,尚未执行 AMD 设备推理。正式 npm 发布仍待完成。

## 范围与模型路线

Expand All @@ -22,7 +22,7 @@ BF16 路线由 VAIML 编译 FP32 ONNX,生成可嵌入权重与微码的 EPCont

## 默认关闭与发布策略

AMD 始终排除在 Auto 候选列表之外;用户通过 `execution.provider: "amdnpu"`、CLI `--provider amdnpu` 或 C++ 的 `ExecutionProvider::amdnpu` 显式开启。0.5.9 Linux x64 发布构建默认附带 vendor SDK 与匹配的 Small 识别模型;运行时未配置 AMD 时不装载 vendor ORT。
AMD 始终排除在 Auto 候选列表之外;用户通过 `execution.provider: "amdnpu"`、CLI `--provider amdnpu` 或 C++ 的 `ExecutionProvider::amdnpu` 显式开启。0.5.9 独立 AMD 支持包附带 vendor SDK 与匹配的 Small 识别模型,普通平台包不包含它们;运行时未配置 AMD 时不装载 vendor ORT。

按维护者决定,NPU 真机验收不再阻塞发布。SDK 导入的 `qualificationOnly: true` 仅记录尚无设备证据,平台包可随其他已满足条件的运行时一起发布;`deviceValidated` 保持 `false`。库存、模型哈希、依赖闭包和许可证校验继续执行,设备报告可选。

Expand Down
2 changes: 1 addition & 1 deletion docs/implementation-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

## 0.5.9 NPU 发布准备(2026-10-06)

Linux x64 glibc 双 NPU Core/Node 构建与 npm native staging 已完成。默认发布输入包含 OpenVINO 2026.4.0,以及 Ryzen AI 1.8 的 20 个原生部署库和绑定 Small 0.3.4 的 20 个真实 BF16 context。Intel 进入 Auto;AMD 始终默认关闭,由配置显式开启。未执行 AMD 设备推理,`deviceValidated` 保持 false;真机验收不作为发布前置。版本、归档哈希与后续发布步骤见 [0.5.9 发布记录](releases/npm-0.5.9.md)。
Linux x64 glibc 双 NPU 实现与实际 AMD 模型编译已完成。旧 0.5.9 候选把两套 NPU 混入基础包,已明确废弃。拆包修正将 OpenVINO/AMD 放入单独安装的支持包,普通包保留既有模型制品与 Apple/WebGPU/CPU 路线。两套 NPU 均需安装后显式配置;不做真机验收,`deviceValidated` 保持 false。见 [0.5.9 发布记录](releases/npm-0.5.9.md)。

## 本机最终验证快照

Expand Down
2 changes: 2 additions & 0 deletions docs/intel-npu-acceleration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Intel NPU 加速技术方案

> 2026-10-06 发布修正:npm 默认包不携带 OpenVINO。用户单独安装 `@arcships/light-ocr-openvino-linux-x64-gnu`,显式指定 `provider: "openvino"`。默认 npm Auto 保持原有路线;下文的自定义源码构建/历史 Auto 方案不代表普通安装会下载或选用 NPU。见 [独立支持包说明](npu-runtime-release.md)。

状态:Phase B 后端和 Phase D 打包代码已实现;Linux x64 真机 14-fixture 已有验证记录;按维护者决定,真机 Gate 不再作为发布前置;当前 npm 包未包含 OpenVINO。构建和发布说明见 [NPU SDK 构建与发布](npu-runtime-release.md)。

更新时间:2026-09-29
Expand Down
Loading
Loading