code: def check_global_attention(self, config, inputs_dict):
      model = LEDModel(config=config).to(torch_device).eval()
      model.config.output_attentions = True
      attention_mask = ids_tensor(
          inputs_dict["input_ids"].shape, vocab_size=2
      )
      global_attention_mask = torch.zeros_like(attention_mask)
  
      # set some tokens to global_attention
      num_tokens_with_global_attention = 2
  
      attention_mask[:, 2 : 2 + num_tokens_with_global_attention] = 1
      global_attention_mask[
          :, 2 : 2 + num_tokens_with_global_attention
      ] = 1
      inputs_dict["attention_mask"] = attention_mask
      inputs_dict["global_attention_mask"] = global_attention_mask
  
      outputs = model(**inputs_dict)
      self.parent.assertIsNotNone(outputs.encoder_global_attentions)
  
      # setting `num_tokens_with_global_attention` to global_attentions yields
      # makes last dim to be of `num_tokens_with_global_attention`
      self.parent.assertTrue(
          outputs.encoder_global_attentions[0].shape,
          (
              self.batch_size,
              self.num_attention_heads,
              self.encoder_seq_length,
              num_tokens_with_global_attention,
          ),
      )
  
imports: import copy
  import tempfile
  import unittest
  from transformers import LEDConfig, is_torch_available
  from transformers.models.auto import get_values
  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 8 for calling the LEDModelTester obj's underlying member method code with example usage: obj.check_global_attention(config, inputs_dict) without return types