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(ram_limit_mb=256)
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.3.tar.gz (1.6 MB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: nanoflow_llm-0.6.3.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.3.tar.gz
Algorithm Hash digest
SHA256 f49b81662b49a0559645e7244b1748542960d5a748c893a4c2e09e7c9087e5e2
MD5 b78becb0dc9435b765f89886d3a1bd85
BLAKE2b-256 2525d8eed30c464c1b311aeec061a087241055e62a3ac9f8505b519659f4d242

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