Skip to content

Commit

Permalink
abhishekkrthakur#39 Support For Mac M1 GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
sounishnath003 authored Jun 17, 2022
1 parent e5f3c12 commit 7ad4472
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tez/model/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@dataclass
class TezConfig:
experiment_name = "default"
device: Optional[str] = "cuda" # cuda or cpu
device: Optional[str] = "cuda" # cuda or cpu or mps

# batch sizes
training_batch_size: Optional[int] = 32
Expand Down
3 changes: 3 additions & 0 deletions tez/model/tez.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def _configure_model(self):
if self.config.device == "cpu":
device = torch.device("cpu")
self.num_gpu = 0
elif self.config.device == "mps":
device = torch.device("mps:0")
self.num_gpu = 1
elif self.config.device == "cuda":
if torch.cuda.device_count() > 1:
if self.local_rank == -1:
Expand Down

0 comments on commit 7ad4472

Please sign in to comment.