Model deployment, portability, and architecture-independent compilation
Project description
ModelPort 🚀
ModelPort makes machine learning model deployment simple, portable, and architecture-independent.
Deploy your ML models anywhere — regardless of architecture or operating system. ModelPort simplifies the process of exporting models to ONNX format and compiling them for deployment on different platforms.
📣 Version 2.0 Release
ModelPort 2.0 features native model compilation! This release introduces Apache TVM integration for compiling models to platform-specific shared libraries that run without dependencies like Python or ONNX Runtime.
What's New in v2.0:
- 🔥 Native Compilation - Compile ONNX models to platform-specific native libraries
- 🚀 Zero-Dependency Execution - Run models without Python or ONNX Runtime
- 🖥️ Cross-Platform Support - Compile for x86_64, ARM64, and more
- 🎮 GPU Acceleration - CUDA, Metal, and OpenCL support for compiled models
- 🧰 C++ Integration - Run compiled models from C++ applications
- 📊 Benchmark Tools - Performance testing and optimization
📦 Installation
pip install modelport
For GPU support:
pip install modelport[gpu]
Development installation:
git clone https://github.com/SaiKrishna-KK/model-port.git
cd model-port
pip install -e .
🚀 Quick Start
Command Line Interface
# Export a model to ONNX (framework auto-detected)
modelport export path/to/model.pt
# Compile model to native code
modelport compile path/to/model.onnx
# Run inference on compiled model
modelport run path/to/compiled_model --input data.npy
Python API
import torch
import modelport as mp
# Create or load your PyTorch model
model = torch.nn.Sequential(
torch.nn.Linear(10, 5),
torch.nn.ReLU(),
torch.nn.Linear(5, 2)
)
model.eval()
# Export to ONNX
mp.export.to_onnx(
model,
input_shape=(1, 10),
output_path="my_model.onnx"
)
# Compile for your target hardware
mp.compile.compile_model(
"my_model.onnx",
target_arch="x86_64", # Use "aarch64" for ARM (M1/M2 Macs)
target_device="cpu", # Use "cuda" for NVIDIA GPUs
output_dir="compiled_model"
)
# Run inference
import numpy as np
input_data = {"input": np.random.randn(1, 10).astype(np.float32)}
outputs = mp.inference.run("compiled_model", input_data)
print(f"Output shape: {outputs[0].shape}")
🔧 Supported Architectures
- ✅ x86_64 (Intel, AMD processors)
- ✅ arm64 (Apple M1/M2, AWS Graviton)
- ✅ aarch64 (Jetson, Raspberry Pi, ARM Linux)
- ✅ NVIDIA GPU (via CUDA)
- ✅ Apple GPU (via Metal)
- ✅ OpenCL devices
⚠️ Known Issues
- Batch inference on ARM architecture (M1/M2 Macs) may have limitations
- Some TVM optimizations may show warnings on ARM platforms
- TVM compatibility requires specific versions (0.12.0 with ml_dtypes==0.2.0)
📚 Documentation
For detailed documentation, see the following resources:
- Documentation Home - Documentation overview
- Full Documentation - Comprehensive guide with detailed instructions
- Release Notes - Version history and changes
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgements
- The PyTorch team for their excellent work on ONNX export
- The ONNX community for creating a powerful standard for model interoperability
- The Apache TVM team for their amazing compiler infrastructure
- All contributors who have helped make this project better
Made with ❤️ by SaiKrishna-KK
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 model_port-2.0.5.tar.gz.
File metadata
- Download URL: model_port-2.0.5.tar.gz
- Upload date:
- Size: 55.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f444fcf64ed08da6d1d96802c4eb181e3ece1c29d4797b702c733c71a187e405
|
|
| MD5 |
0d3931dd95b1838d39d80f15e3f803e7
|
|
| BLAKE2b-256 |
020ec4110273a7146dca9570643d26ba208e65225032db8ce262a7314935f553
|
Provenance
The following attestation bundles were made for model_port-2.0.5.tar.gz:
Publisher:
publish.yml on SaiKrishna-KK/model-port
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
model_port-2.0.5.tar.gz -
Subject digest:
f444fcf64ed08da6d1d96802c4eb181e3ece1c29d4797b702c733c71a187e405 - Sigstore transparency entry: 198745193
- Sigstore integration time:
-
Permalink:
SaiKrishna-KK/model-port@382451ff490ca578988615e0c52c82c1646b0dc8 -
Branch / Tag:
refs/tags/v2.0.5 - Owner: https://github.com/SaiKrishna-KK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@382451ff490ca578988615e0c52c82c1646b0dc8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file model_port-2.0.5-py3-none-any.whl.
File metadata
- Download URL: model_port-2.0.5-py3-none-any.whl
- Upload date:
- Size: 48.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f987a19cb21feff4dc301831e6265d79fdc185ccac531e77c266fdf7f8936bf
|
|
| MD5 |
e3bf34d1b1b682829cfa6b89be859a4f
|
|
| BLAKE2b-256 |
55e1561a4a0b9d9bc2cda7c0739ad12f4dfbf85e295dc82a5eb66e16cb375ce6
|
Provenance
The following attestation bundles were made for model_port-2.0.5-py3-none-any.whl:
Publisher:
publish.yml on SaiKrishna-KK/model-port
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
model_port-2.0.5-py3-none-any.whl -
Subject digest:
3f987a19cb21feff4dc301831e6265d79fdc185ccac531e77c266fdf7f8936bf - Sigstore transparency entry: 198745200
- Sigstore integration time:
-
Permalink:
SaiKrishna-KK/model-port@382451ff490ca578988615e0c52c82c1646b0dc8 -
Branch / Tag:
refs/tags/v2.0.5 - Owner: https://github.com/SaiKrishna-KK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@382451ff490ca578988615e0c52c82c1646b0dc8 -
Trigger Event:
release
-
Statement type: