

import collections
import inspect
import unittest

from transformers import DinatConfig
from transformers.testing_utils import require_natten, 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 DinatBackbone, DinatForImageClassification, DinatModel
      from transformers.models.dinat.modeling_dinat import DINAT_PRETRAINED_MODEL_ARCHIVE_LIST

if is_vision_available():
      from PIL import Image

      from transformers import AutoImageProcessor






class     __magic_name__     :


 def __init__(    self		:			int      ,    lowerCAmelCase__		:			str      ,    lowerCAmelCase__		:			List[Any]=1_3      ,    lowerCAmelCase__		:			List[str]=6_4      ,    lowerCAmelCase__		:			int=4      ,    lowerCAmelCase__		:			Optional[Any]=3      ,    lowerCAmelCase__		:			Optional[Any]=1_6      ,    lowerCAmelCase__		:			Optional[int]=[1, 2, 1]      ,    lowerCAmelCase__		:			Dict=[2, 4, 8]      ,    lowerCAmelCase__		:			Optional[int]=3      ,    lowerCAmelCase__		:			Optional[Any]=[[3], [1, 2], [1]]      ,    lowerCAmelCase__		:			int=2.0      ,    lowerCAmelCase__		:			List[str]=True      ,    lowerCAmelCase__		:			Optional[int]=0.0      ,    lowerCAmelCase__		:			int=0.0      ,    lowerCAmelCase__		:			Optional[Any]=0.1      ,    lowerCAmelCase__		:			List[Any]="gelu"      ,    lowerCAmelCase__		:			Any=True      ,    lowerCAmelCase__		:			List[str]=0.02      ,    lowerCAmelCase__		:			int=1e-5      ,    lowerCAmelCase__		:			List[Any]=True      ,    lowerCAmelCase__		:			Tuple=None      ,    lowerCAmelCase__		:			Any=True      ,    lowerCAmelCase__		:			Tuple=1_0      ,    lowerCAmelCase__		:			Any=["stage1", "stage2"]      ,    lowerCAmelCase__		:			Tuple=[1, 2]      ,    )     ->   Tuple:
   UpperCAmelCase          =	parent
   UpperCAmelCase          =	batch_size
   UpperCAmelCase          =	image_size
   UpperCAmelCase          =	patch_size
   UpperCAmelCase          =	num_channels
   UpperCAmelCase          =	embed_dim
   UpperCAmelCase          =	depths
   UpperCAmelCase          =	num_heads
   UpperCAmelCase          =	kernel_size
   UpperCAmelCase          =	dilations
   UpperCAmelCase          =	mlp_ratio
   UpperCAmelCase          =	qkv_bias
   UpperCAmelCase          =	hidden_dropout_prob
   UpperCAmelCase          =	attention_probs_dropout_prob
   UpperCAmelCase          =	drop_path_rate
   UpperCAmelCase          =	hidden_act
   UpperCAmelCase          =	patch_norm
   UpperCAmelCase          =	layer_norm_eps
   UpperCAmelCase          =	initializer_range
   UpperCAmelCase          =	is_training
   UpperCAmelCase          =	scope
   UpperCAmelCase          =	use_labels
   UpperCAmelCase          =	num_labels
   UpperCAmelCase          =	out_features
   UpperCAmelCase          =	out_indices


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

   UpperCAmelCase          =	None
   if self.use_labels:
     UpperCAmelCase          =	ids_tensor([self.batch_size]      ,    self.num_labels     )

   UpperCAmelCase          =	self.get_config()

   return config, pixel_values, labels


 def _UpperCamelCase						(    self		:			Any     )     ->   str:
   return DinatConfig(
       num_labels=self.num_labels      ,    image_size=self.image_size      ,    patch_size=self.patch_size      ,    num_channels=self.num_channels      ,    embed_dim=self.embed_dim      ,    depths=self.depths      ,    num_heads=self.num_heads      ,    kernel_size=self.kernel_size      ,    dilations=self.dilations      ,    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      ,    patch_norm=self.patch_norm      ,    layer_norm_eps=self.layer_norm_eps      ,    initializer_range=self.initializer_range      ,    out_features=self.out_features      ,    out_indices=self.out_indices      ,    )


 def _UpperCamelCase						(    self		:			Optional[Any]      ,    lowerCAmelCase__		:			Optional[int]      ,    lowerCAmelCase__		:			Any      ,    lowerCAmelCase__		:			str     )     ->   Any:
   UpperCAmelCase          =	DinatModel(config=lowerCAmelCase__     )
   model.to(lowerCAmelCase__     )
   model.eval()
   UpperCAmelCase          =	model(lowerCAmelCase__     )

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

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


 def _UpperCamelCase						(    self		:			List[Any]      ,    lowerCAmelCase__		:			Optional[Any]      ,    lowerCAmelCase__		:			Any      ,    lowerCAmelCase__		:			str     )     ->   Dict:
   UpperCAmelCase          =	DinatForImageClassification(lowerCAmelCase__     )
   model.to(lowerCAmelCase__     )
   model.eval()
   UpperCAmelCase          =	model(lowerCAmelCase__      ,    labels=lowerCAmelCase__     )
   self.parent.assertEqual(result.logits.shape      ,    (self.batch_size, self.num_labels)     )

   # test greyscale images
   UpperCAmelCase          =	1
   UpperCAmelCase          =	DinatForImageClassification(lowerCAmelCase__     )
   model.to(lowerCAmelCase__     )
   model.eval()

   UpperCAmelCase          =	floats_tensor([self.batch_size, 1, self.image_size, self.image_size]     )
   UpperCAmelCase          =	model(lowerCAmelCase__     )
   self.parent.assertEqual(result.logits.shape      ,    (self.batch_size, self.num_labels)     )


 def _UpperCamelCase						(    self		:			Union[str, Any]      ,    lowerCAmelCase__		:			int      ,    lowerCAmelCase__		:			Tuple      ,    lowerCAmelCase__		:			Union[str, Any]     )     ->   List[Any]:
   UpperCAmelCase          =	DinatBackbone(config=lowerCAmelCase__     )
   model.to(lowerCAmelCase__     )
   model.eval()
   UpperCAmelCase          =	model(lowerCAmelCase__     )

   # verify hidden states
   self.parent.assertEqual(len(result.feature_maps     )      ,    len(config.out_features     )     )
   self.parent.assertListEqual(list(result.feature_maps[0].shape     )      ,    [self.batch_size, model.channels[0], 1_6, 1_6]     )

   # verify channels
   self.parent.assertEqual(len(model.channels     )      ,    len(config.out_features     )     )

   # verify backbone works with out_features=None
   UpperCAmelCase          =	None
   UpperCAmelCase          =	DinatBackbone(config=lowerCAmelCase__     )
   model.to(lowerCAmelCase__     )
   model.eval()
   UpperCAmelCase          =	model(lowerCAmelCase__     )

   # verify feature maps
   self.parent.assertEqual(len(result.feature_maps     )      ,    1     )
   self.parent.assertListEqual(list(result.feature_maps[0].shape     )      ,    [self.batch_size, model.channels[-1], 4, 4]     )

   # verify channels
   self.parent.assertEqual(len(model.channels     )      ,    1     )


 def _UpperCamelCase						(    self		:			Any     )     ->   int:
   UpperCAmelCase          =	self.prepare_config_and_inputs()
   UpperCAmelCase   ,						UpperCAmelCase   ,						UpperCAmelCase          =	config_and_inputs
   UpperCAmelCase          =	{"pixel_values": pixel_values}
   return config, inputs_dict






@require_natten
@require_torch
class     __magic_name__     (							_snake_case						,    _snake_case						,    unittest.TestCase     ):
 UpperCAmelCase				     =    (
     (
         DinatModel,
         DinatForImageClassification,
         DinatBackbone,
     )
     if is_torch_available()
     else ()
 )
 UpperCAmelCase				     =    (
     {"""feature-extraction""": DinatModel, """image-classification""": DinatForImageClassification}
     if is_torch_available()
     else {}
 )
 UpperCAmelCase				     =    False

 UpperCAmelCase				     =    False
 UpperCAmelCase				     =    False
 UpperCAmelCase				     =    False
 UpperCAmelCase				     =    False


 def _UpperCamelCase						(    self		:			Any     )     ->   Union[str, Any]:
   UpperCAmelCase          =	DinatModelTester(self     )
   UpperCAmelCase          =	ConfigTester(self      ,    config_class=lowerCAmelCase__      ,    embed_dim=3_7     )


 def _UpperCamelCase						(    self		:			str     )     ->   Optional[Any]:
   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 _UpperCamelCase						(    self		:			int     )     ->   List[Any]:
   return


 def _UpperCamelCase						(    self		:			List[Any]     )     ->   Optional[Any]:
   UpperCAmelCase          =	self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_model(*lowerCAmelCase__     )


 def _UpperCamelCase						(    self		:			str     )     ->   List[Any]:
   UpperCAmelCase          =	self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_for_image_classification(*lowerCAmelCase__     )


 def _UpperCamelCase						(    self		:			int     )     ->   Any:
   UpperCAmelCase          =	self.model_tester.prepare_config_and_inputs()
   self.model_tester.create_and_check_backbone(*lowerCAmelCase__     )


 @unittest.skip(reason="Dinat does not use inputs_embeds"     )
 def _UpperCamelCase						(    self		:			Tuple     )     ->   Dict:
   pass


 @unittest.skip(reason="Dinat does not use feedforward chunking"     )
 def _UpperCamelCase						(    self		:			Optional[int]     )     ->   Optional[int]:
   pass


 def _UpperCamelCase						(    self		:			int     )     ->   Any:
   UpperCAmelCase   ,						UpperCAmelCase          =	self.model_tester.prepare_config_and_inputs_for_common()

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


 def _UpperCamelCase						(    self		:			Optional[int]     )     ->   List[Any]:
   UpperCAmelCase   ,						UpperCAmelCase          =	self.model_tester.prepare_config_and_inputs_for_common()

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

     UpperCAmelCase          =	["pixel_values"]
     self.assertListEqual(arg_names[:1]      ,    lowerCAmelCase__     )


 def _UpperCamelCase						(    self		:			List[str]     )     ->   List[str]:
   self.skipTest("Dinat's attention operation is handled entirely by NATTEN."     )


 def _UpperCamelCase						(    self		:			Optional[Any]      ,    lowerCAmelCase__		:			str      ,    lowerCAmelCase__		:			Optional[int]      ,    lowerCAmelCase__		:			Union[str, Any]      ,    lowerCAmelCase__		:			Tuple     )     ->   Optional[Any]:
   UpperCAmelCase          =	model_class(lowerCAmelCase__     )
   model.to(lowerCAmelCase__     )
   model.eval()

   with torch.no_grad():
     UpperCAmelCase          =	model(**self._prepare_for_class(lowerCAmelCase__      ,    lowerCAmelCase__     )     )

   UpperCAmelCase          =	outputs.hidden_states

   UpperCAmelCase          =	getattr(
       self.model_tester      ,    "expected_num_hidden_layers"      ,    len(self.model_tester.depths     ) + 1     )
   self.assertEqual(len(lowerCAmelCase__     )      ,    lowerCAmelCase__     )

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

   UpperCAmelCase          =	image_size[0] // patch_size[0]
   UpperCAmelCase          =	image_size[1] // patch_size[1]

   self.assertListEqual(
       list(hidden_states[0].shape[-3:]     )      ,    [height, width, self.model_tester.embed_dim]      ,    )

   if model_class.__name__ != "DinatBackbone":
     UpperCAmelCase          =	outputs.reshaped_hidden_states
     self.assertEqual(len(lowerCAmelCase__     )      ,    lowerCAmelCase__     )

     UpperCAmelCase   ,						UpperCAmelCase   ,						UpperCAmelCase   ,						UpperCAmelCase          =	reshaped_hidden_states[0].shape
     UpperCAmelCase          =	(
         reshaped_hidden_states[0].view(lowerCAmelCase__      ,    lowerCAmelCase__      ,    lowerCAmelCase__      ,    lowerCAmelCase__     ).permute(0      ,    2      ,    3      ,    1     )
     )
     self.assertListEqual(
         list(reshaped_hidden_states.shape[-3:]     )      ,    [height, width, self.model_tester.embed_dim]      ,    )


 def _UpperCamelCase						(    self		:			Optional[Any]     )     ->   Union[str, Any]:
   UpperCAmelCase   ,						UpperCAmelCase          =	self.model_tester.prepare_config_and_inputs_for_common()

   UpperCAmelCase          =	(
       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:
     UpperCAmelCase          =	True
     self.check_hidden_states_output(lowerCAmelCase__      ,    lowerCAmelCase__      ,    lowerCAmelCase__      ,    lowerCAmelCase__     )

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

     self.check_hidden_states_output(lowerCAmelCase__      ,    lowerCAmelCase__      ,    lowerCAmelCase__      ,    lowerCAmelCase__     )


 @slow
 def _UpperCamelCase						(    self		:			Dict     )     ->   Optional[int]:
   for model_name in DINAT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
     UpperCAmelCase          =	DinatModel.from_pretrained(lowerCAmelCase__     )
     self.assertIsNotNone(lowerCAmelCase__     )


 def _UpperCamelCase						(    self		:			str     )     ->   int:
   UpperCAmelCase   ,						UpperCAmelCase          =	self.model_tester.prepare_config_and_inputs_for_common()

   UpperCAmelCase          =	_config_zero_init(lowerCAmelCase__     )
   for model_class in self.all_model_classes:
     UpperCAmelCase          =	model_class(config=lowerCAmelCase__     )
     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_natten
@require_vision
@require_torch
class     __magic_name__     (							unittest.TestCase     ):


 @cached_property
 def _UpperCamelCase						(    self		:			Optional[int]     )     ->   int:
   return AutoImageProcessor.from_pretrained("shi-labs/dinat-mini-in1k-224"     ) if is_vision_available() else None


 @slow
 def _UpperCamelCase						(    self		:			Any     )     ->   Optional[int]:
   UpperCAmelCase          =	DinatForImageClassification.from_pretrained("shi-labs/dinat-mini-in1k-224"     ).to(lowerCAmelCase__     )
   UpperCAmelCase          =	self.default_image_processor

   UpperCAmelCase          =	Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"     )
   UpperCAmelCase          =	image_processor(images=lowerCAmelCase__      ,    return_tensors="pt"     ).to(lowerCAmelCase__     )

   # forward pass
   with torch.no_grad():
     UpperCAmelCase          =	model(**lowerCAmelCase__     )

   # verify the logits
   UpperCAmelCase          =	torch.Size((1, 1_0_0_0)     )
   self.assertEqual(outputs.logits.shape      ,    lowerCAmelCase__     )
   UpperCAmelCase          =	torch.tensor([-0.1_545, -0.7_667, 0.4_642]     ).to(lowerCAmelCase__     )
   self.assertTrue(torch.allclose(outputs.logits[0, :3]      ,    lowerCAmelCase__      ,    atol=1e-4     )     )






@require_torch
@require_natten
class     __magic_name__     (							unittest.TestCase						,    _snake_case     ):
 UpperCAmelCase				     =    (DinatBackbone,) if is_torch_available() else ()
 UpperCAmelCase				     =    DinatConfig


 def _UpperCamelCase						(    self		:			Optional[int]     )     ->   List[str]:
   UpperCAmelCase          =	DinatModelTester(self     )






import warnings
from typing import List, Optional, Union

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType






class     __magic_name__     (							_snake_case     ):
 UpperCAmelCase				     =    ["""image_processor""", """tokenizer"""]
 UpperCAmelCase				     =    """LayoutLMv2ImageProcessor"""
 UpperCAmelCase				     =    ("""LayoutLMv2Tokenizer""", """LayoutLMv2TokenizerFast""")


 def __init__(    self		:			Any      ,    lowerCAmelCase__		:			Any=None      ,    lowerCAmelCase__		:			Optional[Any]=None      ,    **lowerCAmelCase__		:			int     )     ->   Union[str, Any]:
   UpperCAmelCase          =	None
   if "feature_extractor" in kwargs:
     warnings.warn(
         "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
         " instead."      ,    lowerCAmelCase__      ,    )
     UpperCAmelCase          =	kwargs.pop("feature_extractor"     )

   UpperCAmelCase          =	image_processor if image_processor is not None else feature_extractor
   if image_processor is None:
     raise ValueError("You need to specify an `image_processor`."     )
   if tokenizer is None:
     raise ValueError("You need to specify a `tokenizer`."     )

   super().__init__(lowerCAmelCase__      ,    lowerCAmelCase__     )


 def __call__(    self		:			int      ,    lowerCAmelCase__		:			Tuple      ,    lowerCAmelCase__		:			Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None      ,    lowerCAmelCase__		:			Optional[Union[PreTokenizedInput, List[PreTokenizedInput]]] = None      ,    lowerCAmelCase__		:			Union[List[List[int]], List[List[List[int]]]] = None      ,    lowerCAmelCase__		:			Optional[Union[List[int], List[List[int]]]] = None      ,    lowerCAmelCase__		:			bool = True      ,    lowerCAmelCase__		:			Union[bool, str, PaddingStrategy] = False      ,    lowerCAmelCase__		:			Union[bool, str, TruncationStrategy] = False      ,    lowerCAmelCase__		:			Optional[int] = None      ,    lowerCAmelCase__		:			int = 0      ,    lowerCAmelCase__		:			Optional[int] = None      ,    lowerCAmelCase__		:			Optional[bool] = None      ,    lowerCAmelCase__		:			Optional[bool] = None      ,    lowerCAmelCase__		:			bool = False      ,    lowerCAmelCase__		:			bool = False      ,    lowerCAmelCase__		:			bool = False      ,    lowerCAmelCase__		:			bool = False      ,    lowerCAmelCase__		:			bool = True      ,    lowerCAmelCase__		:			Optional[Union[str, TensorType]] = None      ,    **lowerCAmelCase__		:			Any      ,    )     ->   BatchEncoding:
   # verify input
   if self.image_processor.apply_ocr and (boxes is not None):
     raise ValueError(
         "You cannot provide bounding boxes if you initialized the image processor with apply_ocr set to True."     )

   if self.image_processor.apply_ocr and (word_labels is not None):
     raise ValueError(
         "You cannot provide word labels if you initialized the image processor with apply_ocr set to True."     )

   if return_overflowing_tokens is True and return_offsets_mapping is False:
     raise ValueError("You cannot return overflowing tokens without returning the offsets mapping."     )

   # first, apply the image processor
   UpperCAmelCase          =	self.image_processor(images=lowerCAmelCase__      ,    return_tensors=lowerCAmelCase__     )

   # second, apply the tokenizer
   if text is not None and self.image_processor.apply_ocr and text_pair is None:
     if isinstance(lowerCAmelCase__      ,    lowerCAmelCase__     ):
       UpperCAmelCase          =	[text]  # add batch dimension (as the image processor always adds a batch dimension)
     UpperCAmelCase          =	features["words"]

   UpperCAmelCase          =	self.tokenizer(
       text=text if text is not None else features["words"]      ,    text_pair=text_pair if text_pair is not None else None      ,    boxes=boxes if boxes is not None else features["boxes"]      ,    word_labels=lowerCAmelCase__      ,    add_special_tokens=lowerCAmelCase__      ,    padding=lowerCAmelCase__      ,    truncation=lowerCAmelCase__      ,    max_length=lowerCAmelCase__      ,    stride=lowerCAmelCase__      ,    pad_to_multiple_of=lowerCAmelCase__      ,    return_token_type_ids=lowerCAmelCase__      ,    return_attention_mask=lowerCAmelCase__      ,    return_overflowing_tokens=lowerCAmelCase__      ,    return_special_tokens_mask=lowerCAmelCase__      ,    return_offsets_mapping=lowerCAmelCase__      ,    return_length=lowerCAmelCase__      ,    verbose=lowerCAmelCase__      ,    return_tensors=lowerCAmelCase__      ,    **lowerCAmelCase__      ,    )

   # add pixel values
   UpperCAmelCase          =	features.pop("pixel_values"     )
   if return_overflowing_tokens is True:
     UpperCAmelCase          =	self.get_overflowing_images(lowerCAmelCase__      ,    encoded_inputs["overflow_to_sample_mapping"]     )
   UpperCAmelCase          =	images

   return encoded_inputs


 def _UpperCamelCase						(    self		:			str      ,    lowerCAmelCase__		:			Union[str, Any]      ,    lowerCAmelCase__		:			Union[str, Any]     )     ->   int:
   # in case there's an overflow, ensure each `input_ids` sample is mapped to its corresponding image
   UpperCAmelCase          =	[]
   for sample_idx in overflow_to_sample_mapping:
     images_with_overflow.append(images[sample_idx]     )

   if len(lowerCAmelCase__     ) != len(lowerCAmelCase__     ):
     raise ValueError(
         "Expected length of images to be the same as the length of `overflow_to_sample_mapping`, but got"
         f" {len(lowerCAmelCase__     )} and {len(lowerCAmelCase__     )}"     )

   return images_with_overflow


 def _UpperCamelCase						(    self		:			Optional[Any]      ,    *lowerCAmelCase__		:			int      ,    **lowerCAmelCase__		:			Union[str, Any]     )     ->   List[str]:
   return self.tokenizer.batch_decode(*lowerCAmelCase__      ,    **lowerCAmelCase__     )


 def _UpperCamelCase						(    self		:			Union[str, Any]      ,    *lowerCAmelCase__		:			Tuple      ,    **lowerCAmelCase__		:			Union[str, Any]     )     ->   List[Any]:
   return self.tokenizer.decode(*lowerCAmelCase__      ,    **lowerCAmelCase__     )


 @property
 def _UpperCamelCase						(    self		:			int     )     ->   List[str]:
   return ["input_ids", "bbox", "token_type_ids", "attention_mask", "image"]


 @property
 def _UpperCamelCase						(    self		:			Dict     )     ->   List[str]:
   warnings.warn(
       "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."      ,    lowerCAmelCase__      ,    )
   return self.image_processor_class


 @property
 def _UpperCamelCase						(    self		:			List[Any]     )     ->   int:
   warnings.warn(
       "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."      ,    lowerCAmelCase__      ,    )
   return self.image_processor



