From 05cc499c08a0966d112ad8cb57f17bb988472823 Mon Sep 17 00:00:00 2001 From: ilisin Date: Thu, 29 Jun 2023 22:36:28 +0800 Subject: [PATCH] add GPU support on Mac --- rlcard/utils/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rlcard/utils/utils.py b/rlcard/utils/utils.py index 00fd7f7be..0bfebb031 100644 --- a/rlcard/utils/utils.py +++ b/rlcard/utils/utils.py @@ -19,7 +19,10 @@ def set_seed(seed): def get_device(): import torch - if torch.cuda.is_available(): + if torch.backends.mps.is_available(): + device = torch.device("mps:0") + print("--> Running on the GPU") + elif torch.cuda.is_available(): device = torch.device("cuda:0") print("--> Running on the GPU") else: