Skip to content

feat: Implement Comprehensive ONNX Export Testing and Validation (#654)#660

Draft
SHIVANSH-ux-ys wants to merge 2 commits into
pytorch-tabular:mainfrom
SHIVANSH-ux-ys:feat/onnx-export-validation
Draft

feat: Implement Comprehensive ONNX Export Testing and Validation (#654)#660
SHIVANSH-ux-ys wants to merge 2 commits into
pytorch-tabular:mainfrom
SHIVANSH-ux-ys:feat/onnx-export-validation

Conversation

@SHIVANSH-ux-ys
Copy link
Copy Markdown

Description

This PR addresses #654 by implementing a robust validation rig for ONNX export. It moves the ONNX export functionality from "experimental" to a reliable feature by fixing several core bugs and adding comprehensive testing.

Key Changes:

  • Core Logic Fixes: Updated save_model_for_inference to handle dynamic batch sizes and feature configurations (only continuous, only categorical, or mixed).
  • State Management: Added explicit .eval() mode switching during export to ensure consistency.
  • Dynamic Axes Bug: Fixed a bug where only categorical inputs had dynamic axes, which caused issues for continuous-only models.
  • Dependency Formalization: Added onnx and onnxruntime to optional dependencies.
  • Robust Testing: Fixed a NameError in the test suite and updated test_save_for_inference_onnx to perform numerical validation comparing PyTorch and ONNX outputs.

Verification:

  • Verified logic for models with mixed, continuous-only, and categorical-only features.
  • Added onnx.checker validation during the export process.

Closes #654

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.

Implement Comprehensive ONNX Export Testing and Validation (save_model_for_inference)

1 participant