onnx2torch

Convert ONNX models to PyTorch.

https://github.com/enot-autodl/onnx2torch

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 22 committers (4.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.0%) to scientific vocabulary

Keywords

convert export onnx pytorch
Last synced: 6 months ago · JSON representation ·

Repository

Convert ONNX models to PyTorch.

Basic Info
  • Host: GitHub
  • Owner: ENOT-AutoDL
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 379 KB
Statistics
  • Stars: 698
  • Watchers: 10
  • Forks: 80
  • Open Issues: 43
  • Releases: 22
Topics
convert export onnx pytorch
Created about 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation Codeowners

README.md


onnx2torch is an ONNX to PyTorch converter. Our converter:

  • Is easy to use – Convert the ONNX model with the function call convert;
  • Is easy to extend – Write your own custom layer in PyTorch and register it with @add_converter;
  • Convert back to ONNX – You can convert the model back to ONNX using the torch.onnx.export function.

If you find an issue, please let us know! And feel free to create merge requests.

Please note that this converter covers only a limited number of PyTorch / ONNX models and operations. Let us know which models you use or want to convert from ONNX to PyTorch here.

Installation

bash pip install onnx2torch

or

bash conda install -c conda-forge onnx2torch

Usage

Below you can find some examples of use.

Convert

```python import onnx import torch from onnx2torch import convert

Path to ONNX model

onnxmodelpath = "/some/path/mobilenetv2.onnx"

You can pass the path to the onnx model to convert it or...

torchmodel1 = convert(onnxmodelpath)

Or you can load a regular onnx model and pass it to the converter

onnxmodel = onnx.load(onnxmodelpath) torchmodel2 = convert(onnxmodel) ```

Execute

We can execute the returned PyTorch model in the same way as the original torch model.

```python import onnxruntime as ort

Create example data

x = torch.ones((1, 2, 224, 224)).cuda()

outtorch = torchmodel_1(x)

ortsess = ort.InferenceSession(onnxmodelpath) outputsort = ort_sess.run(None, {"input": x.numpy()})

Check the Onnx output against PyTorch

print(torch.max(torch.abs(outputsort - outtorch.detach().numpy()))) print(np.allclose(outputsort, outtorch.detach().numpy(), atol=1.0e-7)) ```

Models

We have tested the following models:

Segmentation models:

  • [x] DeepLabV3+
  • [x] DeepLabV3 ResNet-50 (TorchVision)
  • [x] HRNet
  • [x] UNet (TorchVision)
  • [x] FCN ResNet-50 (TorchVision)
  • [x] LRASPP MobileNetV3 (TorchVision)

Detection from MMdetection:

Classification from TorchVision:

  • [x] ResNet-18
  • [x] ResNet-50
  • [x] MobileNetV2
  • [x] MobileNetV3 Large
  • [x] EfficientNet-B{0, 1, 2, 3}
  • [x] WideResNet-50
  • [x] ResNext-50
  • [x] VGG-16
  • [x] GoogLeNet
  • [x] MnasNet
  • [x] RegNet

Transformers:

  • [x] ViT
  • [x] Swin
  • [x] GPT-J

:pagefacingup: List of currently supported operations can be founded here.

How to add new operations to converter

Here we show how to extend onnx2torch with new ONNX operation, that supported by both PyTorch and ONNX

and has the same behaviour An example of such a module is [Relu](./onnx2torch/node_converters/activations.py) ```python @add_converter(operation_type="Relu", version=6) @add_converter(operation_type="Relu", version=13) @add_converter(operation_type="Relu", version=14) def _(node: OnnxNode, graph: OnnxGraph) -> OperationConverterResult: return OperationConverterResult( torch_module=nn.ReLU(), onnx_mapping=onnx_mapping_from_node(node=node), ) ``` Here we have registered an operation named `Relu` for opset versions 6, 13, 14. Note that the `torch_module` argument in `OperationConverterResult` must be a torch.nn.Module, not just a callable object! If Operation's behaviour differs from one opset version to another, you should implement it separately.
but has different behaviour An example of such a module is [ScatterND](./onnx2torch/node_converters/scatter_nd.py) ```python # It is recommended to use Enum for string ONNX attributes. class ReductionOnnxAttr(Enum): NONE = "none" ADD = "add" MUL = "mul" class OnnxScatterND(nn.Module, OnnxToTorchModuleWithCustomExport): def __init__(self, reduction: ReductionOnnxAttr): super().__init__() self._reduction = reduction # The following method should return ONNX attributes with their values as a dictionary. # The number of attributes, their names and values depend on opset version; # method should return correct set of attributes. # Note: add type-postfix for each key: reduction -> reduction_s, where s means "string". def _onnx_attrs(self, opset_version: int) -> Dict[str, Any]: onnx_attrs: Dict[str, Any] = {} # Here we handle opset versions < 16 where there is no "reduction" attribute. if opset_version < 16: if self._reduction != ReductionOnnxAttr.NONE: raise ValueError( "ScatterND from opset < 16 does not support" f"reduction attribute != {ReductionOnnxAttr.NONE.value}," f"got {self._reduction.value}" ) return onnx_attrs onnx_attrs["reduction_s"] = self._reduction.value return onnx_attrs def forward( self, data: torch.Tensor, indices: torch.Tensor, updates: torch.Tensor, ) -> torch.Tensor: def _forward(): # ScatterND forward implementation... return output if torch.onnx.is_in_onnx_export(): # Please follow our convention, args consists of: # forward function, operation type, operation inputs, operation attributes. onnx_attrs = self._onnx_attrs(opset_version=get_onnx_version()) return DefaultExportToOnnx.export( _forward, "ScatterND", data, indices, updates, onnx_attrs ) return _forward() @add_converter(operation_type="ScatterND", version=11) @add_converter(operation_type="ScatterND", version=13) @add_converter(operation_type="ScatterND", version=16) def _(node: OnnxNode, graph: OnnxGraph) -> OperationConverterResult: node_attributes = node.attributes reduction = ReductionOnnxAttr(node_attributes.get("reduction", "none")) return OperationConverterResult( torch_module=OnnxScatterND(reduction=reduction), onnx_mapping=onnx_mapping_from_node(node=node), ) ``` Here we have used a trick to convert the model from torch back to ONNX by defining the custom `_ScatterNDExportToOnnx`.

Opset version workaround

Incase you are using a model with older opset, try the following workaround:

ONNX Version Conversion - Official Docs

Example ```python import onnx from onnx import version_converter import torch from onnx2torch import convert # Load the ONNX model. model = onnx.load("model.onnx") # Convert the model to the target version. target_version = 13 converted_model = version_converter.convert_version(model, target_version) # Convert to torch. torch_model = convert(converted_model) torch.save(torch_model, "model.pt") ```

Note: use this only when the model does not convert to PyTorch using the existing opset version. Result might vary.

Citation

To cite onnx2torch use Cite this repository button, or:

@misc{onnx2torch, title={onnx2torch}, author={ENOT developers and Kalgin, Igor and Yanchenko, Arseny and Ivanov, Pyoter and Goncharenko, Alexander}, year={2021}, howpublished={\url{https://enot.ai/}}, note={Version: x.y.z} }

Acknowledgments

Thanks to Dmitry Chudakov @cakeofwar42 for his contributions.\ Special thanks to Andrey Denisov @denisovap2013 for the logo design.

Owner

  • Name: ENOT
  • Login: ENOT-AutoDL
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
title: onnx2torch
message: "Please use this information to cite onnx2torch in research or other publications."
authors:
  - affiliation: ENOT LLC
    given-names: ENOT developers
  - family-names: Kalgin
    given-names: Igor
  - family-names: Yanchenko
    given-names: Arseny
  - family-names: Ivanov
    given-names: Pyoter
  - family-names: Goncharenko
    given-names: Alexander
date-released: 2021-12-14
url: "https://enot.ai"
repository-code: "https://github.com/ENOT-AutoDL/onnx2torch"
license: "Apache-2.0"
keywords:
  - onnx
  - pytorch
  - convert
  - deep learning
  - machine learning

GitHub Events

Total
  • Issues event: 10
  • Watch event: 88
  • Issue comment event: 9
  • Fork event: 12
Last Year
  • Issues event: 10
  • Watch event: 88
  • Issue comment event: 9
  • Fork event: 12

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 112
  • Total Committers: 22
  • Avg Commits per committer: 5.091
  • Development Distribution Score (DDS): 0.545
Past Year
  • Commits: 5
  • Committers: 3
  • Avg Commits per committer: 1.667
  • Development Distribution Score (DDS): 0.4
Top Committers
Name Email Commits
Arseny 8****6 51
ivkalgin i****n@g****m 15
irkjero p****s@m****u 11
niobeus 4****s 5
p.ivanov p****v@e****h 4
Zhiqiang Wang z****g@f****m 4
igor i****n@e****h 3
Chih-Hsuan Yen y****5@g****m 2
IvanovP p****v@e****m 2
Jan 1****g 2
Mason Ma m****9@g****m 2
SuperSecureHuman d****u@g****m 1
Monica Thieu m****u@e****u 1
Meilof Veeningen m****n@r****m 1
Chanran Kim s****n@g****m 1
Andrey Denisov 2****3 1
Adam St Arnaud a****m@g****i 1
agoncharenko1992 3****2 1
andreysher 3****r 1
cakeofwar42 D****8@y****u 1
karalinkw 1****w 1
tripleMu g****u@1****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 80
  • Total pull requests: 99
  • Average time to close issues: 2 months
  • Average time to close pull requests: 16 days
  • Total issue authors: 73
  • Total pull request authors: 28
  • Average comments per issue: 2.26
  • Average comments per pull request: 0.72
  • Merged pull requests: 76
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 11
  • Pull requests: 1
  • Average time to close issues: 27 days
  • Average time to close pull requests: 1 minute
  • Issue authors: 11
  • Pull request authors: 1
  • Average comments per issue: 0.27
  • Average comments per pull request: 1.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pzy2000 (2)
  • samedii (2)
  • senysenyseny16 (2)
  • lzu-zhanghr (2)
  • jonas-doevenspeck (2)
  • triple-Mu (2)
  • liuxin99 (1)
  • clh-b (1)
  • JohnConnor123 (1)
  • kdirkjan (1)
  • feanor21115 (1)
  • GotoHitori (1)
  • JohnMasoner (1)
  • KyleErnewein (1)
  • ecenurustun (1)
Pull Request Authors
  • senysenyseny16 (49)
  • ivkalgin (10)
  • JohnMasoner (6)
  • ranz-UAI (4)
  • irkjero (4)
  • zhiqwang (4)
  • karalinkw (3)
  • goelbenj (2)
  • kinjalpatel27 (2)
  • jan-haug (2)
  • ajstarna (2)
  • triple-Mu (2)
  • denisovap2013 (2)
  • eesoymilk (2)
  • rosemanmeilof (2)
Top Labels
Issue Labels
bug (13) feat (13) Stale (4) question (2) enhancement (1)
Pull Request Labels
feat (20) fix (10) enhancement (7) bug (5) refactoring (4) documentation (3) Stale (2)

Packages

  • Total packages: 6
  • Total downloads:
    • pypi 86,202 last-month
  • Total docker downloads: 211
  • Total dependent packages: 18
    (may contain duplicates)
  • Total dependent repositories: 44
    (may contain duplicates)
  • Total versions: 73
  • Total maintainers: 6
pypi.org: onnx2torch

ONNX to PyTorch converter

  • Documentation: https://onnx2torch.readthedocs.io/
  • License: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2023 ENOT LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  • Latest release: 1.5.15
    published over 1 year ago
  • Versions: 22
  • Dependent Packages: 17
  • Dependent Repositories: 44
  • Downloads: 62,232 Last month
  • Docker Downloads: 211
Rankings
Dependent packages count: 0.8%
Average: 1.9%
Downloads: 2.1%
Dependent repos count: 2.2%
Docker downloads count: 2.5%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/ENOT-AutoDL/onnx2torch
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/enot-autodl/onnx2torch
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.8%
Last synced: 6 months ago
pypi.org: modlee-onnx2torch

ONNX to PyTorch converter

  • Documentation: https://modlee-onnx2torch.readthedocs.io/
  • License: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2023 ENOT LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  • Latest release: 1.5.15
    published over 1 year ago
  • Versions: 3
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 52 Last month
Rankings
Stargazers count: 3.7%
Forks count: 7.3%
Dependent packages count: 9.6%
Average: 21.0%
Dependent repos count: 63.4%
Last synced: 6 months ago
pypi.org: onnx2torch-py313

ONNX to PyTorch converter

  • Documentation: https://onnx2torch-py313.readthedocs.io/
  • License: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2023 ENOT LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  • Latest release: 1.6.0
    published 11 months ago
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 23,918 Last month
Rankings
Dependent packages count: 9.3%
Average: 30.9%
Dependent repos count: 52.5%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: onnx2torch
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Stargazers count: 22.6%
Dependent repos count: 34.0%
Forks count: 35.4%
Average: 35.8%
Dependent packages count: 51.2%
Last synced: 6 months ago

Dependencies

.github/workflows/lint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • isort/isort-action master composite
  • psf/black stable composite
.github/workflows/stale.yml actions
  • actions/stale v5 composite
requirements.txt pypi
  • numpy >=1.16.4
  • onnx >=1.9.0
  • torch >=1.8.0
  • torchvision >=0.9.0
test-requirements.txt pypi
  • Pillow * test
  • googledrivedownloader * test
  • onnxruntime * test
  • pytest * test
  • requests * test