-
Notifications
You must be signed in to change notification settings - Fork 13
Onnx model testing v2 #39
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
base: main
Are you sure you want to change the base?
Conversation
- Add model_redundant.onnx: Simple model with redundant layers - Add model_wrong_dimension.onnx: Model mixing 1D/2D operations - Add model_supported_weird.onnx: Architecturally weird but uses only supported ops - Add generation scripts for reproducing models - Add test file for model_redundant Models test different failure modes: - ONNX export limitations - JSTProve operation support gaps (Tanh/Sigmoid unsupported) - Integration framework edge cases
HudsonGraeme
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks 🔥!!
Left some small comments mostly about paths and newlines 😄
| import os | ||
|
|
||
| # Add the models directory to Python path | ||
| sys.path.append('/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preference to use a relative abs path when possible; this will allow anyone who pulls the repo to easily run the scripts without needing to meddle with the path :)
| sys.path.append('/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx') | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'models', 'models_onnx'))) |
| except Exception as e: | ||
| print(f"❌ Error: {e}") | ||
| import traceback | ||
| traceback.print_exc() No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you open this file in the files tab you may note this do not enter sign; it indicates the file isn't POSIX compliant due to the lack of newline at the end. This is not really a big deal since we're no longer in the 19th century but still preferable to include a newline at the end if possible :)
| input_tensor = torch.randn(1, 1, 28, 28) | ||
| input_numpy = input_tensor.numpy() | ||
|
|
||
| session = ort.InferenceSession("/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx/model_conv2d.onnx") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| session = ort.InferenceSession("/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx/model_conv2d.onnx") | |
| session = ort.InferenceSession(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'models', 'models_onnx', 'model_conv2d.onnx'))) |
| import sys | ||
|
|
||
| # Add the models directory to Python path | ||
| sys.path.append('/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| sys.path.append('/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx') | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'models', 'models_onnx')) |
| import sys | ||
|
|
||
| # Add the models directory to Python path | ||
| sys.path.append('/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| sys.path.append('/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx') | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'models', 'models_onnx')) |
| output_data = output.detach().numpy().tolist() | ||
|
|
||
| print("Creating output directory...") | ||
| io_dir = "python/testing/core/input_output_data/model_wrong_dimension/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| io_dir = "python/testing/core/input_output_data/model_wrong_dimension/" | |
| io_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'testing', 'core', 'input_output_data', 'model_wrong_dimension') |
|
|
||
| def test_conv2d_model_output(): | ||
| # Paths - using relative paths since files are in the same directory as the test | ||
| onnx_model_path = "python/models/models_onnx/model_conv2d.onnx" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| onnx_model_path = "python/models/models_onnx/model_conv2d.onnx" | |
| onnx_model_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'models', 'models_onnx', 'model_conv2d.onnx') |
| import sys | ||
|
|
||
| # Add the models directory to Python path | ||
| sys.path.append('/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| sys.path.append('/Users/elenapashkova/GravyTesting-Internal/python/models/models_onnx') | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'models', 'models_onnx'))) |
|
|
||
| try: | ||
| print("Importing RedundantModel...") | ||
| from redundant_layers_model import RedundantModel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this one might be left out of the commit too or potentially I missed it somehow again too
|
|
||
| print("Creating output directory...") | ||
| # Save input/output | ||
| io_dir = "python/testing/core/input_output_data/model_redundant/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| io_dir = "python/testing/core/input_output_data/model_redundant/" | |
| io_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'testing', 'core', 'input_output_data', 'model_redundant') |
Description
Created multiple unconventional neural network models to stress-test the JSTProve system and identify integration limitations. The models successfully test different failure modes in the PyTorch → ONNX → JSTProve pipeline, discovering actual system limitations including unsupported operations (Tanh/Sigmoid) and ONNX export edge cases.
Added three ONNX models with varying levels of architectural weirdness:
Related Issue
Key Findings
Integration Framework Validation
Note:
Expected behavior: model_redundant and model_supported_weird should pass, model_wrong_dimension will fail at JSTProve compilation due to unsupported operations