Use 'torch.backends.mps.is_available' to check if mps is supported (#3164)
This commit is contained in:
parent
234c58ccd1
commit
89e0d15cf5
3 changed files with 4 additions and 4 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue