Skip to content

Feat/onnx support #2620

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

Merged
merged 22 commits into from
Feb 19, 2025
Merged

Feat/onnx support #2620

merged 22 commits into from
Feb 19, 2025

Conversation

madtoinou
Copy link
Collaborator

@madtoinou madtoinou commented Dec 17, 2024

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses.
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Fixes #553, fixes #2617.

Summary

  • Small refactoring of the _process_input_batch and _get_batch_prediction() methods to make the behavior uniform across PLModules
  • Added to_onnx method to the TorchForecastingModel class, taking care of creating the input_names and input_sample based on the model attributes
  • Added a section in the User Guide to show how to export and load the model to generate forecasts

Other Information

The consistency of the forecasts was tested in a notebook for all the possible configurations, I did not implement unit-test as onnx should remain an optional dependency. Let me know what you think.

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 52.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 94.12%. Comparing base (3aa5c97) to head (17711b7).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...arts/models/forecasting/torch_forecasting_model.py 7.69% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2620      +/-   ##
==========================================
- Coverage   94.27%   94.12%   -0.15%     
==========================================
  Files         141      141              
  Lines       15552    15569      +17     
==========================================
- Hits        14661    14654       -7     
- Misses        891      915      +24     

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

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

Very cool feature, thanks a lot @madtoinou 🚀 Looks like we're close already to merge :)

I had a couple of suggestions regarding the example and the export logic, where I see potential to simplify things further.

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

Looks great now, thanks a lot for changes 🚀 Love this PR 😍

@dennisbader dennisbader merged commit cda8f81 into master Feb 19, 2025
9 checks passed
@dennisbader dennisbader deleted the feat/onnx_support branch February 19, 2025 16:04
@dennisbader dennisbader moved this from Done to Released in darts Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

How do I export a darts' TCNModel to ONNX? ONNX Support
2 participants