onnx2torch  by ENOT-AutoDL

ONNX-to-PyTorch model converter

Created 3 years ago
700 stars

Top 48.7% 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

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
0
Star History
4 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Luis Capelo Luis Capelo(Cofounder of Lightning AI), and
1 more.

tutorials by onnx

0.1%
4k
ONNX model tutorials and examples
Created 7 years ago
Updated 1 year ago
Starred by Shizhe Diao Shizhe Diao(Author of LMFlow; Research Scientist at NVIDIA), Edward Sun Edward Sun(Research Scientist at Meta Superintelligence Lab), and
9 more.

DiT by facebookresearch

0.3%
8k
PyTorch implementation for diffusion models with transformers (DiT)
Created 2 years ago
Updated 1 year ago
Feedback? Help us improve.