diff --git a/PaddleNLP/paddlenlp/datasets/dataset.py b/PaddleNLP/paddlenlp/datasets/dataset.py index 6c5ae6d51f29b323356ab2013333968085e97fbe..a44a84ddbd45f24c8d61a914e12b7d865a8fec6c 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): """