Intel Gpu support initialization (#4340)
This commit is contained in:
parent
317e2c857e
commit
778a010df8
14 changed files with 106 additions and 42 deletions
|
@ -2,6 +2,7 @@ from pathlib import Path
|
|||
|
||||
import torch
|
||||
from peft import PeftModel
|
||||
from transformers import is_torch_xpu_available
|
||||
|
||||
import modules.shared as shared
|
||||
from modules.logging_colors import logger
|
||||
|
@ -179,6 +180,9 @@ def add_lora_transformers(lora_names):
|
|||
if torch.backends.mps.is_available():
|
||||
device = torch.device('mps')
|
||||
shared.model = shared.model.to(device)
|
||||
elif is_torch_xpu_available():
|
||||
device = torch.device("xpu:0")
|
||||
shared.model = shared.model.to(device)
|
||||
else:
|
||||
shared.model = shared.model.cuda()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue