sc2_datasets.torch.datasets.sc2_dataset ======================================= .. py:module:: sc2_datasets.torch.datasets.sc2_dataset Classes ------- .. autoapisummary:: sc2_datasets.torch.datasets.sc2_dataset.SC2Dataset Module Contents --------------- .. py:class:: SC2Dataset(names_urls: list[sc2_datasets.available_replaypacks.DatasetProperties], unpack_dir: pathlib.Path | str = Path('./data/unpack').resolve(), download_dir: pathlib.Path | str = Path('./data/download').resolve(), download: bool = True, unpack_n_workers: int = 16, transform: Callable | None = None, validator: Callable | None = None) Bases: :py:obj:`torch.utils.data.Dataset` Inherits from PyTorch Dataset and ensures that the dataset for SC2EGSet is downloaded. :param names_urls: Specifies the URL of the dataset which will be used to download the files. :type names_urls: list[DatasetProperties] :param unpack_dir: Specifies the path of a directory where the dataset files will be unpacked. :type unpack_dir: Path | str :param download_dir: Specifies the path of a directory where the dataset files will be downloaded. :type download_dir: Path | str :param unpack_n_workers: Specifies the number of workers that will be used for unpacking the archive, defaults to 16. :type unpack_n_workers: int, optional :param transform: PyTorch transform function that takes SC2ReplayData and returns something. :type transform: Func[SC2ReplayData, T] :param validator: Specifies the validation option for fetched data, defaults to None. :type validator: Callable | None, optional .. py:attribute:: transform :value: None .. py:attribute:: download_dir .. py:attribute:: unpack_dir .. py:attribute:: names_urls .. py:attribute:: download :value: True .. py:attribute:: unpack_n_workers :value: 16 .. py:attribute:: validator :value: None .. py:attribute:: skip_files :type: dict[str, set[str]] .. py:attribute:: len :value: 0 .. py:method:: ensure_downloaded() Ensures that the dataset was downloaded before accessing the __len__ or __getitem__ methods. .. py:method:: __len__() -> int Returns the number of items that are within the dataset .. py:method:: __getitem__(index: Any) -> tuple[Any, Any] | sc2_datasets.replay_data.sc2_replay_data.SC2ReplayData Exposes logic of getting a single parsed item by using dataset[index]. :param index: Specifies the index of an item that should be retrieved. :type index: Any :raises IndexError: To support negative indexing, if the index is less than zero twice, IndexError is raised. :raises IndexError: If the index is greater than length of the dataset, IndexError is raised. :returns: Returns a parsed SC2ReplayData from an underlying SC2ReplaypackDataset, or a result of a transform that was passed to the dataset. :rtype: tuple[Any, Any] | SC2ReplayData