Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Fix xpu function not implemented p2. (#9027)

comfyanonymousa86a58c308c2
diff --git a/comfy/model_management.py b/comfy/model_management.py
index 746b063ed..42873d09b 100644
--- a/comfy/model_management.py
+++ b/comfy/model_management.py
@@ -1107,10 +1107,7 @@ def get_free_memory(dev=None, torch_free_too=False):
stats = torch.xpu.memory_stats(dev)
mem_active = stats['active_bytes.all.current']
mem_reserved = stats['reserved_bytes.all.current']
- if torch_version_numeric < (2, 6):
- mem_free_xpu = torch.xpu.get_device_properties(dev).total_memory - mem_reserved
- else:
- mem_free_xpu, _ = torch.xpu.mem_get_info(dev)
+ mem_free_xpu = torch.xpu.get_device_properties(dev).total_memory - mem_reserved
mem_free_torch = mem_reserved - mem_active
mem_free_total = mem_free_xpu + mem_free_torch
elif is_ascend_npu():