pyabsa.tasks.TextAdversarialDefense.dataset_utils.__classic__.data_utils_for_inference

Module Contents

Classes

GloVeTADInferenceDataset

An abstract class representing a Dataset.

class pyabsa.tasks.TextAdversarialDefense.dataset_utils.__classic__.data_utils_for_inference.GloVeTADInferenceDataset(config, tokenizer)[source]

Bases: torch.utils.data.Dataset

An abstract class representing a Dataset.

All datasets that represent a map from keys to data samples should subclass it. All subclasses should overwrite __getitem__(), supporting fetching a data sample for a given key. Subclasses could also optionally overwrite __len__(), which is expected to return the size of the dataset by many Sampler implementations and the default options of DataLoader. Subclasses could also optionally implement __getitems__(), for speedup batched samples loading. This method accepts list of indices of samples of batch and returns list of samples.

Note

DataLoader by default constructs an index sampler that yields integral indices. To make it work with a map-style dataset with non-integral indices/keys, a custom sampler must be provided.

parse_sample(text)[source]
prepare_infer_sample(text: str, ignore_error)[source]
prepare_infer_dataset(infer_file, ignore_error)[source]
process_data(samples, ignore_error=True)[source]
__getitem__(index)[source]
__len__()[source]