    def from_system(cls) -> list[int]:
        """
        query nvidia gpu count, available on Windows and Linux
        """
        import pynvml  # type: ignore

        try:
            pynvml.nvmlInit()
            device_count = pynvml.nvmlDeviceGetCount()
            return list(range(device_count))
        except (
            pynvml.NVMLError_LibraryNotFound,
            pynvml.NVMLError_DriverNotLoaded,
            OSError,
        ):
            logger.debug("GPU not detected. Unable to initialize pynvml lib.")
            return []
        finally:
            try:
                pynvml.nvmlShutdown()
            except Exception:  # pylint: disable=broad-except
                pass
query nvidia gpu count, available on Windows and Linux
src/bentoml/_internal/resource.py