-
Notifications
You must be signed in to change notification settings - Fork 286
Add support for PyTorch Metal Performance Shaders #685
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
svlandeg
merged 17 commits into
explosion:features/pytorch-device
from
danieldk:torch-device-mps
Jun 10, 2022
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c88e43c
Add `test_slow_gpu` explosion-bot command
shadeMe 145d782
Auto-format code with black (#682)
github-actions[bot] 5a272c8
Add support for PyTorch Metal Performance Shaders
danieldk 2170bba
Test PyTorch wrapper with all xp ops
danieldk 6cc4d97
Azure: pin protobuf to fix Tensorflow
danieldk ff32729
Merge pull request #687 from explosion/fix-tensorflow-ciu
danieldk 9df55f9
Merge pull request #684 from shadeMe/feature/test-slow-gpu-bot
danieldk abf7d31
Extend typing_extensions to <4.2.0 (#689)
adrianeboyd a9e702e
Fix type checking error
danieldk 7ecce7d
Only back-off to NumpyOps on import error
danieldk 6e4dd90
Merge remote-tracking branch 'upstream/master' into torch-device-mps
danieldk 7f45d63
Merge remote-tracking branch 'upstream/features/pytorch-device' into …
danieldk 489ef22
Remove unneeded `has_torch_mps` bool
danieldk fd6f046
Add `has_gpu` bool and use it in `util`
danieldk 9626aa8
Replace another expression by has_gpu
danieldk 70ce061
Set `has_torch_gpu` to `has_torch_cuda_gpu`
danieldk d41b3cc
Update thinc/util.py
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
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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| from typing import TYPE_CHECKING | ||
| import numpy | ||
|
|
||
| from .. import registry | ||
| from . import NumpyOps, Ops | ||
|
|
||
| if TYPE_CHECKING: | ||
| # Type checking does not work with dynamic base classes, since MyPy cannot | ||
| # determine against which base class to check. So, always derive from Ops | ||
| # during type checking. | ||
| _Ops = Ops | ||
| else: | ||
| try: | ||
| from thinc_apple_ops import AppleOps | ||
|
|
||
| _Ops = AppleOps | ||
| except ImportError: | ||
| _Ops = NumpyOps | ||
|
|
||
|
|
||
| @registry.ops("MPSOps") | ||
| class MPSOps(_Ops): | ||
| """Ops class for Metal Performance shaders.""" | ||
|
|
||
| name = "mps" | ||
| xp = numpy | ||
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
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
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.