code: def test_pegasus_xsum_summary(self):
      assert self.tokenizer.model_max_length == 512
      inputs = self.tokenizer(
          self.src_text,
          return_tensors="pt",
          truncation=True,
          max_length=512,
          padding=True,
      ).to(torch_device)
      assert inputs.input_ids.shape == (2, 421)
      translated_tokens = self.model.generate(**inputs, num_beams=2)
      decoded = self.tokenizer.batch_decode(
          translated_tokens, skip_special_tokens=True
      )
      assert self.tgt_text == decoded
  
      self.model.half()
      translated_tokens_fp16 = self.model.generate(
          **inputs, max_length=10
      )
      decoded_fp16 = self.tokenizer.batch_decode(
          translated_tokens_fp16, skip_special_tokens=True
      )
      assert decoded_fp16 == [
          "California's largest electricity provider has begun",
          "N-Dubz have revealed they were",
      ]
  
imports: import tempfile
  import unittest
  from transformers import PegasusConfig, is_torch_available
  from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, require_torch_fp16, slow, torch_device
  from transformers.utils import cached_property
  from ...generation.test_utils import GenerationTesterMixin
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, ids_tensor
  from ...test_pipeline_mixin import PipelineTesterMixin
  from ..mbart.test_modeling_mbart import AbstractSeq2SeqIntegrationTest
label_desc: Use image node_id 2 for calling the PegasusXSUMIntegrationTest obj's underlying member method code with example usage: obj.test_pegasus_xsum_summary() without return types