ComfyUI
ComfyUI copied to clipboard
ComfyUI enable intel xpu by mistake.
Expected Behavior
I dont install ipex in my computer, thus intel xpu should not be enabled.
Actual Behavior
In comfy\model_management.py, the initial value of xpu_available is:
xpu_available = int(torch_version[0]) < 2 or (int(torch_version[0]) == 2 and int(torch_version[2]) <= 4) # the result is true
So, in the step where the installation of ipex is checked:
try:
import intel_extension_for_pytorch as ipex
_ = torch.xpu.device_count()
xpu_available = torch.xpu.is_available()
except:
xpu_available = xpu_available or (hasattr(torch, "xpu") and torch.xpu.is_available())
If ipex is not install, code will go into the except block. In this way, the xpu_available will be true, leading to access of torch.xpu.current_device(), and cause the code to crash
Steps to Reproduce
just start comfyui without ipex
Debug Logs
Traceback (most recent call last):
File "E:\AI\ImageGenerate\ComfyUI\main.py", line 86, in <module>
import execution
File "E:\AI\ImageGenerate\ComfyUI\execution.py", line 13, in <module>
import nodes
File "E:\AI\ImageGenerate\ComfyUI\nodes.py", line 21, in <module>
import comfy.diffusers_load
File "E:\AI\ImageGenerate\ComfyUI\comfy\diffusers_load.py", line 3, in <module>
import comfy.sd
File "E:\AI\ImageGenerate\ComfyUI\comfy\sd.py", line 5, in <module>
from comfy import model_management
File "E:\AI\ImageGenerate\ComfyUI\comfy\model_management.py", line 139, in <module>
total_vram = get_total_memory(get_torch_device()) / (1024 * 1024)
File "E:\AI\ImageGenerate\ComfyUI\comfy\model_management.py", line 106, in get_torch_device
return torch.device("xpu", torch.xpu.current_device())
File "C:\Program Files\Python310\lib\site-packages\torch\__init__.py", line 1833, in __getattr__
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
AttributeError: module 'torch' has no attribute 'xpu'
Other
No response