



import collections
import inspect
import unittest

from transformers import FocalNetConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

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


if is_torch_available():
   import torch
   from torch import nn

   from transformers import (
       FocalNetBackbone,
       FocalNetForImageClassification,
       FocalNetForMaskedImageModeling,
       FocalNetModel,
   )
   from transformers.models.focalnet.modeling_focalnet import FOCALNET_PRETRAINED_MODEL_ARCHIVE_LIST

if is_vision_available():
   from PIL import Image

   from transformers import AutoImageProcessor


class 	lowerCamelCase__	:



 """simple docstring"""

 def __init__(    self					:					int			,						__lowerCAmelCase					:					Any			,						__lowerCAmelCase					:					Optional[int]=13			,						__lowerCAmelCase					:					List[Any]=32			,						__lowerCAmelCase					:					Dict=2			,						__lowerCAmelCase					:					Optional[int]=3			,						__lowerCAmelCase					:					Dict=16			,						__lowerCAmelCase					:					int=[32, 64, 1_28]			,						__lowerCAmelCase					:					Union[str, Any]=[1, 2, 1]			,						__lowerCAmelCase					:					Optional[int]=[2, 2, 4]			,						__lowerCAmelCase					:					Optional[int]=2			,						__lowerCAmelCase					:					Optional[Any]=2.0			,						__lowerCAmelCase					:					Any=True			,						__lowerCAmelCase					:					int=0.0			,						__lowerCAmelCase					:					Optional[Any]=0.0			,						__lowerCAmelCase					:					Tuple=0.1			,						__lowerCAmelCase					:					Dict="gelu"			,						__lowerCAmelCase					:					Tuple=False			,						__lowerCAmelCase					:					Optional[int]=True			,						__lowerCAmelCase					:					List[str]=0.02			,						__lowerCAmelCase					:					Union[str, Any]=1E-5			,						__lowerCAmelCase					:					Dict=True			,						__lowerCAmelCase					:					Optional[Any]=None			,						__lowerCAmelCase					:					int=True			,						__lowerCAmelCase					:					Any=10			,						__lowerCAmelCase					:					List[Any]=8			,						__lowerCAmelCase					:					int=["stage1", "stage2"]			,						__lowerCAmelCase					:					int=[1, 2]			,						)   ->	Dict:
    _A      =       parent
    _A      =       batch_size
    _A      =       image_size
    _A      =       patch_size
    _A      =       num_channels
    _A      =       embed_dim
    _A      =       hidden_sizes
    _A      =       depths
    _A      =       num_heads
    _A      =       window_size
    _A      =       mlp_ratio
    _A      =       qkv_bias
    _A      =       hidden_dropout_prob
    _A      =       attention_probs_dropout_prob
    _A      =       drop_path_rate
    _A      =       hidden_act
    _A      =       use_absolute_embeddings
    _A      =       patch_norm
    _A      =       layer_norm_eps
    _A      =       initializer_range
    _A      =       is_training
    _A      =       scope
    _A      =       use_labels
    _A      =       type_sequence_label_size
    _A      =       encoder_stride
    _A      =       out_features
    _A      =       out_indices

 def     snake_case_      (    self					:					int      )   ->	Tuple:
    _A      =       floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]      )

    _A      =       None
    if self.use_labels:
       _A      =       ids_tensor([self.batch_size]			,						self.type_sequence_label_size      )

    _A      =       self.get_config()

    return config, pixel_values, labels

 def     snake_case_      (    self					:					int      )   ->	Optional[Any]:
    return FocalNetConfig(
        image_size=self.image_size			,						patch_size=self.patch_size			,						num_channels=self.num_channels			,						embed_dim=self.embed_dim			,						hidden_sizes=self.hidden_sizes			,						depths=self.depths			,						num_heads=self.num_heads			,						window_size=self.window_size			,						mlp_ratio=self.mlp_ratio			,						qkv_bias=self.qkv_bias			,						hidden_dropout_prob=self.hidden_dropout_prob			,						attention_probs_dropout_prob=self.attention_probs_dropout_prob			,						drop_path_rate=self.drop_path_rate			,						hidden_act=self.hidden_act			,						use_absolute_embeddings=self.use_absolute_embeddings			,						path_norm=self.patch_norm			,						layer_norm_eps=self.layer_norm_eps			,						initializer_range=self.initializer_range			,						encoder_stride=self.encoder_stride			,						out_features=self.out_features			,						out_indices=self.out_indices			,						)

 def     snake_case_      (    self					:					Any			,						__lowerCAmelCase					:					str			,						__lowerCAmelCase					:					Dict			,						__lowerCAmelCase					:					Any      )   ->	Union[str, Any]:
    _A      =       FocalNetModel(config=snake_case_      )
    model.to(snake_case_      )
    model.eval()
    _A      =       model(snake_case_      )

    _A      =       ((config.image_size // config.patch_size) ** 2) // (4 ** (len(config.depths      ) - 1))
    _A      =       int(config.embed_dim * 2 ** (len(config.depths      ) - 1)      )

    self.parent.assertEqual(result.last_hidden_state.shape			,						(self.batch_size, expected_seq_len, expected_dim)      )

 def     snake_case_      (    self					:					str			,						__lowerCAmelCase					:					int			,						__lowerCAmelCase					:					int			,						__lowerCAmelCase					:					List[Any]      )   ->	Any:
    _A      =       FocalNetBackbone(config=snake_case_      )
    model.to(snake_case_      )
    model.eval()
    _A      =       model(snake_case_      )

    # verify feature maps
    self.parent.assertEqual(len(result.feature_maps      )			,						len(config.out_features      )      )
    self.parent.assertListEqual(list(result.feature_maps[0].shape      )			,						[self.batch_size, self.image_size, 8, 8]      )

    # verify channels
    self.parent.assertEqual(len(model.channels      )			,						len(config.out_features      )      )
    self.parent.assertListEqual(model.channels			,						config.hidden_sizes[:-1]      )

    # verify backbone works with out_features=None
    _A      =       None
    _A      =       FocalNetBackbone(config=snake_case_      )
    model.to(snake_case_      )
    model.eval()
    _A      =       model(snake_case_      )

    # verify feature maps
    self.parent.assertEqual(len(result.feature_maps      )			,						1      )
    self.parent.assertListEqual(list(result.feature_maps[0].shape      )			,						[self.batch_size, self.image_size * 2, 4, 4]      )

    # verify channels
    self.parent.assertEqual(len(model.channels      )			,						1      )
    self.parent.assertListEqual(model.channels			,						[config.hidden_sizes[-1]]      )

 def     snake_case_      (    self					:					Optional[int]			,						__lowerCAmelCase					:					Optional[int]			,						__lowerCAmelCase					:					List[Any]			,						__lowerCAmelCase					:					str      )   ->	List[str]:
    _A      =       FocalNetForMaskedImageModeling(config=snake_case_      )
    model.to(snake_case_      )
    model.eval()
    _A      =       model(snake_case_      )
    self.parent.assertEqual(
        result.reconstruction.shape			,						(self.batch_size, self.num_channels, self.image_size, self.image_size)      )

    # test greyscale images
    _A      =       1
    _A      =       FocalNetForMaskedImageModeling(snake_case_      )
    model.to(snake_case_      )
    model.eval()

    _A      =       floats_tensor([self.batch_size, 1, self.image_size, self.image_size]      )
    _A      =       model(snake_case_      )
    self.parent.assertEqual(result.reconstruction.shape			,						(self.batch_size, 1, self.image_size, self.image_size)      )

 def     snake_case_      (    self					:					int			,						__lowerCAmelCase					:					List[str]			,						__lowerCAmelCase					:					Optional[int]			,						__lowerCAmelCase					:					Optional[Any]      )   ->	str:
    _A      =       self.type_sequence_label_size
    _A      =       FocalNetForImageClassification(snake_case_      )
    model.to(snake_case_      )
    model.eval()
    _A      =       model(snake_case_			,						labels=snake_case_      )
    self.parent.assertEqual(result.logits.shape			,						(self.batch_size, self.type_sequence_label_size)      )

    # test greyscale images
    _A      =       1
    _A      =       FocalNetForImageClassification(snake_case_      )
    model.to(snake_case_      )
    model.eval()

    _A      =       floats_tensor([self.batch_size, 1, self.image_size, self.image_size]      )
    _A      =       model(snake_case_      )
    self.parent.assertEqual(result.logits.shape			,						(self.batch_size, self.type_sequence_label_size)      )

 def     snake_case_      (    self					:					Optional[int]      )   ->	Dict:
    _A      =       self.prepare_config_and_inputs()

    _A      =       config_and_inputs
    _A      =       {"""pixel_values""": pixel_values}
    return config, inputs_dict


@require_torch
class 	lowerCamelCase__	(       _a							,  _a							,  unittest.TestCase):



 """simple docstring"""

 a__					: List[str] =  (
     (
         FocalNetModel,
         FocalNetForImageClassification,
         FocalNetForMaskedImageModeling,
         FocalNetBackbone,
     )
     if is_torch_available()
     else ()
 )
 a__					: List[Any] =  (
     {"feature-extraction": FocalNetModel, "image-classification": FocalNetForImageClassification}
     if is_torch_available()
     else {}
 )
 a__					: List[Any] =  False

 a__					: Dict =  False
 a__					: Tuple =  False
 a__					: Optional[Any] =  False
 a__					: Dict =  False

 def     snake_case_      (    self					:					Union[str, Any]      )   ->	Optional[int]:
    _A      =       FocalNetModelTester(self      )
    _A      =       ConfigTester(self			,						config_class=snake_case_			,						embed_dim=37			,						has_text_modality=snake_case_      )

 def     snake_case_      (    self					:					int      )   ->	str:
    self.create_and_test_config_common_properties()
    self.config_tester.create_and_test_config_to_json_string()
    self.config_tester.create_and_test_config_to_json_file()
    self.config_tester.create_and_test_config_from_and_save_pretrained()
    self.config_tester.create_and_test_config_with_num_labels()
    self.config_tester.check_config_can_be_init_without_params()
    self.config_tester.check_config_arguments_init()

 def     snake_case_      (    self					:					Optional[Any]      )   ->	List[Any]:
    return

 def     snake_case_      (    self					:					int      )   ->	str:
    _A      =       self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_model(*snake_case_      )

 def     snake_case_      (    self					:					Any      )   ->	List[Any]:
    _A      =       self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_backbone(*snake_case_      )

 def     snake_case_      (    self					:					List[Any]      )   ->	int:
    _A      =       self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_masked_image_modeling(*snake_case_      )

 def     snake_case_      (    self					:					Union[str, Any]      )   ->	List[str]:
    _A      =       self.model_tester.prepare_config_and_inputs()
    self.model_tester.create_and_check_for_image_classification(*snake_case_      )

 @unittest.skip(reason='''FocalNet does not use inputs_embeds'''      )
 def     snake_case_      (    self					:					int      )   ->	int:
    pass

 @unittest.skip(reason='''FocalNet does not use feedforward chunking'''      )
 def     snake_case_      (    self					:					str      )   ->	Optional[Any]:
    pass

 def     snake_case_      (    self					:					Optional[int]      )   ->	Any:
    _A      =       self.model_tester.prepare_config_and_inputs_for_common()

    for model_class in self.all_model_classes[:-1]:
       _A      =       model_class(snake_case_      )
       self.assertIsInstance(model.get_input_embeddings()			,						(nn.Module)      )
       _A      =       model.get_output_embeddings()
       self.assertTrue(x is None or isinstance(snake_case_			,						nn.Linear      )      )

 def     snake_case_      (    self					:					Any      )   ->	str:
    _A      =       self.model_tester.prepare_config_and_inputs_for_common()

    for model_class in self.all_model_classes[:-1]:
       _A      =       model_class(snake_case_      )
       _A      =       inspect.signature(model.forward      )
       # signature.parameters is an OrderedDict => so arg_names order is deterministic
       _A      =       [*signature.parameters.keys()]

       _A      =       ["""pixel_values"""]
       self.assertListEqual(arg_names[:1]			,						snake_case_      )

 def     snake_case_      (    self					:					Tuple			,						__lowerCAmelCase					:					List[str]			,						__lowerCAmelCase					:					Dict			,						__lowerCAmelCase					:					Dict			,						__lowerCAmelCase					:					Any      )   ->	str:
    _A      =       model_class(snake_case_      )
    model.to(snake_case_      )
    model.eval()

    with torch.no_grad():
       _A      =       model(**self._prepare_for_class(snake_case_			,						snake_case_      )      )

    _A      =       outputs.hidden_states

    _A      =       getattr(
        self.model_tester			,						'''expected_num_hidden_layers'''			,						len(self.model_tester.depths      ) + 1      )
    self.assertEqual(len(snake_case_      )			,						snake_case_      )

    # FocalNet has a different seq_length
    _A      =       (
        config.patch_size
        if isinstance(config.patch_size			,						collections.abc.Iterable      )
        else (config.patch_size, config.patch_size)
    )

    _A      =       (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])

    self.assertListEqual(
        list(hidden_states[0].shape[-2:]      )			,						[num_patches, self.model_tester.embed_dim]			,						)

    _A      =       outputs.reshaped_hidden_states
    self.assertEqual(len(snake_case_      )			,						snake_case_      )

    _A      =       reshaped_hidden_states[0].shape
    _A      =       (
        reshaped_hidden_states[0].view(snake_case_			,						snake_case_			,						height * width      ).permute(0			,						2			,						1      )
    )
    self.assertListEqual(
        list(reshaped_hidden_states.shape[-2:]      )			,						[num_patches, self.model_tester.embed_dim]			,						)

 def     snake_case_      (    self					:					Optional[Any]      )   ->	int:
    _A      =       self.model_tester.prepare_config_and_inputs_for_common()

    _A      =       (
        self.model_tester.image_size
        if isinstance(self.model_tester.image_size			,						collections.abc.Iterable      )
        else (self.model_tester.image_size, self.model_tester.image_size)
    )

    for model_class in self.all_model_classes[:-1]:
       _A      =       True
       self.check_hidden_states_output(snake_case_			,						snake_case_			,						snake_case_			,						snake_case_      )

       # check that output_hidden_states also work using config
       del inputs_dict["output_hidden_states"]
       _A      =       True

       self.check_hidden_states_output(snake_case_			,						snake_case_			,						snake_case_			,						snake_case_      )

 def     snake_case_      (    self					:					Union[str, Any]      )   ->	Tuple:
    _A      =       self.model_tester.prepare_config_and_inputs_for_common()
    _A      =       3

    _A      =       (
        self.model_tester.image_size
        if isinstance(self.model_tester.image_size			,						collections.abc.Iterable      )
        else (self.model_tester.image_size, self.model_tester.image_size)
    )
    _A      =       (
        config.patch_size
        if isinstance(config.patch_size			,						collections.abc.Iterable      )
        else (config.patch_size, config.patch_size)
    )

    _A      =       image_size[0] + patch_size[0] - (image_size[0] % patch_size[0])
    _A      =       image_size[1] + patch_size[1] - (image_size[1] % patch_size[1])

    for model_class in self.all_model_classes[:-1]:
       _A      =       True
       self.check_hidden_states_output(snake_case_			,						snake_case_			,						snake_case_			,						(padded_height, padded_width)      )

       # check that output_hidden_states also work using config
       del inputs_dict["output_hidden_states"]
       _A      =       True
       self.check_hidden_states_output(snake_case_			,						snake_case_			,						snake_case_			,						(padded_height, padded_width)      )

 @slow
 def     snake_case_      (    self					:					Any      )   ->	List[Any]:
    for model_name in FOCALNET_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
       _A      =       FocalNetModel.from_pretrained(snake_case_      )
       self.assertIsNotNone(snake_case_      )

 def     snake_case_      (    self					:					List[Any]      )   ->	Union[str, Any]:
    _A      =       self.model_tester.prepare_config_and_inputs_for_common()

    _A      =       _config_zero_init(snake_case_      )
    for model_class in self.all_model_classes:
       _A      =       model_class(config=snake_case_      )
       for name, param in model.named_parameters():
          if "embeddings" not in name and param.requires_grad:
             self.assertIn(
                 ((param.data.mean() * 1E9).round() / 1E9).item()			,						[0.0, 1.0]			,						msg=f'''Parameter {name} of model {model_class} seems not properly initialized'''			,						)


@require_vision
@require_torch
class 	lowerCamelCase__	(       unittest.TestCase):



 """simple docstring"""

 @cached_property
 def     snake_case_      (    self					:					Any      )   ->	Any:
    # TODO update organization
    return AutoImageProcessor.from_pretrained('''microsoft/focalnet-tiny'''      ) if is_vision_available() else None

 @slow
 def     snake_case_      (    self					:					Optional[int]      )   ->	List[str]:
    _A      =       FocalNetForImageClassification.from_pretrained('''microsoft/focalnet-tiny'''      ).to(snake_case_      )
    _A      =       self.default_image_processor

    _A      =       Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''      )
    _A      =       image_processor(images=snake_case_			,						return_tensors='''pt'''      ).to(snake_case_      )

    # forward pass
    with torch.no_grad():
       _A      =       model(**snake_case_      )

    # verify the logits
    _A      =       torch.Size((1, 10_00)      )
    self.assertEqual(outputs.logits.shape			,						snake_case_      )
    _A      =       torch.tensor([0.2166, -0.4368, 0.2191]      ).to(snake_case_      )
    self.assertTrue(torch.allclose(outputs.logits[0, :3]			,						snake_case_			,						atol=1E-4      )      )
    self.assertTrue(outputs.logits.argmax(dim=-1      ).item()			,						2_81      )


@require_torch
class 	lowerCamelCase__	(       _a							,  unittest.TestCase):



 """simple docstring"""

 a__					: List[str] =  (FocalNetBackbone,) if is_torch_available() else ()
 a__					: int =  FocalNetConfig

 a__					: str =  False

 def     snake_case_      (    self					:					Any      )   ->	Tuple:
    _A      =       FocalNetModelTester(self      )








'''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


__a  			=						logging.get_logger(__name__)

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







class        UpperCAmelCase_			(			_a      ):
    """simple docstring"""







    lowercase   =						"layoutlmv3"




    def __init__(       self   :	Any					,	snake_case_   :	Dict=50_265					,	snake_case_   :	Union[str, Any]=768					,	snake_case_   :	Union[str, Any]=12					,	snake_case_   :	Optional[int]=12					,	snake_case_   :	Union[str, Any]=3_072					,	snake_case_   :	List[str]="gelu"					,	snake_case_   :	List[Any]=0.1					,	snake_case_   :	Union[str, Any]=0.1					,	snake_case_   :	Optional[int]=512					,	snake_case_   :	List[str]=2					,	snake_case_   :	List[str]=0.02					,	snake_case_   :	List[Any]=1E-5					,	snake_case_   :	Any=1					,	snake_case_   :	Any=0					,	snake_case_   :	int=2					,	snake_case_   :	Optional[Any]=1_024					,	snake_case_   :	int=128					,	snake_case_   :	Union[str, Any]=128					,	snake_case_   :	int=True					,	snake_case_   :	Tuple=32					,	snake_case_   :	str=128					,	snake_case_   :	Optional[int]=64					,	snake_case_   :	Optional[Any]=256					,	snake_case_   :	List[str]=True					,	snake_case_   :	str=True					,	snake_case_   :	Dict=True					,	snake_case_   :	int=224					,	snake_case_   :	Any=3					,	snake_case_   :	int=16					,	snake_case_   :	Tuple=None					,	**snake_case_   :	Optional[Any]					,	):
          super().__init__(
              vocab_size=snake_case_					,	hidden_size=snake_case_					,	num_hidden_layers=snake_case_					,	num_attention_heads=snake_case_					,	intermediate_size=snake_case_					,	hidden_act=snake_case_					,	hidden_dropout_prob=snake_case_					,	attention_probs_dropout_prob=snake_case_					,	max_position_embeddings=snake_case_					,	type_vocab_size=snake_case_					,	initializer_range=snake_case_					,	layer_norm_eps=snake_case_					,	pad_token_id=snake_case_					,	bos_token_id=snake_case_					,	eos_token_id=snake_case_					,	**snake_case_					,	)
          snake_case__    :       List[Any]       		= max_ad_position_embeddings
          snake_case__    :       Optional[int]       		= coordinate_size
          snake_case__    :       int       		= shape_size
          snake_case__    :       Optional[int]       		= has_relative_attention_bias
          snake_case__    :       Dict       		= rel_pos_bins
          snake_case__    :       List[Any]       		= max_rel_pos
          snake_case__    :       str       		= has_spatial_attention_bias
          snake_case__    :       Optional[Any]       		= rel_ad_pos_bins
          snake_case__    :       Optional[int]       		= max_rel_ad_pos
          snake_case__    :       Union[str, Any]       		= text_embed
          snake_case__    :       List[Any]       		= visual_embed
          snake_case__    :       Union[str, Any]       		= input_size
          snake_case__    :       int       		= num_channels
          snake_case__    :       Optional[Any]       		= patch_size
          snake_case__    :       Dict       		= classifier_dropout







class        UpperCAmelCase_			(			_a      ):
    """simple docstring"""







    lowercase   =						version.parse("1.12"      )




    @property
    def lowerCamelCase			(       self   :	Tuple		):
          # The order of inputs is different for question answering and sequence classification
          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   :	str		):
          return 1E-5




    @property
    def lowerCamelCase			(       self   :	List[Any]		):
          return 12




    def lowerCamelCase			(       self   :	str					,	snake_case_   :	"ProcessorMixin"					,	snake_case_   :	int = -1					,	snake_case_   :	int = -1					,	snake_case_   :	bool = False					,	snake_case_   :	Optional["TensorType"] = None					,	snake_case_   :	int = 3					,	snake_case_   :	int = 40					,	snake_case_   :	int = 40					,	):
          setattr(processor.image_processor					,	"""apply_ocr"""					,	snake_case_		)

          # If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
          snake_case__    :       Optional[Any]       		= compute_effective_axis_dimension(
              snake_case_					,	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
          snake_case__    :       List[Any]       		= processor.tokenizer.num_special_tokens_to_add(snake_case_		)
          snake_case__    :       Tuple       		= compute_effective_axis_dimension(
              snake_case_					,	fixed_dimension=OnnxConfig.default_fixed_sequence					,	num_token_to_add=snake_case_		)
          # Generate dummy inputs according to compute batch and sequence
          snake_case__    :       int       		= [[""" """.join([processor.tokenizer.unk_token]		) * seq_length]] * batch_size

          # Generate dummy bounding boxes
          snake_case__    :       int       		= [[[48, 84, 73, 128]]] * 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)
          snake_case__    :       Optional[int]       		= self._generate_dummy_images(snake_case_					,	snake_case_					,	snake_case_					,	snake_case_		)

          snake_case__    :       Optional[int]       		= dict(
              processor(
                  snake_case_					,	text=snake_case_					,	boxes=snake_case_					,	return_tensors=snake_case_					,	)		)

          return inputs
