No project description provided
Project description
Torchpipe
torchpipe is an alternative choice for Triton Inference Server, mainly featuring similar functionalities such as Shared-momory, Ensemble, and BLS mechanism.
For serving scenarios, TorchPipe is designed to support multi-instance deployment, pipeline parallelism, adaptive batching, GPU-accelerated operators, and reduced head-of-line (HOL) blocking.It acts as a bridge between lower-level acceleration libraries (e.g., TensorRT, OpenCV, CVCUDA) and RPC frameworks (e.g., Thrift). At its core, it is an engine that enables programmable scheduling.
update
- [20260123] Available on Pypi:
pip install torchpipe - [20260104] We switched to tvm_ffi to provide clearer C++-Python interaction.
Usage
Below are some usage examples, for more check out the examples.
Initialize and Prepare Pipeline
from torchpipe import pipe
import torch
from torchvision.models.resnet import resnet101
# create some regular pytorch model...
model = resnet101(pretrained=True).eval().cuda()
# create example model
model_path = f"./resnet101.onnx"
x = torch.ones((1, 3, 224, 224)).cuda()
torch.onnx.export(model, x, model_path, opset_version=17,
input_names=['input'], output_names=['output'],
dynamic_axes={'input': {0: 'batch_size'},
'output': {0: 'batch_size'}})
thread_safe_pipe = pipe({
"preprocessor": {
"backend": "S[DecodeTensor,ResizeTensor,CvtColorTensor,SyncTensor]",
# "backend": "S[DecodeMat,ResizeMat,CvtColorMat,Mat2Tensor,SyncTensor]",
'instance_num': 2,
'color': 'rgb',
'resize_h': '224',
'resize_w': '224',
'next': 'model',
},
"model": {
"backend": "SyncTensor[TensorrtTensor]",
"model": model_path,
"model::cache": model_path.replace(".onnx", ".trt"),
"max": '4',
'batching_timeout': 4, # ms, timeout for batching
'instance_num': 2,
'mean': "123.675, 116.28, 103.53",
'std': "58.395, 57.120, 57.375", # merged into trt
}}
)
Execute
We can execute the returned thread_safe_pipe just like the original PyTorch model, but in a thread-safe manner.
data = {'data': open('/path/to/img.jpg', 'rb').read()}
thread_safe_pipe(data) # <-- this is thread-safe
result = data['result']
Installation
- NGC Docker containers (recommended):
test on 25.05, 25.06, 24.05, 23.05
img_name=nvcr.io/nvidia/pytorch:25.05-py3
docker run --rm --gpus all -it --network host \
-v $(pwd):/workspace/ --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 \
-w /workspace/ \
$img_name \
bash
pip install torchpipe
python -c "import torchpipe"
The backends it introduces will be JIT-compiled and cached.
There are one core backend group(torchpipe_core) and three optional groups (torchpipe_opencv, torchpipe_nvjpeg, and torchpipe_tensorrt) with different dependencies. For details, see here.
Dependencies such as OpenCV and TensorRT can also be provided in the following ways:
- providing environment variables:
Users can specify paths via the following environment variables:
OPENCV_INCLUDE,OPENCV_LIB,TENSORRT_INCLUDE,TENSORRT_LIB.
How does it work?
See Basic Usage.
How to add (or override) a backend
WIP
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 omniback-0.1.23.tar.gz.
File metadata
- Download URL: omniback-0.1.23.tar.gz
- Upload date:
- Size: 913.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5c0ecba59447af0ef4c683cd2251ee2edc8d44a755d5033ee96b682b377b3c7
|
|
| MD5 |
4e787a8cac5d7b800d76dcfd696e7345
|
|
| BLAKE2b-256 |
ed64a358709346f9f4c2bfc7ca2df7af6a79b48ed470496acc3ae9683692255b
|
File details
Details for the file omniback-0.1.23-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: omniback-0.1.23-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 6.6 MB
- Tags: Python 3, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84efe5240ff4f6bef100e7bcf42138ad4d40a68695efaf315774299e4d6eb62a
|
|
| MD5 |
5ed0264b9c5aee178d15177b858b7459
|
|
| BLAKE2b-256 |
c25f82edcf440480578a30d6a9b3b3e7046a4f4f283405a6a2736f1b415b5ae5
|
File details
Details for the file omniback-0.1.23-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: omniback-0.1.23-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 6.4 MB
- Tags: Python 3, manylinux: glibc 2.26+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31143c8764f892774f0f36cc97e5f58dd94d42dabfddc5edc0516d499100d987
|
|
| MD5 |
5a12c42a7512bd4ea2c3a856a7117a9d
|
|
| BLAKE2b-256 |
b9598d4b26a437b720d66046d7c31b64b517d97709dde7013494e5f02fb3b6ee
|
File details
Details for the file omniback-0.1.23-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: omniback-0.1.23-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 6.8 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac8a88870aaaa93e418c651cb5d5847740edb5f8b423942e3c4dac88adbde7f0
|
|
| MD5 |
4c9fdf2aab928ca4685cad4fab7fc270
|
|
| BLAKE2b-256 |
e9be0f24860eee036d19af6f31d1a4b7f202d8a798e579f70b7ec4f04548adcc
|
File details
Details for the file omniback-0.1.23-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.
File metadata
- Download URL: omniback-0.1.23-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
- Upload date:
- Size: 6.6 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bbcf6b4d14d1330b8a87803e76912be6b9772de268fbfde0b417b205e400726
|
|
| MD5 |
e4e5ac0e9c568d7ae6c2e72aa9162705
|
|
| BLAKE2b-256 |
844834ea5ad3bda05229f571a219dbfb8897b02d7bcf4790283e8af02d88a095
|