-
Notifications
You must be signed in to change notification settings - Fork 92
🐛 Fix Multi-GPU Support with torch.compile
#923
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b271f3e
FIX: Update for multi-GPU support in models_abc
adamshephard cc5407a
UPD: Update code
adamshephard e124cd8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 698f16a
Merge branch 'develop' into models-abc-multigpu
adamshephard ee25842
Merge branch 'develop' into models-abc-multigpu
adamshephard 1f15307
Merge branch 'develop' into models-abc-multigpu
adamshephard e7b0822
FIX: Fix to work on other machines
adamshephard 0615636
FIX: Fix to work on other machines
adamshephard b830c11
Merge branch 'models-abc-multigpu' of https://github.com/TissueImageA…
adamshephard a1d7357
FIX: Fix to work on other machines
adamshephard 73440c2
Merge branch 'develop' into models-abc-multigpu
adamshephard b1d80dc
Merge branch 'models-abc-multigpu' of https://github.com/TissueImageA…
adamshephard 41a74aa
Merge branch 'develop' into models-abc-multigpu
adamshephard 56df269
Merge branch 'develop' into models-abc-multigpu
shaneahmed 9b7b24e
Merge branch 'models-abc-multigpu' of https://github.com/TissueImageA…
adamshephard f914933
Merge branch 'develop' into models-abc-multigpu
adamshephard 409498c
Merge branch 'models-abc-multigpu' of github.com:TissueImageAnalytics…
adamshephard f1d7cc4
UPD: Comment out cuda for coverage
adamshephard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -13,6 +13,7 @@ | |||||||
import joblib | ||||||||
import numpy as np | ||||||||
import torch | ||||||||
import torch.distributed as dist | ||||||||
import torch.multiprocessing as torch_mp | ||||||||
import torch.utils.data as torch_data | ||||||||
import tqdm | ||||||||
|
@@ -1421,6 +1422,14 @@ def predict( # noqa: PLR0913 | |||||||
logger.warning("Unable to remove %s", self._cache_dir) | ||||||||
|
||||||||
self._memory_cleanup() | ||||||||
from tiatoolbox.models.architecture.utils import is_torch_compile_compatible | ||||||||
|
||||||||
if ( | ||||||||
device == "cuda" | ||||||||
and torch.cuda.device_count() > 1 | ||||||||
and is_torch_compile_compatible() | ||||||||
): # pragma: no cover | ||||||||
dist.destroy_process_group() | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Destroying the process group without verifying initialization may error if no group exists. Add
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||
|
||||||||
return self._outputs | ||||||||
|
||||||||
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.