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

Bert fix + a bunch of refactoring #359

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Bert fix + a bunch of refactoring #359

wants to merge 3 commits into from

Conversation

renxida
Copy link
Contributor

@renxida renxida commented Oct 2, 2024

This includes everything from #357 and the following changes to make the runs fast and make the code (hopefully) easier to maintain:

  1. OnnxModelInfo class refactoring:

    • Added __slots__ to optimize memory usage
    • Introduced properties for model, ort_inference_session, ort_input_nodes, and ort_output_nodes
    • Lazy loading of ONNX model and inference session
    • Caching of input and output nodes
  2. Performance improvements:

    • Reduced redundant file existence checks and model loading
    • Optimized session creation and management
  3. Type hinting and imports:

    • Added List and final to imports from typing module
  4. Changes to helper classes:

    • Updated AzureDownloadableModel, SiblingModel, and TruncatedModel to work with the refactored OnnxModelInfo
    • Adjusted model path handling to use self._model instead of self.model in some cases
  5. Minor updates to other files:

    • Modified get_sample_inputs_for_onnx_model function to accept input nodes directly
    • Updated various model construction and input generation methods to work with the refactored classes
  6. Command-line argument change:

    • Updated help text for -t / --test-filter argument to indicate it uses regex filtering

These changes appear to focus on improving performance, reducing redundant operations, and making the code more maintainable through better encapsulation and lazy loading of resources.

- Implement lazy loading for ONNX models and inference sessions
- Add properties for model, session, and I/O nodes with caching
- Optimize helper classes to reduce redundant operations
- Update related functions for compatibility with refactored classes
- Improve -t/--test-filter argument description
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.

1 participant