from typing import AbstractSet
import pathlib


def get_available_gpus() -> AbstractSet[int]:
    """Return available gpu index numbers.

    Returns:
        AbstractSet[int]: index numbers of available GPUs

    """
    try:
        p = pathlib.Path("/proc/driver/nvidia/gpus")
        gpu_count = len(list(p.iterdir()))
    except FileNotFoundError:
        return frozenset()

    return frozenset(range(gpu_count))