From 923a3aa7fa6fd590b001844d89052fd773ad8f66 Mon Sep 17 00:00:00 2001 From: smallv0221 <397551318@qq.com> Date: Tue, 22 Dec 2020 13:31:47 +0000 Subject: [PATCH] minor fix --- PaddleNLP/paddlenlp/datasets/dataset.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/PaddleNLP/paddlenlp/datasets/dataset.py b/PaddleNLP/paddlenlp/datasets/dataset.py index 6c5ae6d5..a44a84dd 100644 --- a/PaddleNLP/paddlenlp/datasets/dataset.py +++ b/PaddleNLP/paddlenlp/datasets/dataset.py @@ -201,31 +201,6 @@ class MapDatasetWrapper(Dataset): def __getattr__(self, name): return getattr(self.data, name) - def apply(self, fn, lazy=False): - """ - Performs specific function on the dataset to transform every sample. - Args: - fn (callable): Transformations to be performed. It receives single - sample as argument rather than dataset. - lazy (bool, optional): If True, transformations would be delayed and - performed on demand. Otherwise, transforms all samples at once - and return a new MapDatasetWrapper instance. Note that if `fn` is - stochastic, `lazy` should be True or you will get the same - result on all epochs. Defalt: False. - Returns: - MapDatasetWrapper: A new MapDatasetWrapper instance if `lazy` is True, \ - otherwise bind `fn` as a property to transform on demand. - """ - if lazy: - self._transform_func = fn - else: - applied_data = [fn(self.data[idx]) for idx in range(len(self.data))] - return type(self)(applied_data) - return self - - def __getattr__(self, name): - return getattr(self.data, name) - class TSVDataset(Dataset): """ -- GitLab