Skip to content

Commit f006ab7

Browse files
authored
fix(accelerator): Adding name method in XPUAccelerator (#3108)
* Update xpu.py regarind PR #3092 Added the name method to fix an issue related to a newly added feature in lightning 2.5.6 Signed-off-by: Niclas <152474825+waschsalz@users.noreply.github.com> * Update xpu.py Signed-off-by: Niclas <152474825+waschsalz@users.noreply.github.com> * Update xpu.py Signed-off-by: Niclas <152474825+waschsalz@users.noreply.github.com> * Update xpu.py with docstring Signed-off-by: Niclas <152474825+waschsalz@users.noreply.github.com> * Update xpu.py with correct docstring Signed-off-by: Niclas <152474825+waschsalz@users.noreply.github.com> * added name method for XPUAccelerator Signed-off-by: waschsalz <niclas.zschach@icloud.com> --------- Signed-off-by: Niclas <152474825+waschsalz@users.noreply.github.com> Signed-off-by: waschsalz <niclas.zschach@icloud.com>
1 parent 668760c commit f006ab7

File tree

1 file changed

+5
-2
lines changed
  • src/anomalib/engine/accelerator

1 file changed

+5
-2
lines changed

src/anomalib/engine/accelerator/xpu.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
class XPUAccelerator(Accelerator):
1313
"""Support for a XPU, optimized for large-scale machine learning."""
1414

15-
accelerator_name = "xpu"
15+
@property
16+
def name(self) -> str:
17+
"""Setting the name of the accelerator which is required for accelerators by pytorch-lightning >= 2.5.6."""
18+
return "xpu"
1619

1720
@staticmethod
1821
def setup_device(device: torch.device) -> None:
@@ -59,7 +62,7 @@ def teardown(self) -> None:
5962

6063

6164
AcceleratorRegistry.register(
62-
XPUAccelerator.accelerator_name,
65+
XPUAccelerator().name,
6366
XPUAccelerator,
6467
description="Accelerator supports XPU devices",
6568
)

0 commit comments

Comments
 (0)