-
Notifications
You must be signed in to change notification settings - Fork 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
⚡️Add torch.compile
Functionality
#716
base: develop
Are you sure you want to change the base?
Conversation
torch.compile
functionality
for more information, see https://pre-commit.ci
tiatoolbox/utils/misc.py
Outdated
Returns: | ||
A tuple containing the result of the function | ||
and the time taken to execute it in seconds. | ||
""" |
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.
""" | |
""" |
tests/test_wsi_registration.py
Outdated
@@ -21,10 +23,32 @@ | |||
RNG = np.random.default_rng() # Numpy Random Generator | |||
|
|||
|
|||
def test_extract_features(dfbr_features: Path) -> None: | |||
def test_extract_features_time(dfbr_features: Path, test_count: int = 25) -> None: |
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.
Is this the right place to add this test?
https://github.com/pytorch/pytorch/releases/tag/v2.1.0 PyTorch 2.1 now supports torch.compile in Python 3.11 |
torch.compile
functionality torch.compile
Functionality
…eAnalytics/tiatoolbox into enhance-torch-compile
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #716 +/- ##
========================================
Coverage 99.86% 99.86%
========================================
Files 69 69
Lines 8656 8675 +19
Branches 1653 1655 +2
========================================
+ Hits 8644 8663 +19
Misses 4 4
Partials 8 8 ☔ View full report in Codecov by Sentry. |
* ⚡️ Add `torch.compile` to `PatchPredictor` * 🚨 Remove unused imports * 🐛 Add `rcParam` import * ✅ Add `torch.compile` tests * ✅ Change to a more generic test * 📝 Update test docstring * ⚡️ Reset `TorchDynamo` when changing `torch.compile` mode * 👷 Enable CI checks * 👷 Add python package checks * 🚑 Disable `torch.compile` in Python 3.12+ * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * 🔥 Remove `compile_model` decorator mode for now * 🐛 Fix a bug where a compatbility warning is shown if torch.compile is disabled * 🚸 Check if model is compiled before compiling * 🚨 Disable protected member access check * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * 🚨 Fix `pre-commit.ci` linting * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * 🚨 Fix another linter error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * 📝 Add comment above version check for `torch.compile` * 🚨 Remove unnecessary noqa * ✅ Add test to check if model is already compiled * ✅ Skip test coverage for for checking for python 3.12 --------- Co-authored-by: Abdol A <u2271662@live.warwick.ac.uk> Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
Updating PR to fix issues with |
- Refines `torch.compile` implementation in TIAToolbox - Adds the functionality to `DFBRFeatureExtractor`.
@Abdol With PyTorch 2.3 release, please can you check if it is compatible with Python 3.12? |
@shaneahmed according to release notes, PyTorch 2.3 still does not fully support Python 3.12 including torch.compile. They plan to support it in 2.4. |
@Abdol @shaneahmed, PyTorch 2.4 now supports Python 3.12 for |
Will get back to this PR from next week. |
This draft PR involves integrating PyTorch 2.0's torch.compile functionality to demonstrate performance improvements in torch code. This PR focuses on adding
torch.compile
toPatchPredictor
.Notes:
Python 3.11+ is not yet supported forUPDATE: Python 3.11 support was added in PyTorch 2.1torch.compile