def s2s_dataset_from_json_or_file(
        self, input_data, train_mode, cached_features_file=None, local_rank=-1, top_n=-1
    ):
        """
        Converts input file or list of dictionaries to S2SAbsSumDataset.

        Args:
            input_data (str or list): Input file path or list of dictionaries.
                The input file should be in the following format:
                {"src": "abcdefg", "tgt": "ag"}
                {"src": "hijklmn", "tgt": "hn"}
                where the "src" field is the input text to summarize and the "tgt"
                field is the summary.
                The list of dictionaries should be in similar format:
                [{"src": "abcdefg", "tgt": "ag"},
                {"src": "hijklmn", "tgt": "hn"}]
                The "tgt" field is optional if `train_mode` is False.
            train_mode (bool): Whether the input data is for training or testing.
            cached_features_file (str, optional): Path of the cached features file.
                If provided and the file already exists, it is loaded and used.
                If provided and the file doesn't exist, processed features are
                saved to this file.
                If not provided, processed features are saved to cache_dir.
                Defaults to None.
            local_rank (int, optional): Local rank of the device in distributed
                training. Defaults to -1, which means non-distributed training.
            top_n (int, optional): The number which specifies how many examples in the
                beginning of the input dataset that will be used to create the dataset.
                Defaults to -1, which means the whole input data should be processsed.


        Returns:
            S2SAbsSumDataset
        """

        s2s_dataset = S2SAbsSumProcessor.create_s2s_dataset(
            examples=input_data,
            train_mode=train_mode,
            tokenizer=self.tokenizer,
            output_dir=self.cache_dir,
            local_rank=local_rank,
            cached_features_file=cached_features_file,
            top_n=top_n,
        )

        return s2s_dataset

        Converts input file or list of dictionaries to S2SAbsSumDataset.

        Args:
            input_data (str or list): Input file path or list of dictionaries.
                The input file should be in the following format:
                {"src": "abcdefg", "tgt": "ag"}
                {"src": "hijklmn", "tgt": "hn"}
                where the "src" field is the input text to summarize and the "tgt"
                field is the summary.
                The list of dictionaries should be in similar format:
                [{"src": "abcdefg", "tgt": "ag"},
                {"src": "hijklmn", "tgt": "hn"}]
                The "tgt" field is optional if `train_mode` is False.
            train_mode (bool): Whether the input data is for training or testing.
            cached_features_file (str, optional): Path of the cached features file.
                If provided and the file already exists, it is loaded and used.
                If provided and the file doesn't exist, processed features are
                saved to this file.
                If not provided, processed features are saved to cache_dir.
                Defaults to None.
            local_rank (int, optional): Local rank of the device in distributed
                training. Defaults to -1, which means non-distributed training.
            top_n (int, optional): The number which specifies how many examples in the
                beginning of the input dataset that will be used to create the dataset.
                Defaults to -1, which means the whole input data should be processsed.


        Returns:
            S2SAbsSumDataset
        
utils_nlp/models/transformers/abstractive_summarization_seq2seq.py