Skip to main content

Minimal-size Keras model inference library in Rust

Project description

Pocket Inference


A lightweight Rust library for running Keras models without the TensorFlow stack.

PyPI CI License

Binary size: ~450 KB · Designed for resource-constrained environments

Features

Category Supported
Layers Dense, Conv2D, Flatten, MaxPooling2D, AveragePooling2D, Dropout, BatchNormalization
Activations ReLU, Softmax, Sigmoid, Tanh, Linear
Formats .keras, .h5

Installation

pip install pocket-inference

Prebuilt wheels are published for Linux (x86_64, aarch64) and macOS (Apple Silicon), and cover every Python version from 3.7 onwards via the stable ABI.

Usage

import numpy as np
from pocket_inference import Sequential

# Load a saved Keras model
model = Sequential.load("model.keras")

# Run inference on a single sample
input_data = np.array([[1.0, 2.0, 3.0, 4.0]], dtype=np.float32)
output = model.predict(input_data)
print(output)

# Batch inference
batch = np.random.randn(32, 4).astype(np.float32)
batch_output = model.predict(batch)

# Introspection
print(model.summary())
print(model.num_layers(), model.layer_names())

Roadmap

  • Additional layer types (LSTM, GRU, ...)
  • More activation functions (LeakyReLU, ELU, GELU, ...)
  • GPU acceleration via compute shaders
  • Model optimization and pruning tools
  • Benchmark suite and performance metrics

Development

git clone https://github.com/James-Wirth/pocket-inference.git
cd pocket-inference
python -m venv .venv && source .venv/bin/activate
pip install maturin
maturin develop --release --features python

License

Dual-licensed under MIT or Apache 2.0.

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

pocket_inference-0.1.1.tar.gz (55.2 kB view details)

Uploaded Source

Built Distributions

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

pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.28+ x86-64

pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.28+ ARM64

pocket_inference-0.1.1-cp37-abi3-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

Details for the file pocket_inference-0.1.1.tar.gz.

File metadata

  • Download URL: pocket_inference-0.1.1.tar.gz
  • Upload date:
  • Size: 55.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pocket_inference-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b3be31332bf3b59d8d4796da38147fa6300eee5c5ea06ad6e9f48d9827be654b
MD5 3d3917acebe634b84a158d1fadd37be3
BLAKE2b-256 3cea9f955488caccb2bb1953e8054ec4ac9be8081b10ee35e11629d43c20b3e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocket_inference-0.1.1.tar.gz:

Publisher: release.yml on James-Wirth/pocket-inference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8bedfbaeaa4506f3936401695ceb63b2d5d7b6b84b833ae4739d68167b75dee6
MD5 92b0be419aec1df62d4a675efbfab82b
BLAKE2b-256 bbb0633a8823a96e07cbe345f318629928ab831d24872f3bd74fd969729489ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on James-Wirth/pocket-inference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 508778ed92af9eee5fe903bdc5e63c148a762cc6ad26aa866b51d85e5b59178b
MD5 e993ceade972a418db5271845626ff59
BLAKE2b-256 de984e00e115beabfcce3ea022f2a274fe02befc10d04e68860c6112658b99e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on James-Wirth/pocket-inference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pocket_inference-0.1.1-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pocket_inference-0.1.1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3fa15b020370f9a3ad8b164ae06fb4d1f91ebca46b24e315afcb9dbc1cd74593
MD5 75489ad994032bae4f50483c9faf42c1
BLAKE2b-256 2ed791d2e025fbcba37ad094508b21009382c418b608b9459ea57895568cc317

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocket_inference-0.1.1-cp37-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on James-Wirth/pocket-inference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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