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-1.0.2.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

npuserver-1.0.2-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for npuserver-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9216a2b6c0676553db466657b91926e9e81630e63d1380069dbe07d0cc2ebb05
MD5 c30a84e99c8c098cce5355f6a038f815
BLAKE2b-256 a8f50ff70a825c55df6f2910c77d1de988a1ec23d653a8680041bc807e3c076f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for npuserver-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 49aeac4228ffc92d377df6f73c100a38e064ee0e9cd049ff5d36421048a90ecc
MD5 8b142808f61c7407216f9a44ed5fd1bb
BLAKE2b-256 2303ca6b5dc5aadc9ee95b664be138c089c4f865aa4529bd9ceac73f51a1e254

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