Sinapsis tool to convert models from one framework to another and can be used in AOT and JIT modes
Project description
Sinapsis Framework Converter
Templates for conversion between deep learning frameworks.
🐍 Installation • 🚀 Features 📙 Documentation • 🔍 License
The sinapsis-framework-converter module allows for the conversion between some of the most popular deep learning frameworks in the community:
- Keras -> Tensorflow
- Tensorflow -> ONNX
- Pytorch -> TensorRT
- Pytorch -> ONNX
- ONNX -> TensorRT
🐍 Installation
[!NOTE] CUDA-based templates in Sinapsis-framework-converter require NVIDIA driver version to be 550 or higher.
Install using your package manager of choice. We encourage the use of uv
Example with uv:
uv pip install sinapsis-framework-converter --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-framework-converter --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] Templates in each package may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
Example with uv:
uv pip install sinapsis-framework-converter[all] --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-framework-converter[all] --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] To enable tensorflow with cuda support please install
tensorflowas follows:
uv pip install tensorflow[and-cuda]==2.18.0
or
pip install tensorflow[and-cuda]==2.18.0
🚀 Features
Templates Supported
The Sinapsis Framework Converter module provides multiple templates for deep learning framework conversion.
- KerasTensorFlowConverter: Converts Keras models to TensorFlow.
- ONNXTRTConverter: Converts ONNX models to TensorRT.
- TensorFlowONNXConverter: Converts TensorFlow models to ONNX.
- TorchONNXConverter: Converts PyTorch models to ONNX.
- TorchTRTConverter: Converts PyTorch models to TensorRT.
▶️ Example Usage
The following example demonstrates how to use the TorchONNXConverter template to convert a PyTorch model into the ONNX format. The configuration sets up an agent with the necessary templates to load a model, convert it, and store the converted file. Below is the full YAML configuration, followed by a breakdown of each component.
agent:
name: conversion_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: TorchONNXConverter
class_name: TorchONNXConverter
template_input: InputTemplate
attributes:
model_name: resnet50
save_model_path: true
force_compilation: true
opset_version: 12
height: 224
width: 224
This configuration defines an agent and a sequence of templates to perform model conversion.
- Input Handling (
InputTemplate): This serves as the initial template. - Model Conversion (
TorchONNXConverter): Loads a PyTorch model (e.g.,resnet50) and converts it to ONNX format. The template:- Uses the
model_nameattribute to specify which PyTorch model to convert. - Applies the
opset_versionattribute to define the ONNX operator set version (e.g.,12). - Adjusts the input tensor dimensions using
heightandwidth. - Enables
force_compilationto ensure the model is recompiled if needed.
- Uses the
- Saving the Converted Model: The
save_model_pathattribute is set totrue, ensuring that the output ONNX model path is saved in the DataContainer.
📙 Documentation
Documentation is available on the sinapsis website
Tutorials for different projects within sinapsis are available at sinapsis tutorials page
🔍 License
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.
For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.
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 sinapsis_framework_converter-0.1.4.tar.gz.
File metadata
- Download URL: sinapsis_framework_converter-0.1.4.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ae800a5150c0bdfb295ee79a035154eda2f60d4aa908b173ec5457917375657
|
|
| MD5 |
5cc7cbe9db127a012a5f52d897f0dd82
|
|
| BLAKE2b-256 |
8af0ab380c20cb69778cdc532aad663f4a0611b68a50ce2a25703ef465c0c2d2
|
File details
Details for the file sinapsis_framework_converter-0.1.4-py3-none-any.whl.
File metadata
- Download URL: sinapsis_framework_converter-0.1.4-py3-none-any.whl
- Upload date:
- Size: 33.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b52a626bf89a3a55ef26424c2aaccdd7b71d2e51baa59d8f0561208dc4a27c6
|
|
| MD5 |
942f739ba86346ff4a66d5eb5936dc06
|
|
| BLAKE2b-256 |
490e66a949853d243a70dd9ce32827a80e2e8f8cc3fe02b459321648fa695a6b
|