Skip to main content

instmodel

This repo is meant to be used with coding agents, not read manually.

Build and train small neural networks with PyTorch or TensorFlow/Keras through one shared graph API, then export them to a compact JSON "instruction model" that runs anywhere with plain NumPy (or the Rust/C++ inference ports) — no training framework needed at inference time.

Install

pip install instmodel              # NumPy inference only
pip install instmodel[pytorch]     # + PyTorch training backend (instmodel.torch)
pip install instmodel[tensorflow]  # + TensorFlow/Keras training backend (instmodel.tf)

Example

import numpy as np
from instmodel.torch import Dense, InputBuffer, ModelGraph  # same API in instmodel.tf
from instmodel.instruction_model import instruction_model_inference

x = InputBuffer(4)
y = Dense(1, activation="sigmoid")(Dense(8, activation="relu")(x))
model = ModelGraph(x, y)
model.compile(optimizer="adam", loss="binary_crossentropy")
model.fit(np.random.rand(64, 4), np.random.randint(0, 2, (64, 1)), epochs=5, verbose=0)

exported = model.create_instruction_model()  # JSON-serialisable dict
print(instruction_model_inference(exported, np.random.rand(3, 4))[-1])

License

MIT

Metadata

Release files for instmodel 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for instmodel 1.3.1
File Size Uploaded Provenance Actions
instmodel-1.3.1.tar.gz 24.9 kB With provenance Details for instmodel-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for instmodel 1.3.1
File Interpreter ABI Platform Actions
instmodel-1.3.1-py3-none-any.whl Python 3 none any Details for instmodel-1.3.1-py3-none-any.whl

Total release size: 47.2 kB

Release files / instmodel-1.3.1.tar.gz

Download URL instmodel-1.3.1.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cc54d45947d9aaf2c11ea6cc766e07e8ff1989547bbb896f6603351c9f2cf014
BLAKE2b-256 checksum
How to use checksums
9b24bee8656b59aff51e053ab49714283fad282e44f3a34f9572b24b8e9e6d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / instmodel-1.3.1-py3-none-any.whl

Download URL instmodel-1.3.1-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6476354de34a07391f4607eadfc54e362a50dc659701650d6e613659c589aa2
BLAKE2b-256 checksum
How to use checksums
60534ad5ccd0e90622bdd50bb6742a6aa3b893e8ad5f65ee7436ddd6c08366f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for instmodel 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for instmodel-1.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page