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
- [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']
Setup
Note: compiling torchpipe depends on the TensorRT C++ API. Please follow the TensorRT Installation Guide. You may also try installing torchpipe inside one of the NGC PyTorch docker containers(e.g. nvcr.io/nvidia/pytorch:25.05-py3).
Installation
To install the torchpipe Python library, call the following
Inside NGC Docker Containers
test on 25.05, 24.05, 23.05, and 22.12
git clone https://github.com/torchpipe/torchpipe.git
cd torchpipe/
img_name=nvcr.io/nvidia/pytorch:25.05-py3
docker run --rm --gpus all -it --rm --network host \
-v $(pwd):/workspace/ --privileged \
-w /workspace/ \
$img_name \
bash
# pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
cd /workspace/plugins/torchpipe && python setup.py install --cv2
How does it work?
See Basic Usage.
How to add (or override) a backend
WIP
Version Migration Notes
TorchPipe (v1, this version) is a collection of deep learning computation backends built on Omniback library. Not all computation backends from TorchPipe (v0) have been ported to TorchPipe (v1) yet.
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.18.tar.gz.
File metadata
- Download URL: omniback-0.1.18.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6af57d410d0f5c3529e69de8b027647cfe3dd64c88fe153ac94a1c993b12650
|
|
| MD5 |
8d0913e156fd62e0960c774a83bc5bb2
|
|
| BLAKE2b-256 |
8792e310cca7b924ebe64c8c99e828a014626b1c8dcf5fa86071e634df73ef64
|
File details
Details for the file omniback-0.1.18-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: omniback-0.1.18-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 6.3 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 |
40fae283a4b86a34bbb43ac7cf87000263ee467d213c6dde73d7351071ad5897
|
|
| MD5 |
259fc1780a11bc0272f593e0d1c31df4
|
|
| BLAKE2b-256 |
d41e975fc9407472a9475a0d481f38954a943a647375d36d03ef14e15d8c3e91
|
File details
Details for the file omniback-0.1.18-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: omniback-0.1.18-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 6.1 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 |
1db56012f0bcfdc9e5de6c48ee26676723e177d15099619e3783b0c1e3b5da77
|
|
| MD5 |
7798832502c687555f680339621d90eb
|
|
| BLAKE2b-256 |
92886f4282930bf96179d0db23880cb602196155d5aedfae004a8690ab5b53ea
|
File details
Details for the file omniback-0.1.18-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: omniback-0.1.18-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 6.6 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 |
ecf2cdad3c4057b51593ed8760db8a54e1ff7481e814aae3e119f857c3375511
|
|
| MD5 |
3bdd59c478e8bbe3c97dfd193ea59111
|
|
| BLAKE2b-256 |
818c1672e04a521dc86e1c8f6e5fa71d878e4eb3b6580b30bead1120f022e418
|
File details
Details for the file omniback-0.1.18-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.
File metadata
- Download URL: omniback-0.1.18-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
- Upload date:
- Size: 6.4 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 |
91d153448e5a6508520505767d3e3977fe6beb864ee2f20536c9164bdcf99f5c
|
|
| MD5 |
c4cbafb4a1bfeb060019f4f5eecd173f
|
|
| BLAKE2b-256 |
c8d449422ba20d22b32cd5b00ddbe6ac12d49ae37422778fa73c646ca568b59c
|