Skip to content

Conversation

@pan93412
Copy link
Contributor

@pan93412 pan93412 commented Aug 8, 2022

Abstract

This PR allows us passing the torch.device constructed by ourselves, which is useful in using mps 1 as the backend instead of CUDA's.

Usage

device = torch.device("mps")
ws_driver = CkipWordSegmenter(model="bert-base", device=device)

Tests

I have tested in my Apple Silicon device, with the nightly version of PyTorch.
It works as intended without any observable bugs.

Footnotes

  1. https://pytorch.org/docs/stable/notes/mps.html

Abstract
======

This PR allows us passing the `torch.device` constructed by ourselves,
which is useful in using `mps` ([^1]) as the backend instead of CUDA's.

[^1] https://pytorch.org/docs/stable/notes/mps.html

Usage
=====

```py
device = torch.device("mps")
ws_driver  = CkipWordSegmenter(model="bert-base", device=device)
```

Tests
====

I have tested in my Apple Silicon device, with the nightly version of PyTorch.
It works as intended without any observable bugs.
@pan93412
Copy link
Contributor Author

pan93412 commented Aug 8, 2022

Screenshots

image

image

image

@emfomy emfomy changed the base branch from master to develop August 10, 2022 05:37
@emfomy emfomy self-requested a review August 10, 2022 05:37
@emfomy emfomy self-assigned this Aug 10, 2022
@emfomy emfomy added Priority: Medium third priority Status: 1-Assigned assigned an assignee Type: Enhancement request new feature labels Aug 10, 2022
@emfomy emfomy added this to the 0.3.0 milestone Aug 10, 2022
@emfomy emfomy merged commit 5258227 into ckiplab:develop Aug 10, 2022
@emfomy
Copy link
Member

emfomy commented Aug 10, 2022

Great PR!

@pan93412 pan93412 deleted the patch-1 branch August 10, 2022 05:52
@emfomy emfomy added Status: 3-Completed finished and removed Status: 1-Assigned assigned an assignee labels Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Medium third priority Status: 3-Completed finished Type: Enhancement request new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants