code: def _test_batched_generate_captioning(
      self, config, input_ids, input_mask, pixel_values
  ):
      model = GitForCausalLM(config=config)
      model.to(torch_device)
      model.eval()
  
      # generate
      generated_ids = model.generate(
          input_ids=None,  # captioning -> no input_ids
          attention_mask=None,
          pixel_values=pixel_values,
          do_sample=False,
          max_length=20,
          num_beams=2,
          num_return_sequences=2,
      )
  
      self.parent.assertEqual(
          generated_ids.shape, (self.batch_size * 2, 20)
      )
  
imports: import inspect
  import unittest
  from huggingface_hub import hf_hub_download
  from transformers import GitConfig, GitProcessor, GitVisionConfig, is_torch_available, is_vision_available
  from transformers.models.auto import get_values
  from transformers.testing_utils import require_torch, require_vision, slow, torch_device
  from ...generation.test_utils import GenerationTesterMixin
  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 7 for calling the GitModelTester obj's underlying member method code with example usage: obj._test_batched_generate_captioning(config, input_ids, input_mask, pixel_values) without return types