AI/ML inference SDK for streaming data
Project description
Introduction
packflow is a software development kit (SDK) that simplifies the development process and standardizes packaging of AI/ML
running on streaming data sources.
What does Packflow do? Packflow provides a framework for writing, running, and packaging inference code. It offers a standardized structure (the InferenceBackend class) for writing model execution logic, provides the runtime backbone that executes models with built-in profiling and preprocessing, and includes tools to bundle code into portable zip archives. This means you write your inference code once using Packflow's structure, and Packflow handles both the optimized execution and creation of shareable packages for transfer between systems.
Many existing packaging frameworks are catered towards inference APIs and often require custom preprocessing steps. This can be particularly challenging when dealing with data sources that typically generate data one row at a time in key-value pairs (e.g., firewall logs or message streams).
Packflow, however, is optimized to run models on either individual events or batches of events, streamlining development and reducing the need for additional preprocessing. By leveraging Packflow, teams can focus on building and deploying models with custom out-of-the-box workflows and utilities, significantly reducing the time and effort required to onboard new capabilities.
Getting Started
The following instructions quickly walk through how to install Packflow and serve user documentation.
Installing Packflow
Prerequisite Requirements
- Python (version 3.10+)
Installation from PyPI
- Packflow can be installed directly from PyPI:
pip install packflow
[!NOTE] If contributing to Packflow, it is recommended to install
packflowfrom source in editable mode:pip install -e .
Documentation
Packflow documentation is hosted at https://dow-cdao.github.io/packflow/. Pre-built HTML is also available on the gh-pages branch.
To build and serve documentation locally:
- Install system prerequisites: Pandoc (required in addition to the
pandocPython package) andmake[^2] - Navigate to the docs folder:
cd docs - Install Python dependencies:
pip install -r requirements.txt - Run
make devto serve with live reloading at https://127.0.0.1:8000/
Usage
Packflow provides a flexible base class called an InferenceBackend that allows users to build highly scalable platform- and tool-agnostic inference code, enabling simplified sharing across environments.
Additionally, Packflow's CLI can assist with creating projects, gathering environmental information, and creating distributable code packages for sharing reproducible inference code between disconnected environments.
Dummy Inference Backend
To create a dummy Inference Backend, update the inference.py file to the following:
from packflow import InferenceBackend
class Backend(InferenceBackend):
def execute(self, inputs):
"""
Simply print 'Hello, world!' then return the input data
"""
print('Hello, world!')
return inputs
Load and Run the Inference Backend
In a different Python file or from the command line in the same directory, execute the following:
from packflow.loaders import LocalLoader
backend = LocalLoader('inference:Backend').load()
backend({"sample": "data"})
# >> {"sample": "data"}
Contributing
Contributions to Packflow are welcomed and highly encouraged! Please refer to the CONTRIBUTING.md guide for more information and guidelines for contributing to Packflow.
Authors
Packflow is developed and maintained by Booz Allen Hamilton on behalf of the Federal Government of the United States of America and the Department of War's Chief Digital and Artificial Intelligence Office (CDAO).
License
packflow is distributed under the terms of the MIT license. Please refer to the LICENSE for more information of acceptable usage and distribution of Packflow.
[^2]: Installation of make varies by operating system. On MacOS, install xcode-select. On Windows, it is recommend to use Windows Subsystem for Linux (WSL). On Debian/Ubuntu, make can be installed via apt package manager:
sudo apt update sudo apt install make build-essential
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 Distribution
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 packflow-0.3.1rc1.tar.gz.
File metadata
- Download URL: packflow-0.3.1rc1.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.11.14 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
143c6fa138777e59526f5fc71f3ea518cd33d3c3cb940f3d11f9c7d74d225742
|
|
| MD5 |
daa6d7c3f8120c7c5df4d3839cfd21c0
|
|
| BLAKE2b-256 |
83e1a37dda413d80efec24448ef571fc645d63209cb739bdb11424099f48af52
|
File details
Details for the file packflow-0.3.1rc1-py3-none-any.whl.
File metadata
- Download URL: packflow-0.3.1rc1-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.11.14 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a991568668978fffc1cc4933b355ff155b7560eeb0cfe50efe3f194e4f3fa14
|
|
| MD5 |
f9122a8df9b80c41672300eb1629a3d4
|
|
| BLAKE2b-256 |
619dbf8cfdc88fd92e7a3bfdd59fdc575dce6ffa7f0578a1ddd9f53cd8845f7b
|