Merged
Conversation
karinazad
reviewed
Jul 14, 2025
src/lobster/model/_ume.py
Outdated
| def export_onnx( | ||
| self, | ||
| export_path: str, | ||
| modality: ModalityType | Modality = Modality.SMILES, |
Collaborator
There was a problem hiding this comment.
nit: maybe we don't want to give a default for modality so we require users to specify?
karinazad
reviewed
Jul 14, 2025
Collaborator
There was a problem hiding this comment.
nit: should we keep the _onnx_utils.py pattern for filenames? I'd also be down to renaming everything not to have the underscore
karinazad
approved these changes
Jul 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces ONNX support for the UME model, enabling model export, inference, and benchmarking with ONNX Runtime. Key changes include the addition of ONNX utility functions, updates to the UME model for export compatibility, and a new example script demonstrating ONNX workflows.
ONNX Support Enhancements
ONNX Export and Forward Compatibility:
forwardandexport_onnxmethods to the UME model insrc/lobster/model/_ume.pyfor ONNX export and inference compatibility. These methods streamline the export process and ensure compatibility with PyTorch workflows.ONNX Utility Functions:
src/lobster/model/onnx_utils.pywith utility functions for ONNX inference (run_onnx_inference), output comparison (compare_onnx_pytorch), and performance benchmarking (benchmark_onnx_pytorch). These functions simplify ONNX workflows and provide tools for evaluating ONNX models against PyTorch implementations.Example and Documentation
examples/onnx_example.py, a comprehensive script demonstrating ONNX export, inference, comparison, and benchmarking for UME models. This script serves as a practical guide for users to understand and utilize ONNX features.Dependency Updates
pyproject.tomlto include theonnxruntimepackage, which is essential for running ONNX models.Testing Configuration
slow,integration, andunittests inpytest.ini, along with default options to run only fast tests. This improves test organization and execution control.Type of Change
Testing
Checklist