
"""simple docstring"""






import inspect
import unittest

from transformers import ViTConfig
from transformers.testing_utils import (
    require_accelerate,
    require_torch,
    require_torch_gpu,
    require_vision,
    slow,
    torch_device,
)
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
					import torch
					from torch import nn

					from transformers import ViTForImageClassification, ViTForMaskedImageModeling, ViTModel
					from transformers.models.vit.modeling_vit import VIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
					from PIL import Image

					from transformers import ViTImageProcessor




class 				lowercase__:
	'''simple docstring'''

	def __init__(						self    :Tuple		, lowerCamelCase_    :Dict		, lowerCamelCase_    :List[str]=13		, lowerCamelCase_    :Tuple=30		, lowerCamelCase_    :Optional[int]=2		, lowerCamelCase_    :Dict=3		, lowerCamelCase_    :Dict=True		, lowerCamelCase_    :Tuple=True		, lowerCamelCase_    :Optional[int]=32		, lowerCamelCase_    :List[Any]=5		, lowerCamelCase_    :List[str]=4		, lowerCamelCase_    :Dict=37		, lowerCamelCase_    :int="gelu"		, lowerCamelCase_    :List[Any]=0.1		, lowerCamelCase_    :Optional[int]=0.1		, lowerCamelCase_    :str=10		, lowerCamelCase_    :List[Any]=0.0_2		, lowerCamelCase_    :Tuple=None		, lowerCamelCase_    :Optional[Any]=2		, )							->			List[Any]:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     List[Any]				= parent
			SCREAMING_SNAKE_CASE       :     Optional[Any]				= batch_size
			SCREAMING_SNAKE_CASE       :     Optional[int]				= image_size
			SCREAMING_SNAKE_CASE       :     Optional[int]				= patch_size
			SCREAMING_SNAKE_CASE       :     str				= num_channels
			SCREAMING_SNAKE_CASE       :     List[str]				= is_training
			SCREAMING_SNAKE_CASE       :     int				= use_labels
			SCREAMING_SNAKE_CASE       :     Optional[Any]				= hidden_size
			SCREAMING_SNAKE_CASE       :     List[str]				= num_hidden_layers
			SCREAMING_SNAKE_CASE       :     Dict				= num_attention_heads
			SCREAMING_SNAKE_CASE       :     Tuple				= intermediate_size
			SCREAMING_SNAKE_CASE       :     Optional[Any]				= hidden_act
			SCREAMING_SNAKE_CASE       :     Optional[int]				= hidden_dropout_prob
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= attention_probs_dropout_prob
			SCREAMING_SNAKE_CASE       :     List[str]				= type_sequence_label_size
			SCREAMING_SNAKE_CASE       :     List[Any]				= initializer_range
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= scope
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= encoder_stride

			# in ViT, the seq length equals the number of patches + 1 (we add 1 for the [CLS] token)
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= (image_size // patch_size) ** 2
			SCREAMING_SNAKE_CASE       :     List[str]				= num_patches + 1





	def   __lowerCAmelCase (						self    :Optional[int]					)							->			Tuple:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Any				= floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]					)

			SCREAMING_SNAKE_CASE       :     List[str]				= None
			if self.use_labels:
					SCREAMING_SNAKE_CASE       :     List[str]				= ids_tensor([self.batch_size]		, self.type_sequence_label_size					)

			SCREAMING_SNAKE_CASE       :     str				= self.get_config()

			return config, pixel_values, labels





	def   __lowerCAmelCase (						self    :int					)							->			List[str]:







			'''simple docstring'''




			return ViTConfig(
			    image_size=self.image_size		, patch_size=self.patch_size		, num_channels=self.num_channels		, hidden_size=self.hidden_size		, num_hidden_layers=self.num_hidden_layers		, num_attention_heads=self.num_attention_heads		, intermediate_size=self.intermediate_size		, hidden_act=self.hidden_act		, hidden_dropout_prob=self.hidden_dropout_prob		, attention_probs_dropout_prob=self.attention_probs_dropout_prob		, is_decoder=lowerCamelCase_		, initializer_range=self.initializer_range		, encoder_stride=self.encoder_stride		, )





	def   __lowerCAmelCase (						self    :Optional[Any]		, lowerCamelCase_    :List[Any]		, lowerCamelCase_    :Tuple		, lowerCamelCase_    :str					)							->			str:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= ViTModel(config=lowerCamelCase_					)
			model.to(lowerCamelCase_					)
			model.eval()
			SCREAMING_SNAKE_CASE       :     List[Any]				= model(lowerCamelCase_					)
			self.parent.assertEqual(result.last_hidden_state.shape		, (self.batch_size, self.seq_length, self.hidden_size)					)





	def   __lowerCAmelCase (						self    :List[str]		, lowerCamelCase_    :str		, lowerCamelCase_    :str		, lowerCamelCase_    :Tuple					)							->			List[Any]:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     List[str]				= ViTForMaskedImageModeling(config=lowerCamelCase_					)
			model.to(lowerCamelCase_					)
			model.eval()
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= model(lowerCamelCase_					)
			self.parent.assertEqual(
			    result.reconstruction.shape		, (self.batch_size, self.num_channels, self.image_size, self.image_size)					)

			# test greyscale images
			SCREAMING_SNAKE_CASE       :     int				= 1
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= ViTForMaskedImageModeling(lowerCamelCase_					)
			model.to(lowerCamelCase_					)
			model.eval()

			SCREAMING_SNAKE_CASE       :     Optional[int]				= floats_tensor([self.batch_size, 1, self.image_size, self.image_size]					)
			SCREAMING_SNAKE_CASE       :     int				= model(lowerCamelCase_					)
			self.parent.assertEqual(result.reconstruction.shape		, (self.batch_size, 1, self.image_size, self.image_size)					)





	def   __lowerCAmelCase (						self    :List[Any]		, lowerCamelCase_    :List[Any]		, lowerCamelCase_    :Dict		, lowerCamelCase_    :Dict					)							->			int:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= self.type_sequence_label_size
			SCREAMING_SNAKE_CASE       :     Tuple				= ViTForImageClassification(lowerCamelCase_					)
			model.to(lowerCamelCase_					)
			model.eval()
			SCREAMING_SNAKE_CASE       :     List[Any]				= model(lowerCamelCase_		, labels=lowerCamelCase_					)
			self.parent.assertEqual(result.logits.shape		, (self.batch_size, self.type_sequence_label_size)					)

			# test greyscale images
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= 1
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= ViTForImageClassification(lowerCamelCase_					)
			model.to(lowerCamelCase_					)
			model.eval()

			SCREAMING_SNAKE_CASE       :     List[str]				= floats_tensor([self.batch_size, 1, self.image_size, self.image_size]					)
			SCREAMING_SNAKE_CASE       :     List[Any]				= model(lowerCamelCase_					)
			self.parent.assertEqual(result.logits.shape		, (self.batch_size, self.type_sequence_label_size)					)







	def   __lowerCAmelCase (						self    :Tuple					)							->			Dict:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Optional[int]				= self.prepare_config_and_inputs()
			(
			    (
			    SCREAMING_SNAKE_CASE
			),					(
			    SCREAMING_SNAKE_CASE
			),					(
			    SCREAMING_SNAKE_CASE
			),					
			)       :     List[Any]				= config_and_inputs
			SCREAMING_SNAKE_CASE       :     Optional[Any]				= {'''pixel_values''': pixel_values}
			return config, inputs_dict





@require_torch
class 				lowercase__(				_UpperCAmelCase		,						_UpperCAmelCase		,						unittest.TestCase   ):
	'''simple docstring'''

	UpperCamelCase				=  (
	    (
	        ViTModel,
	        ViTForImageClassification,
	        ViTForMaskedImageModeling,
	    )
	    if is_torch_available()
	    else ()
	)
	UpperCamelCase				=  (
	    {"""feature-extraction""": ViTModel, """image-classification""": ViTForImageClassification}
	    if is_torch_available()
	    else {}
	)
	UpperCamelCase				=  True

	UpperCamelCase				=  False
	UpperCamelCase				=  False
	UpperCamelCase				=  False





	def   __lowerCAmelCase (						self    :Optional[int]					)							->			List[str]:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Dict				= ViTModelTester(self					)
			SCREAMING_SNAKE_CASE       :     Any				= ConfigTester(self		, config_class=lowerCamelCase_		, has_text_modality=lowerCamelCase_		, hidden_size=37					)





	def   __lowerCAmelCase (						self    :Tuple					)							->			Optional[Any]:







			'''simple docstring'''




			self.config_tester.run_common_tests()





	@unittest.skip(reason='''ViT does not use inputs_embeds'''					)
	def   __lowerCAmelCase (						self    :Tuple					)							->			Optional[Any]:







			'''simple docstring'''




			pass





	def   __lowerCAmelCase (						self    :Tuple					)							->			Union[str, Any]:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE,					SCREAMING_SNAKE_CASE       :     List[Any]				= self.model_tester.prepare_config_and_inputs_for_common()

			for model_class in self.all_model_classes:
					SCREAMING_SNAKE_CASE       :     Dict				= model_class(lowerCamelCase_					)
					self.assertIsInstance(model.get_input_embeddings()		, (nn.Module)					)
					SCREAMING_SNAKE_CASE       :     str				= model.get_output_embeddings()
					self.assertTrue(x is None or isinstance(lowerCamelCase_		, nn.Linear					)					)





	def   __lowerCAmelCase (						self    :Any					)							->			List[str]:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE,					SCREAMING_SNAKE_CASE       :     Dict				= self.model_tester.prepare_config_and_inputs_for_common()

			for model_class in self.all_model_classes:
					SCREAMING_SNAKE_CASE       :     str				= model_class(lowerCamelCase_					)
					SCREAMING_SNAKE_CASE       :     Union[str, Any]				= inspect.signature(model.forward					)
					# signature.parameters is an OrderedDict => so arg_names order is deterministic
					SCREAMING_SNAKE_CASE       :     Tuple				= [*signature.parameters.keys()]

					SCREAMING_SNAKE_CASE       :     Optional[int]				= ['''pixel_values''']
					self.assertListEqual(arg_names[:1]		, lowerCamelCase_					)





	def   __lowerCAmelCase (						self    :str					)							->			Optional[int]:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     List[Any]				= self.model_tester.prepare_config_and_inputs()
			self.model_tester.create_and_check_model(*lowerCamelCase_					)





	def   __lowerCAmelCase (						self    :int					)							->			Tuple:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Dict				= self.model_tester.prepare_config_and_inputs()
			self.model_tester.create_and_check_for_masked_image_modeling(*lowerCamelCase_					)





	def   __lowerCAmelCase (						self    :Optional[Any]					)							->			Dict:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Optional[Any]				= self.model_tester.prepare_config_and_inputs()
			self.model_tester.create_and_check_for_image_classification(*lowerCamelCase_					)







	@slow
	def   __lowerCAmelCase (						self    :Optional[Any]					)							->			List[Any]:







			'''simple docstring'''




			for model_name in VIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
					SCREAMING_SNAKE_CASE       :     Any				= ViTModel.from_pretrained(lowerCamelCase_					)
					self.assertIsNotNone(lowerCamelCase_					)





def __A						(   )->							Tuple:




		'''simple docstring'''






		SCREAMING_SNAKE_CASE       :     Union[str, Any]				= Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''     )
		return image




@require_torch
@require_vision
class 				lowercase__(				unittest.TestCase   ):
	'''simple docstring'''

	@cached_property
	def   __lowerCAmelCase (						self    :str					)							->			List[Any]:







			'''simple docstring'''




			return ViTImageProcessor.from_pretrained('''google/vit-base-patch16-224'''					) if is_vision_available() else None





	@slow
	def   __lowerCAmelCase (						self    :int					)							->			List[str]:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Tuple				= ViTForImageClassification.from_pretrained('''google/vit-base-patch16-224'''					).to(lowerCamelCase_					)

			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= self.default_image_processor
			SCREAMING_SNAKE_CASE       :     Optional[Any]				= prepare_img()
			SCREAMING_SNAKE_CASE       :     Optional[int]				= image_processor(images=lowerCamelCase_		, return_tensors='''pt'''					).to(lowerCamelCase_					)

			# forward pass
			with torch.no_grad():
					SCREAMING_SNAKE_CASE       :     int				= model(**lowerCamelCase_					)

			# verify the logits
			SCREAMING_SNAKE_CASE       :     List[str]				= torch.Size((1, 10_00)					)
			self.assertEqual(outputs.logits.shape		, lowerCamelCase_					)

			SCREAMING_SNAKE_CASE       :     int				= torch.tensor([-0.2_7_4_4, 0.8_2_1_5, -0.0_8_3_6]					).to(lowerCamelCase_					)

			self.assertTrue(torch.allclose(outputs.logits[0, :3]		, lowerCamelCase_		, atol=1E-4					)					)





	@slow
	def   __lowerCAmelCase (						self    :Optional[int]					)							->			Union[str, Any]:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Dict				= ViTModel.from_pretrained('''facebook/dino-vits8'''					).to(lowerCamelCase_					)

			SCREAMING_SNAKE_CASE       :     List[str]				= ViTImageProcessor.from_pretrained('''facebook/dino-vits8'''		, size=4_80					)
			SCREAMING_SNAKE_CASE       :     int				= prepare_img()
			SCREAMING_SNAKE_CASE       :     int				= image_processor(images=lowerCamelCase_		, return_tensors='''pt'''					)
			SCREAMING_SNAKE_CASE       :     int				= inputs.pixel_values.to(lowerCamelCase_					)

			# forward pass
			with torch.no_grad():
					SCREAMING_SNAKE_CASE       :     List[str]				= model(lowerCamelCase_		, interpolate_pos_encoding=lowerCamelCase_					)

			# verify the logits
			SCREAMING_SNAKE_CASE       :     str				= torch.Size((1, 36_01, 3_84)					)
			self.assertEqual(outputs.last_hidden_state.shape		, lowerCamelCase_					)

			SCREAMING_SNAKE_CASE       :     List[Any]				= torch.tensor(
			    [[4.2_3_4_0, 4.3_9_0_6, -6.6_6_9_2], [4.5_4_6_3, 1.8_9_2_8, -6.7_2_5_7], [4.4_4_2_9, 0.8_4_9_6, -5.8_5_8_5]]					).to(lowerCamelCase_					)

			self.assertTrue(torch.allclose(outputs.last_hidden_state[0, :3, :3]		, lowerCamelCase_		, atol=1E-4					)					)







	@slow
	@require_accelerate
	@require_torch_gpu
	def   __lowerCAmelCase (						self    :Dict					)							->			Dict:







			'''simple docstring'''




			SCREAMING_SNAKE_CASE       :     Optional[Any]				= ViTModel.from_pretrained('''facebook/dino-vits8'''		, torch_dtype=torch.floataa		, device_map='''auto'''					)
			SCREAMING_SNAKE_CASE       :     str				= self.default_image_processor

			SCREAMING_SNAKE_CASE       :     Optional[int]				= prepare_img()
			SCREAMING_SNAKE_CASE       :     int				= image_processor(images=lowerCamelCase_		, return_tensors='''pt'''					)
			SCREAMING_SNAKE_CASE       :     Any				= inputs.pixel_values.to(lowerCamelCase_					)

			# forward pass to make sure inference works in fp16
			with torch.no_grad():
					SCREAMING_SNAKE_CASE       :     Any				= model(lowerCamelCase_					)







"""simple docstring"""






from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import logging


if TYPE_CHECKING:
					from ...processing_utils import ProcessorMixin
					from ...utils import TensorType


lowerCamelCase__ :       Dict						     =			logging.get_logger(__name__)

lowerCamelCase__ :       Dict						     =			{
    "microsoft/layoutlmv3-base": "https://huggingface.co/microsoft/layoutlmv3-base/resolve/main/config.json",
}




class 				lowercase__(				_UpperCAmelCase   ):
	'''simple docstring'''

	UpperCamelCase				=  """layoutlmv3"""





	def __init__(						self    :str		, lowerCamelCase_    :Optional[Any]=5_02_65		, lowerCamelCase_    :Dict=7_68		, lowerCamelCase_    :Union[str, Any]=12		, lowerCamelCase_    :Optional[Any]=12		, lowerCamelCase_    :Union[str, Any]=30_72		, lowerCamelCase_    :Any="gelu"		, lowerCamelCase_    :Union[str, Any]=0.1		, lowerCamelCase_    :str=0.1		, lowerCamelCase_    :Any=5_12		, lowerCamelCase_    :int=2		, lowerCamelCase_    :Optional[Any]=0.0_2		, lowerCamelCase_    :Optional[int]=1E-5		, lowerCamelCase_    :Dict=1		, lowerCamelCase_    :int=0		, lowerCamelCase_    :Tuple=2		, lowerCamelCase_    :List[str]=10_24		, lowerCamelCase_    :Tuple=1_28		, lowerCamelCase_    :Any=1_28		, lowerCamelCase_    :Optional[Any]=True		, lowerCamelCase_    :str=32		, lowerCamelCase_    :int=1_28		, lowerCamelCase_    :int=64		, lowerCamelCase_    :List[Any]=2_56		, lowerCamelCase_    :Any=True		, lowerCamelCase_    :str=True		, lowerCamelCase_    :Union[str, Any]=True		, lowerCamelCase_    :List[str]=2_24		, lowerCamelCase_    :Dict=3		, lowerCamelCase_    :Union[str, Any]=16		, lowerCamelCase_    :Any=None		, **lowerCamelCase_    :Optional[Any]		, )							->			int:







			'''simple docstring'''




			super().__init__(
			    vocab_size=lowerCamelCase_		, hidden_size=lowerCamelCase_		, num_hidden_layers=lowerCamelCase_		, num_attention_heads=lowerCamelCase_		, intermediate_size=lowerCamelCase_		, hidden_act=lowerCamelCase_		, hidden_dropout_prob=lowerCamelCase_		, attention_probs_dropout_prob=lowerCamelCase_		, max_position_embeddings=lowerCamelCase_		, type_vocab_size=lowerCamelCase_		, initializer_range=lowerCamelCase_		, layer_norm_eps=lowerCamelCase_		, pad_token_id=lowerCamelCase_		, bos_token_id=lowerCamelCase_		, eos_token_id=lowerCamelCase_		, **lowerCamelCase_		, )
			SCREAMING_SNAKE_CASE       :     Optional[Any]				= max_ad_position_embeddings
			SCREAMING_SNAKE_CASE       :     List[Any]				= coordinate_size
			SCREAMING_SNAKE_CASE       :     Tuple				= shape_size
			SCREAMING_SNAKE_CASE       :     Optional[int]				= has_relative_attention_bias
			SCREAMING_SNAKE_CASE       :     List[Any]				= rel_pos_bins
			SCREAMING_SNAKE_CASE       :     int				= max_rel_pos
			SCREAMING_SNAKE_CASE       :     Any				= has_spatial_attention_bias
			SCREAMING_SNAKE_CASE       :     List[Any]				= rel_ad_pos_bins
			SCREAMING_SNAKE_CASE       :     Dict				= max_rel_ad_pos
			SCREAMING_SNAKE_CASE       :     Optional[int]				= text_embed
			SCREAMING_SNAKE_CASE       :     Any				= visual_embed
			SCREAMING_SNAKE_CASE       :     Any				= input_size
			SCREAMING_SNAKE_CASE       :     Tuple				= num_channels
			SCREAMING_SNAKE_CASE       :     List[str]				= patch_size
			SCREAMING_SNAKE_CASE       :     str				= classifier_dropout





class 				lowercase__(				_UpperCAmelCase   ):
	'''simple docstring'''

	UpperCamelCase				=  version.parse("""1.12"""   )





	@property
	def   __lowerCAmelCase (						self    :List[Any]					)							->			Mapping[str, Mapping[int, str]]:







			'''simple docstring'''




			if self.task in ["question-answering", "sequence-classification"]:
					return OrderedDict(
					    [
					        ('''input_ids''', {0: '''batch''', 1: '''sequence'''}),
					        ('''attention_mask''', {0: '''batch''', 1: '''sequence'''}),
					        ('''bbox''', {0: '''batch''', 1: '''sequence'''}),
					        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
					    ]					)
			else:
					return OrderedDict(
					    [
					        ('''input_ids''', {0: '''batch''', 1: '''sequence'''}),
					        ('''bbox''', {0: '''batch''', 1: '''sequence'''}),
					        ('''attention_mask''', {0: '''batch''', 1: '''sequence'''}),
					        ('''pixel_values''', {0: '''batch''', 1: '''num_channels'''}),
					    ]					)





	@property
	def   __lowerCAmelCase (						self    :Optional[int]					)							->			float:







			'''simple docstring'''




			return 1E-5





	@property
	def   __lowerCAmelCase (						self    :Tuple					)							->			int:







			'''simple docstring'''




			return 12







	def   __lowerCAmelCase (						self    :List[Any]		, lowerCamelCase_    :"ProcessorMixin"		, lowerCamelCase_    :int = -1		, lowerCamelCase_    :int = -1		, lowerCamelCase_    :bool = False		, lowerCamelCase_    :Optional["TensorType"] = None		, lowerCamelCase_    :int = 3		, lowerCamelCase_    :int = 40		, lowerCamelCase_    :int = 40		, )							->			Mapping[str, Any]:







			'''simple docstring'''




			setattr(processor.image_processor		, '''apply_ocr'''		, lowerCamelCase_					)

			# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
			SCREAMING_SNAKE_CASE       :     Dict				= compute_effective_axis_dimension(
			    lowerCamelCase_		, fixed_dimension=OnnxConfig.default_fixed_batch		, num_token_to_add=0					)
			# If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= processor.tokenizer.num_special_tokens_to_add(lowerCamelCase_					)
			SCREAMING_SNAKE_CASE       :     Any				= compute_effective_axis_dimension(
			    lowerCamelCase_		, fixed_dimension=OnnxConfig.default_fixed_sequence		, num_token_to_add=lowerCamelCase_					)
			# Generate dummy inputs according to compute batch and sequence
			SCREAMING_SNAKE_CASE       :     Union[str, Any]				= [[''' '''.join([processor.tokenizer.unk_token]					) * seq_length]] * batch_size

			# Generate dummy bounding boxes
			SCREAMING_SNAKE_CASE       :     int				= [[[48, 84, 73, 1_28]]] * batch_size

			# If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
			# batch_size = compute_effective_axis_dimension(batch_size, fixed_dimension=OnnxConfig.default_fixed_batch)
			SCREAMING_SNAKE_CASE       :     List[Any]				= self._generate_dummy_images(lowerCamelCase_		, lowerCamelCase_		, lowerCamelCase_		, lowerCamelCase_					)

			SCREAMING_SNAKE_CASE       :     int				= dict(
			    processor(
			        lowerCamelCase_		, text=lowerCamelCase_		, boxes=lowerCamelCase_		, return_tensors=lowerCamelCase_		, )					)

			return inputs





