Skip to content

Commit

Permalink
cuda takes priority
Browse files Browse the repository at this point in the history
  • Loading branch information
hkchengrex committed Dec 23, 2024
1 parent c8b5201 commit d294fb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def main():
mask_away_clip: bool = args.mask_away_clip

device = 'cpu'
if torch.backends.mps.is_available():
device = 'mps'
elif torch.cuda.is_available():
if torch.cuda.is_available():
device = 'cuda'
elif torch.backends.mps.is_available():
device = 'mps'
else:
log.warning('CUDA/MPS are not available, running on CPU')
dtype = torch.float32 if args.full_precision else torch.bfloat16
Expand Down
6 changes: 3 additions & 3 deletions gradio_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
log = logging.getLogger()

device = 'cpu'
if torch.backends.mps.is_available():
device = 'mps'
elif torch.cuda.is_available():
if torch.cuda.is_available():
device = 'cuda'
elif torch.backends.mps.is_available():
device = 'mps'
else:
log.warning('CUDA/MPS are not available, running on CPU')
dtype = torch.bfloat16
Expand Down

0 comments on commit d294fb8

Please sign in to comment.