onnx2torch  by ENOT-AutoDL

ONNX-to-PyTorch model converter

created 3 years ago
691 stars

Top 50.1% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a tool to convert ONNX models into PyTorch models, enabling users to leverage PyTorch's ecosystem for models originally defined in ONNX. It is targeted at researchers and developers who need to integrate ONNX models into PyTorch workflows or fine-tune them using PyTorch.

How It Works

The converter parses the ONNX graph and translates each ONNX operation into its PyTorch equivalent. It supports a wide range of models and operations, including segmentation, detection, classification, and transformers. For unsupported operations, users can easily extend the converter by defining custom PyTorch modules and registering them.

Quick Start & Requirements

  • Install via pip: pip install onnx2torch or conda install -c conda-forge onnx2torch.
  • Requires Python and ONNX. GPU acceleration is supported when PyTorch is installed with CUDA.
  • Official documentation and examples are available.

Highlighted Details

  • Supports conversion of numerous models from popular frameworks like TorchVision, MMdetection, and Hugging Face Transformers.
  • Allows custom layer implementation and registration for extending converter functionality.
  • Includes a workaround for older ONNX opset versions using onnx.version_converter.
  • Enables conversion back to ONNX via torch.onnx.export.

Maintenance & Community

The project is maintained by ENOT developers and acknowledges contributions from several individuals. Community engagement is encouraged through issue reporting and merge requests.

Licensing & Compatibility

The project is released under an unspecified license. Compatibility for commercial use or closed-source linking is not explicitly detailed.

Limitations & Caveats

The converter covers only a limited number of PyTorch/ONNX models and operations, and users may encounter unsupported operations. The effectiveness of the opset version workaround may vary.

Health Check
Last commit

11 months ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
29 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems) and Deshraj Yadav Deshraj Yadav(Cofounder of Mem0).

tutorials by onnx

0.1%
4k
ONNX model tutorials and examples
created 7 years ago
updated 1 year ago
Feedback? Help us improve.