code: def test_inference_block_sparse_pretraining(self):
      model = BigBirdForPreTraining.from_pretrained(
          "google/bigbird-roberta-base", attention_type="block_sparse"
      )
      model.to(torch_device)
  
      input_ids = torch.tensor(
          [[20920, 232, 328, 1437] * 1024],
          dtype=torch.long,
          device=torch_device,
      )
      with torch.no_grad():
          outputs = model(input_ids)
      prediction_logits = outputs.prediction_logits
      seq_relationship_logits = outputs.seq_relationship_logits
  
      self.assertEqual(
          prediction_logits.shape, torch.Size((1, 4096, 50358))
      )
      self.assertEqual(
          seq_relationship_logits.shape, torch.Size((1, 2))
      )
  
      expected_prediction_logits_slice = torch.tensor(
          [
              [-0.5583, 0.0475, -0.2508, 7.4423],
              [0.7409, 1.4460, -0.7593, 7.7010],
              [1.9150, 3.1395, 5.8840, 9.3498],
              [-0.1854, -1.4640, -2.2052, 3.7968],
          ],
          device=torch_device,
      )
  
      self.assertTrue(
          torch.allclose(
              prediction_logits[0, 128:132, 128:132],
              expected_prediction_logits_slice,
              atol=1e-4,
          )
      )
  
      expected_seq_relationship_logits = torch.tensor(
          [[46.9465, 47.9517]], device=torch_device
      )
      self.assertTrue(
          torch.allclose(
              seq_relationship_logits,
              expected_seq_relationship_logits,
              atol=1e-4,
          )
      )
  
imports: import unittest
  from transformers import BigBirdConfig, is_torch_available
  from transformers.models.auto import get_values
  from transformers.models.big_bird.tokenization_big_bird import BigBirdTokenizer
  from transformers.testing_utils import require_torch, slow, torch_device
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 2 for calling the BigBirdModelIntegrationTest obj's underlying member method code with example usage: obj.test_inference_block_sparse_pretraining() without return types