Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lightning/fabric/accelerators/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def remove(self, name: str) -> None:
"""Removes the registered accelerator by name."""
self.pop(name)

def available_accelerators(self) -> list[str]:
"""Returns a list of registered accelerators."""
return list(self.keys())
def available_accelerators(self) -> set[str]:
"""Returns a set of registered accelerators."""
return set(self.keys())

def __str__(self) -> str:
return "Registered Accelerators: {}".format(", ".join(self.available_accelerators()))
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_fabric/accelerators/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ def is_available():


def test_available_accelerators_in_registry():
assert ACCELERATOR_REGISTRY.available_accelerators() == ["cpu", "cuda", "mps", "tpu"]
assert ACCELERATOR_REGISTRY.available_accelerators() == {"cpu", "cuda", "mps", "tpu"}
2 changes: 1 addition & 1 deletion tests/tests_pytorch/accelerators/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def test_available_accelerators_in_registry():
"""Tests the accelerators available by default, not including external, third-party accelerators."""
available = set(AcceleratorRegistry.available_accelerators())
available = AcceleratorRegistry.available_accelerators()
expected = {"cpu", "cuda", "mps", "tpu"}
# Note: the registry is global, other tests may register new strategies as a side effect
assert expected.issubset(available)
Loading