code: def test_seq_to_seq_generation(self):
      hf = PegasusXForConditionalGeneration.from_pretrained(
          "google/pegasus-x-base-arxiv"
      ).to(torch_device)
      tok = PegasusTokenizer.from_pretrained("google/pegasus-x-base")
  
      batch_input = [
          "While large pretrained Transformer models have proven highly capable at tackling natural language tasks,"
          " handling long sequence inputs continues to be a significant challenge. One such task is long input"
          " summarization, where inputs are longer than the maximum input context of most pretrained models. Through"
          " an extensive set of experiments, we investigate what model architectural changes and pretraining"
          " paradigms can most efficiently adapt a pretrained Transformer for long input summarization. We find that"
          " a staggered, block-local Transformer with global encoder tokens strikes a good balance of performance"
          " and efficiency, and that an additional pretraining phase on long sequences meaningfully improves"
          " downstream summarization performance. Based on our findings, we introduce PEGASUS-X, an extension of the"
          " PEGASUS model with additional long input pretraining to handle inputs of up to 16K tokens. PEGASUS-X"
          " achieves strong performance on long input summarization tasks comparable with much larger models while"
          " adding few additional parameters and not requiring model parallelism to train."
      ]
  
      # The below article tests that we don't add any hypotheses outside of the top n_beams
      dct = tok.batch_encode_plus(
          batch_input,
          max_length=512,
          padding="max_length",
          truncation_strategy="only_first",
          truncation=True,
          return_tensors="pt",
      )
  
      hypotheses_batch = hf.generate(
          input_ids=dct["input_ids"].to(torch_device),
          attention_mask=dct["attention_mask"].to(torch_device),
          num_beams=2,
          max_length=32,
      )
  
      EXPECTED = [
          "we investigate the performance of a new pretrained model for long input summarization. <n> the model is a"
          " superposition of two well -"
      ]
  
      generated = tok.batch_decode(
          hypotheses_batch.tolist(),
          clean_up_tokenization_spaces=True,
          skip_special_tokens=True,
      )
      assert generated == EXPECTED
  
imports: import copy
  import math
  import tempfile
  import unittest
  from transformers import is_torch_available
  from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
  from transformers.utils import cached_property
  from ...generation.test_generation_utils import GenerationTesterMixin
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, ids_tensor
label_desc: Use image node_id 4 for calling the PegasusXModelIntegrationTests obj's underlying member method code with example usage: obj.test_seq_to_seq_generation() without return types