Load a model (or UAII IR), run inference, and profile — without reading C++ internals.
- Build the C++ runtime (produces
uaii_capishared library):
cmake -S ../.. -B ../../build -DUAII_BUILD_TESTS=ON
cmake --build ../../build --config Release --parallel- Bundle the native library into the package (recommended for
pip install):
python scripts/bundle_native.py --build-dir ../../build- Optional native extension (pybind11):
cmake -S ../.. -B ../../build -DUAII_BUILD_PYTHON=ON
cmake --build ../../build --config Release --parallel- Install this package editable:
pip install -e .If the shared library is not found under uaii/_native/ or the build tree:
# Windows PowerShell
$env:UAII_CAPI_PATH = "C:\path\to\uaii_capi.dll"Defaults are fail-closed (weight_init="none"). GPU backend names use host-fallback unless real device kernels exist.
From the repo root, after a CMake build of uaii_capi:
# Linux / macOS
bash bindings/python/scripts/build_wheel.sh
# Windows PowerShell
powershell -File bindings/python/scripts/build_wheel.ps1These scripts:
- Configure and build with CMake (
-DUAII_BUILD_PLUGINS=ON; tip: add-DUAII_BUILD_PYTHON=ONfor pybind). - Run
scripts/bundle_native.pyto copyuaii_capiintouaii/_native/. - Run
python -m buildto produce wheels underbindings/python/dist/.
Manual equivalent:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallel
python bindings/python/scripts/bundle_native.py --build-dir build
python -m pip install build
python -m build bindings/pythonCI builds a CPU wheel on Ubuntu via .github/workflows/python-wheel.yml (and the multi-OS wheels.yml on tags).
import uaii
print(uaii.version(), "c_api", uaii.c_api_version())
s = uaii.Session()
s.load("path/to/model.uaii.json", backend="cpu", weight_init="ones")
s.set("x", [1.0, 2.0, 3.0, 4.0])
s.run()
print(s.get("y_prob"))See examples/python/load_run_profile.py in the repo root.