-
Notifications
You must be signed in to change notification settings - Fork 192
Modernize codebase for PyTorch 2.8+ compatibility, fix deprecated API calls, and update sktime integration #76
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: master
Are you sure you want to change the base?
Conversation
… calls Co-authored-by: gzerveas <[email protected]>
| numpy>=1.19.2 | ||
| scikit-learn>=0.24.0 | ||
| protobuf>=3.17.3 | ||
| sktime>=0.10.0 |
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.
sktime>=0.10.0
The format in the datasets of sktime may have changed - has the code that loads and processes this data have been adapted accordingly?
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.
Yes, I've verified and updated the code for modern sktime compatibility. The load_from_tsfile_to_dataframe function moved from sktime.utils.load_data to sktime.datasets in newer versions. Updated the import in src/datasets/data.py and confirmed the function signature and data processing pipeline remain fully compatible. Commit f7f4b0c addresses this.
gzerveas
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.
Verify that the new version of sktime is compatible with the data processing pipeline
|
@copilot please consider the review comment |
…atasets Co-authored-by: gzerveas <[email protected]>
Addressed the sktime compatibility concern. Updated import location from |
Verified sktime data processing pipeline compatibility. The function moved from |
This PR modernizes the MVTS Transformer codebase to work with the latest PyTorch and Python versions while maintaining full backward compatibility. The changes address multiple critical issues reported by users trying to run the code with modern package versions.
Key Issues Fixed
PyTorch 2.8+ Compatibility Error
Fixed:
TypeError: forward() got an unexpected keyword argument 'is_causal'The custom
TransformerBatchNormEncoderLayerwas incompatible with PyTorch 2.8+ because newer versions pass anis_causalparameter to transformer layers that wasn't supported:Tensor Gradient Conversion Issues
Fixed:
RuntimeError: Can't call numpy() on Tensor that requires gradDuring evaluation, tensors with gradients were being converted to NumPy arrays without detaching:
Deprecated Optimizer API Calls
Fixed: Multiple deprecated function signatures in custom optimizers
Updated all deprecated PyTorch tensor operations to use modern API:
sktime Data Loading Compatibility
Fixed: Import errors with modern sktime versions
The
load_from_tsfile_to_dataframefunction moved in newer sktime versions:New Features
AdamW Optimizer Support
Added support for the widely-used AdamW optimizer with proper weight decay:
Modernized Dependencies
Updated
requirements.txtto use flexible version ranges instead of exact pins, improving compatibility:Code Quality Improvements
except:clauses withexcept Exception:for better error handling.format()to f-strings where appropriateTesting & Validation
Created comprehensive test suite covering:
All tests pass with PyTorch 2.8+, sktime 0.38+, and Python 3.12 while maintaining backward compatibility.
Migration Impact
Zero breaking changes - All existing code continues to work without modification. Users can immediately benefit from:
This modernization resolves issues reported in #68, #59, #48, #75, #24, and #67, ensuring the codebase remains usable with current and future package versions.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.