Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.2.1 instead.

Pinferencia

Simple, but Powerful.

Language grade: Python PyPI PyPI - Python Version

Pinferencia


English Doc | Seriously, Doc | 中文文档 | 正襟危坐版文档

Help wanted. Translation, rap lyrics, all wanted. Feel free to create an issue.


Pinferencia tries to be the simplest AI model inference server ever!

Serving a model with REST API has never been so easy.

If you want to

  • find a simple but robust way to serve your model
  • write minimal codes while maintain controls over you service
  • avoid any heavy-weight solutions
  • easily to integrate with your CICD
  • make your model and service portable and runnable across machines

You're at the right place.

Features

Pinferencia features include:

  • Fast to code, fast to go alive. Minimal codes needed, minimal transformation needed. Just based on what you have.
  • 100% Test Coverage: Both statement and branch coverages, no kidding.
  • Easy to use, easy to understand.
  • Automatic API documentation page. All API explained in details with online try-out feature.
  • Serve any model, even a single function can be served.

Install

pip install "pinferencia[uvicorn]"

Quick Start

Serve Any Model

from pinferencia import Server


class MyModel:
    def predict(self, data):
        return sum(data)


model = MyModel()

service = Server()
service.register(
    model_name="mymodel",
    model=model,
    entrypoint="predict",
)

Just run:

uvicorn app:service --reload

Hooray, your service is alive. Go to http://127.0.0.1/ and have fun.

Any Deep Learning Models? Just as easy. Simple train or load your model, and register it with the service. Go alive immediately.

Pytorch

import torch

from pinferencia import Server


# train your models
model = "..."

# or load your models (1)
# from state_dict
model = TheModelClass(*args, **kwargs)
model.load_state_dict(torch.load(PATH))

# entire model
model = torch.load(PATH)

# torchscript
model = torch.jit.load('model_scripted.pt')

model.eval()

service = Server()
service.register(
    model_name="mymodel",
    model=model,
)

Tensorflow

import tensorflow as tf

from pinferencia import Server


# train your models
model = "..."

# or load your models (1)
# saved_model
model = tf.keras.models.load_model('saved_model/model')

# HDF5
model = tf.keras.models.load_model('model.h5')

# from weights
model = create_model()
model.load_weights('./checkpoints/my_checkpoint')
loss, acc = model.evaluate(test_images, test_labels, verbose=2)

service = Server()
service.register(
    model_name="mymodel",
    model=model,
    entrypoint="predict",
)

Any model of any framework will just work the same way. Now run uvicorn app:service --reload and enjoy!

Contributing

If you'd like to contribute, details are here

Release files for pinferencia 0.1.0rc1

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

Source distribution (sdist)

Source distribution for pinferencia 0.1.0rc1
File Size Uploaded
pinferencia-0.1.0rc1.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pinferencia 0.1.0rc1
File Interpreter ABI Platform
pinferencia-0.1.0rc1-py3-none-any.whl Python 3 none any Details

Total release size:40.1 kB

Release files / pinferencia-0.1.0rc1.tar.gz

Download URL pinferencia-0.1.0rc1.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
42908615fd953beee4dd6dea2c2d6931d0dc773e62c1bdc7f1c8b40f402173c5
BLAKE2b-256 checksum
How to use checksums
5dc4ccec5208bb56c403a9a369ff2b2ec73e00bcb9a6bdd8a234c11ee6b19ad9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.9 Darwin/21.1.0

Release files / pinferencia-0.1.0rc1-py3-none-any.whl

Download URL pinferencia-0.1.0rc1-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd92081b03a9ab527c730b991e9237ddb82bd40a1a23b4e1020d8c6adce42ccf
BLAKE2b-256 checksum
How to use checksums
6154d36708a86faae286d2ae6d8664f3fec84d9f2edab8f77be6386d08bdade3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.9 Darwin/21.1.0

Release history Release notifications | RSS feed

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

This release

0.1.0rc1 This release

2 release files

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