Minimal-size Keras model inference library in Rust
Project description
A lightweight Rust library for running Keras models without the TensorFlow stack.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3be31332bf3b59d8d4796da38147fa6300eee5c5ea06ad6e9f48d9827be654b
|
|
| MD5 |
3d3917acebe634b84a158d1fadd37be3
|
|
| BLAKE2b-256 |
3cea9f955488caccb2bb1953e8054ec4ac9be8081b10ee35e11629d43c20b3e9
|
Provenance
The following attestation bundles were made for pocket_inference-0.1.1.tar.gz:
Publisher:
release.yml on James-Wirth/pocket-inference
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pocket_inference-0.1.1.tar.gz -
Subject digest:
b3be31332bf3b59d8d4796da38147fa6300eee5c5ea06ad6e9f48d9827be654b - Sigstore transparency entry: 1278899110
- Sigstore integration time:
-
Permalink:
James-Wirth/pocket-inference@176b8ece0fb19835477c2e5568c60a07df80fa0b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/James-Wirth
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@176b8ece0fb19835477c2e5568c60a07df80fa0b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.7+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bedfbaeaa4506f3936401695ceb63b2d5d7b6b84b833ae4739d68167b75dee6
|
|
| MD5 |
92b0be419aec1df62d4a675efbfab82b
|
|
| BLAKE2b-256 |
bbb0633a8823a96e07cbe345f318629928ab831d24872f3bd74fd969729489ac
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
8bedfbaeaa4506f3936401695ceb63b2d5d7b6b84b833ae4739d68167b75dee6 - Sigstore transparency entry: 1278899188
- Sigstore integration time:
-
Permalink:
James-Wirth/pocket-inference@176b8ece0fb19835477c2e5568c60a07df80fa0b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/James-Wirth
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@176b8ece0fb19835477c2e5568c60a07df80fa0b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.7+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
508778ed92af9eee5fe903bdc5e63c148a762cc6ad26aa866b51d85e5b59178b
|
|
| MD5 |
e993ceade972a418db5271845626ff59
|
|
| BLAKE2b-256 |
de984e00e115beabfcce3ea022f2a274fe02befc10d04e68860c6112658b99e4
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pocket_inference-0.1.1-cp37-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
508778ed92af9eee5fe903bdc5e63c148a762cc6ad26aa866b51d85e5b59178b - Sigstore transparency entry: 1278899158
- Sigstore integration time:
-
Permalink:
James-Wirth/pocket-inference@176b8ece0fb19835477c2e5568c60a07df80fa0b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/James-Wirth
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@176b8ece0fb19835477c2e5568c60a07df80fa0b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pocket_inference-0.1.1-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pocket_inference-0.1.1-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fa15b020370f9a3ad8b164ae06fb4d1f91ebca46b24e315afcb9dbc1cd74593
|
|
| MD5 |
75489ad994032bae4f50483c9faf42c1
|
|
| BLAKE2b-256 |
2ed791d2e025fbcba37ad094508b21009382c418b608b9459ea57895568cc317
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pocket_inference-0.1.1-cp37-abi3-macosx_11_0_arm64.whl -
Subject digest:
3fa15b020370f9a3ad8b164ae06fb4d1f91ebca46b24e315afcb9dbc1cd74593 - Sigstore transparency entry: 1278899136
- Sigstore integration time:
-
Permalink:
James-Wirth/pocket-inference@176b8ece0fb19835477c2e5568c60a07df80fa0b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/James-Wirth
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@176b8ece0fb19835477c2e5568c60a07df80fa0b -
Trigger Event:
push
-
Statement type: