Skip to main content

NanoFlow LLM Universal Bindings (Self-Contained)

Project description

NanoFlow: The "Blind" Inference Engine 🧅🚀

NanoFlow is a lightweight, high-performance LLM inference engine optimized for Zero-Copy interoperability and Layer-Wise execution.

🌟 Key Features

  • Universal Format Support: Decoupled Compute Engine. Load weights in Python (Safetensors, PyTorch, GGUF, ONNX) and pass raw pointers to C++.
  • Zero-Copy Adapter: No data duplication. C++ operates directly on Python-allocated memory.
  • "Onion System" Architecture:
    • Memory Isolation: Fixed "Hot Buffer" for active layer weights.
    • Temporal Segmentation: Streams layers just-in-time, allowing 70B models to run on consumer hardware.
  • Cross-Platform: Native support for Windows (MSVC) and Linux (GCC/Clang).
  • Powered by GGML: Utilizes the raw math performance of the GGML library.

📦 Installation

pip install nanoflow-llm

🚀 Usage (Universal Adapter)

import torch
from safetensors.torch import load_file
import nanoflow_ext

# 1. Load Data (Python)
tensors = load_file("model.safetensors")
tensor_data = tensors["layer1.weight"]

# 2. Pass Pointer (Zero-Copy)
engine = nanoflow_ext.NanoFlowEngine()
engine.set_weights(
    name="layer1.weight", 
    raw_pointer=tensor_data.data_ptr(), 
    rows=tensor_data.shape[0], 
    cols=tensor_data.shape[1], 
    ggml_type_id=0 # F32
)

# 3. Compute (C++)
engine.compute("layer1.weight")

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

nanoflow_llm-0.6.2.tar.gz (1.6 MB view details)

Uploaded Source

File details

Details for the file nanoflow_llm-0.6.2.tar.gz.

File metadata

  • Download URL: nanoflow_llm-0.6.2.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for nanoflow_llm-0.6.2.tar.gz
Algorithm Hash digest
SHA256 8c20b9d530fb1372fe84731ecec8e61bc75fca7ef05497743260e733406313d8
MD5 19e35860a4ccc320349cebb5676579f7
BLAKE2b-256 7056ce2e8a01939760361a643e9a3be105e1c29a3a972e298d6121f42935ef7b

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