sc2_datasets.torch.datasets.sc2_replaypack_dataset

Classes

SC2ReplaypackDatasetSingleJSON

SC2ReplaypackDataset

Represents a Dataset for a single pre-processed replaypack.

Module Contents

class SC2ReplaypackDatasetSingleJSON

Bases: torch.utils.data.Dataset

class SC2ReplaypackDataset(replaypack_name: str, unpack_dir: pathlib.Path | str, download_dir: pathlib.Path | str = Path(''), url: str = '', download: bool = False, unpack_n_workers: int = 16, transform: None | Callable = None, validator: None | Callable = None)

Bases: torch.utils.data.Dataset

Represents a Dataset for a single pre-processed replaypack.

Parameters:
  • replaypack_name (str) – Specifies the name of a replaypack. This can be a name of the tournament or any other arbitrary name.

  • unpack_dir (Path) – Specifies the directory where the archive will be extracted.

  • download_dir (Path) – Specifies the directory where the initial archive will be downloaded.

  • url (str, optional) – Specifies the URL which will be used to download the .zip archive, defaults to “”.

  • download (bool, optional) – Specifies if the dataset should be downloaded or if it is pre-downloaded and extracted, defaults to False.

  • unpack_n_workers (int, optional) – Specifies the number of workers that will be used for unpacking the archive, defaults to 16.

  • validator (Callable | dict, optional) – Specifies a validator for input data, defaults to None.

transform = None
unpack_n_workers = 16
download_dir
maybe_downloaded_zip_path
was_downloaded = False
unpack_dir
replaypack_name
url = ''
replaypack_unpack_path
skip_files
list_of_files = []
len = 0
__len__() int
__getitem__(index: int) sc2_datasets.replay_data.sc2_replay_data.SC2ReplayData

Exposes logic of getting a single parsed item from the replaypack.

Parameters:

index (int) – Specifies the index of a file that will be parsed and loaded into memory.

Returns:

Returns a parsed SC2ReplayData representation of a StarCraft 2 replay.

Return type:

SC2ReplayData

static from_args(args: dict[str, Any]) SC2ReplaypackDataset

Creates a SC2ReplaypackDataset object from a dictionary of arguments.

Parameters:

args (dict[str, Any]) – Specifies the dictionary of arguments that will be used to initialize the dataset.

Returns:

Returns a SC2ReplaypackDataset object initialized with the provided arguments.

Return type:

SC2ReplaypackDataset

property replaypack_summary: dict[str, Any]
property replaypack_dir_mapping: dict[str, str]
property replaypack_processed_failed: dict[str, list[str]]