Intel Gpu support initialization (#4340)

This commit is contained in:
Abhilash Majumder 2023-10-27 08:09:51 +05:30 committed by GitHub
parent 317e2c857e
commit 778a010df8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 106 additions and 42 deletions

View file

@ -4,10 +4,10 @@ from pathlib import Path
import gradio as gr
import torch
import yaml
from transformers import is_torch_xpu_available
from modules import shared
with open(Path(__file__).resolve().parent / '../css/NotoSans/stylesheet.css', 'r') as f:
css = f.read()
with open(Path(__file__).resolve().parent / '../css/main.css', 'r') as f:
@ -85,9 +85,12 @@ def list_model_elements():
'rope_freq_base',
'numa',
]
for i in range(torch.cuda.device_count()):
elements.append(f'gpu_memory_{i}')
if is_torch_xpu_available():
for i in range(torch.xpu.device_count()):
elements.append(f'gpu_memory_{i}')
else:
for i in range(torch.cuda.device_count()):
elements.append(f'gpu_memory_{i}')
return elements