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.1.tar.gz (1.6 MB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: nanoflow_llm-0.6.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c24904aec4c70f7a0ebc28ee0623b3963102d837234ae21b6c4314211098423a
MD5 7ac2c4f0854c930509bd18b0b4fc4264
BLAKE2b-256 ebc36b9cc21388e35add71fd436d5492d8b82d293315396938ebfad9e899a7c0

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