Skip to main content

No project description provided

Project description

npuserver 🚀

A lightweight, efficient utility library for compiling and preparing Generative AI LLM models for the Intel NPU (Neural Processing Unit) using OpenVINO™ GenAI.


Features

  • Intel NPU Optimization: Fast, local LLM compilation designed for Intel NPU architectures.
  • Robust Model Fallbacks: Automated properties configuration with retry logic for prompt lengths.
  • Hugging Face Hub Integration: Seamless resolution and down-caching of models.
  • Clean API Design: Import and use directly in any Python environment.

Installation

From PyPI

pip install npuserver

From Source

  1. Clone the repository:
    git clone https://github.com/yourusername/npuserver.git
    cd npuserver
    
  2. Set up a virtual environment and install:
    python -m venv .venv
    # On Windows:
    .venv\Scripts\activate
    # On macOS/Linux:
    source .venv/bin/activate
    
    pip install -e .
    

Quick Start

Compile your favorite Hugging Face LLM model for the Intel NPU:

from pathlib import Path
from npuserver import compile_model

# Path to store compiled model caches
cache_dir = Path("./npu_cache")
cache_dir.mkdir(exist_ok=True)

# Compile a Hugging Face LLM (e.g., Qwen or Phi)
compile_model(
    repo_id="Qwen/Qwen2.5-0.5B-Instruct",
    cache_dir=cache_dir,
    prompt_len=8192
)

Development

Running with Poetry

This library uses Poetry as its package manager:

poetry install
poetry run python -c "import npuserver; print(npuserver.__all__)"

Directory Structure

npuserver/
├── .github/workflows/   # CI/CD & Automated Publishing
├── src/
│   └── npuserver/
│       ├── __init__.py  # Package entry point
│       └── compile.py   # Core compilation functions
├── tests/               # Test suites
├── pyproject.toml       # Modern packaging configuration
└── requirements.txt     # Standard pip requirements

PyPI Automatic Publishing

The project includes an automated GitHub Actions CI/CD pipeline (.github/workflows/publish.yml) that builds and publishes releases securely using OIDC Trusted Publishing:

  1. Tag your release:
    git tag v0.1.0
    git push origin v0.1.0
    
  2. The GitHub Action will trigger, build source/wheel distributions, and push to PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

npuserver-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

npuserver-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file npuserver-0.1.0.tar.gz.

File metadata

  • Download URL: npuserver-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for npuserver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 127ed0792da45c75ea6db130ad46c243d7ef19ac584ddea71966918c25d0c6a0
MD5 c2463cb3503296bbadc315707a0e63f5
BLAKE2b-256 b4469ce7b529d7735e52be6c295ae3996898b5fff5f5fbc339204576ce5fac4e

See more details on using hashes here.

File details

Details for the file npuserver-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: npuserver-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for npuserver-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e186fd394f38e26ae9f307286672bead5fc0192e6ea71d639a5551f78d473df
MD5 d5f5a2708aa9eb4192235e07afc6a9d6
BLAKE2b-256 fa6c19014f79be05c4aeafda731adbf488a7d3930262b2926b5ffa17a01b0641

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page