Add torch.compile support for neural network optimization#15
Merged
Conversation
Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
…pport Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Adding torch.compile
Add torch.compile support for neural network optimization
Aug 17, 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.
This PR adds support for PyTorch's
torch.compilefeature to autoBOT's neural networks, enabling JIT compilation for improved training and inference performance.Changes Made
Core Implementation
compile_modelparameter to theSFNNclass with defaultFalsefor backward compatibilitytorch_sparse_nn_ff_basichyperparameter configuration to includecompile_model: [False, True]torch.compile()to models inSFNN.fit()when compilation is enabledBug Fixes
predict_proba()method that caused unpacking errors when iterating over datasets without labelsTesting & Examples
tests/test_torch_compile.pywith 4 test cases covering:examples/minimal_torch_compile.pydemonstrating usage with both compiled and non-compiled modelsdocs/TORCH_COMPILE.mdwith detailed documentationUsage
Through Hyperparameter Configuration
Direct Usage
Benefits
Verification
All tests pass successfully, and compiled models show as
OptimizedModuleindicating torch.compile is working correctly. The hyperparameter optimization automatically explores compiled configurations when available.Fixes #14.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.