Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[add] modelExporters #8

Merged
merged 23 commits into from
Oct 9, 2023
Merged

[add] modelExporters #8

merged 23 commits into from
Oct 9, 2023

Conversation

amkrajewski
Copy link
Contributor

  • This PR introduces the modelExporters module with 3 Exporter classes, allowing conversion and saving of the loaded models (including ones modified within pySIPFENN transfer learning runs) into ONNX, PyTorch, and CoreML formats.
  • The ONNXExporter also allows for model conversion to FP16 precision, lowering the size by a factor of 2, as well as model simplification with the ONNX optimizer toolset.

@amkrajewski
Copy link
Contributor Author

TODO:

  • Testing the runtime of the 3 exporters
  • Usage examples in the docs.

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (45202a4) 92.20% compared to head (1cc47f2) 93.22%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
+ Coverage   92.20%   93.22%   +1.01%     
==========================================
  Files          12       14       +2     
  Lines        1181     1402     +221     
==========================================
+ Hits         1089     1307     +218     
- Misses         92       95       +3     
Files Coverage Δ
pysipfenn/__init__.py 100.00% <100.00%> (ø)
pysipfenn/core/pysipfenn.py 83.58% <100.00%> (+0.51%) ⬆️
pysipfenn/tests/test_ModelExporters.py 100.00% <100.00%> (ø)
pysipfenn/tests/test_pysipfenn.py 95.41% <100.00%> (ø)
pysipfenn/core/modelExporters.py 97.85% <97.85%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@jwsiegel2510 jwsiegel2510 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Copy link
Collaborator

@jwsiegel2510 jwsiegel2510 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if the calculator is empty it is not an error?

@amkrajewski
Copy link
Contributor Author

So if the calculator is empty it is not an error?

Based on the current PR state, it does raise an AssertionError with the message 'No models loaded in calculator. Nothing to export.'

I will add tests to verify these errors occur as intended.

@amkrajewski
Copy link
Contributor Author

I added the aforementioned tests and documentation page on why-and-how to use Exporters.

@amkrajewski amkrajewski merged commit d9fab8e into main Oct 9, 2023
29 checks passed
@amkrajewski amkrajewski deleted the add_ModelExporter branch October 11, 2023 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants