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.2.0.tar.gz (55.8 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.2.0-cp37-abi3-manylinux_2_28_x86_64.whl (739.7 kB view details)

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

pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_aarch64.whl (688.5 kB view details)

Uploaded CPython 3.7+manylinux: glibc 2.28+ ARM64

pocket_inference-0.2.0-cp37-abi3-macosx_11_0_arm64.whl (586.7 kB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pocket_inference-0.2.0.tar.gz
  • Upload date:
  • Size: 55.8 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.2.0.tar.gz
Algorithm Hash digest
SHA256 56c495c7f01300a1714554d92e70418cbcf091a78b70933ad31e00a673a5fed0
MD5 6bc649b197cada8f0d65479ed507cf03
BLAKE2b-256 3c64fa896645f3c81187e2a7c35281e42dbe7622855ead10b085d179af627042

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocket_inference-0.2.0.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.2.0-cp37-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 463ef17b24ca33ad59b5d280eba0d68c2f64487a5f6f58e050e00dd1b0743b52
MD5 f356ffcc1e464e27d9dddb82eb948bdd
BLAKE2b-256 1156cb48fc5af95c57b04d641824a84de6f312db09ba45562d1dfe7ba90b5cd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocket_inference-0.2.0-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.2.0-cp37-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pocket_inference-0.2.0-cp37-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d2cbdfa5678b084671f2c365de8766d7fcbba7de3c6a4bd1e659b2895fa4d0e7
MD5 dcac99f5dc2737115465e5c8e016d856
BLAKE2b-256 2061931a03cebc5a6fb7ea8d88f4f2abf0b4336ede535bc940dbf780d5c77ecb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocket_inference-0.2.0-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.2.0-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pocket_inference-0.2.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c334ab08dd9ae9d90c91183b699d97183f08675367f6ee6cececb131a3d8fc6
MD5 a1a8c19297d7d2d7272e98cfc09db059
BLAKE2b-256 b65592ec70b47d062b2719ae99d1e94618308c180da2480853b878748ab6f905

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocket_inference-0.2.0-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