mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 17:29:22 +01:00
Check for torch.xpu.is_available()
This commit is contained in:
parent
188d20e9e5
commit
8ea554bc19
@ -151,8 +151,15 @@ def huggingface_loader(model_name):
|
|||||||
|
|
||||||
# Load with quantization and/or offloading
|
# Load with quantization and/or offloading
|
||||||
else:
|
else:
|
||||||
if not any((shared.args.cpu, torch.cuda.is_available(), torch.backends.mps.is_available())):
|
conditions = [
|
||||||
logger.warning('torch.cuda.is_available() returned False. This means that no GPU has been detected. Falling back to CPU mode.')
|
shared.args.cpu,
|
||||||
|
torch.cuda.is_available(),
|
||||||
|
torch.backends.mps.is_available(),
|
||||||
|
hasattr(torch, 'xpu') and torch.xpu.is_available(),
|
||||||
|
]
|
||||||
|
|
||||||
|
if not any(conditions):
|
||||||
|
logger.warning('No GPU has been detected by Pytorch. Falling back to CPU mode.')
|
||||||
shared.args.cpu = True
|
shared.args.cpu = True
|
||||||
|
|
||||||
if shared.args.cpu:
|
if shared.args.cpu:
|
||||||
|
Loading…
Reference in New Issue
Block a user