Skip to content

Commit

Permalink
add mps support
Browse files Browse the repository at this point in the history
  • Loading branch information
lich99 committed May 30, 2024
1 parent 934cbe3 commit b978e88
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChatTTS/utils/gpu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def select_device(min_memory = 2048):
if free_memory_mb < min_memory:
logger.log(logging.WARNING, f'GPU {selected_gpu} has {round(free_memory_mb, 2)} MB memory left.')
device = torch.device('cpu')
elif torch.backends.mps.is_available() and torch.backends.mps.is_built():
device = torch.device('mps')
else:
logger.log(logging.WARNING, f'No GPU found, use CPU instead')
device = torch.device('cpu')
Expand Down

0 comments on commit b978e88

Please sign in to comment.