Use 'torch.backends.mps.is_available' to check if mps is supported (#3164)

This commit is contained in:
appe233 2023-07-18 08:27:18 +08:00 committed by GitHub
parent 234c58ccd1
commit 89e0d15cf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -132,7 +132,7 @@ def add_lora_transformers(lora_names):
if not shared.args.load_in_8bit and not shared.args.cpu:
shared.model.half()
if not hasattr(shared.model, "hf_device_map"):
if torch.has_mps:
if torch.backends.mps.is_available():
device = torch.device('mps')
shared.model = shared.model.to(device)
else: