


import inspect
import unittest

from transformers import SegformerConfig, is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device

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 transformers import (
	    MODEL_MAPPING,
	    SegformerForImageClassification,
	    SegformerForSemanticSegmentation,
	    SegformerModel,
	)
	from transformers.models.segformer.modeling_segformer import SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
	from PIL import Image

	from transformers import SegformerImageProcessor






class     UpperCamelCase(  _a   ):


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Dict						)			->	Any:




											'''simple docstring'''

											__snake_case				=		self.config_class(**self.inputs_dict						)
											self.parent.assertTrue(hasattr(SCREAMING_SNAKE_CASE     ,    "hidden_sizes"						)						)
											self.parent.assertTrue(hasattr(SCREAMING_SNAKE_CASE     ,    "num_attention_heads"						)						)
											self.parent.assertTrue(hasattr(SCREAMING_SNAKE_CASE     ,    "num_encoder_blocks"						)						)






class     UpperCamelCase:


					def __init__(						self	:		str     ,    SCREAMING_SNAKE_CASE	:		Dict     ,    SCREAMING_SNAKE_CASE	:		Dict=1_3     ,    SCREAMING_SNAKE_CASE	:		Any=6_4     ,    SCREAMING_SNAKE_CASE	:		Optional[Any]=3     ,    SCREAMING_SNAKE_CASE	:		Dict=4     ,    SCREAMING_SNAKE_CASE	:		Tuple=[2, 2, 2, 2]     ,    SCREAMING_SNAKE_CASE	:		Dict=[8, 4, 2, 1]     ,    SCREAMING_SNAKE_CASE	:		List[str]=[1_6, 3_2, 6_4, 1_2_8]     ,    SCREAMING_SNAKE_CASE	:		str=[1, 4, 8, 1_6]     ,    SCREAMING_SNAKE_CASE	:		List[Any]=[1, 2, 4, 8]     ,    SCREAMING_SNAKE_CASE	:		List[Any]=True     ,    SCREAMING_SNAKE_CASE	:		Union[str, Any]=True     ,    SCREAMING_SNAKE_CASE	:		int="gelu"     ,    SCREAMING_SNAKE_CASE	:		int=0.1     ,    SCREAMING_SNAKE_CASE	:		Union[str, Any]=0.1     ,    SCREAMING_SNAKE_CASE	:		Optional[int]=0.02     ,    SCREAMING_SNAKE_CASE	:		Tuple=3     ,    SCREAMING_SNAKE_CASE	:		Tuple=None     ,    )			->	str:




											'''simple docstring'''

											__snake_case				=		parent
											__snake_case				=		batch_size
											__snake_case				=		image_size
											__snake_case				=		num_channels
											__snake_case				=		num_encoder_blocks
											__snake_case				=		sr_ratios
											__snake_case				=		depths
											__snake_case				=		hidden_sizes
											__snake_case				=		downsampling_rates
											__snake_case				=		num_attention_heads
											__snake_case				=		is_training
											__snake_case				=		use_labels
											__snake_case				=		hidden_act
											__snake_case				=		hidden_dropout_prob
											__snake_case				=		attention_probs_dropout_prob
											__snake_case				=		initializer_range
											__snake_case				=		num_labels
											__snake_case				=		scope


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




											'''simple docstring'''

											__snake_case				=		floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]						)

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

											__snake_case				=		self.get_config()
											return config, pixel_values, labels


					def 							SCREAMING_SNAKE_CASE_  (						self	:		str						)			->	str:




											'''simple docstring'''

											return SegformerConfig(
											    image_size=self.image_size     ,    num_channels=self.num_channels     ,    num_encoder_blocks=self.num_encoder_blocks     ,    depths=self.depths     ,    hidden_sizes=self.hidden_sizes     ,    num_attention_heads=self.num_attention_heads     ,    hidden_act=self.hidden_act     ,    hidden_dropout_prob=self.hidden_dropout_prob     ,    attention_probs_dropout_prob=self.attention_probs_dropout_prob     ,    initializer_range=self.initializer_range     ,    )


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Tuple     ,    SCREAMING_SNAKE_CASE	:		str     ,    SCREAMING_SNAKE_CASE	:		Any     ,    SCREAMING_SNAKE_CASE	:		str						)			->	List[Any]:




											'''simple docstring'''

											__snake_case				=		SegformerModel(config=SCREAMING_SNAKE_CASE						)
											model.to(SCREAMING_SNAKE_CASE						)
											model.eval()
											__snake_case				=		model(SCREAMING_SNAKE_CASE						)
											__snake_case				=		__snake_case				=		self.image_size // (self.downsampling_rates[-1] * 2)
											self.parent.assertEqual(
											    result.last_hidden_state.shape     ,    (self.batch_size, self.hidden_sizes[-1], expected_height, expected_width)						)


					def 							SCREAMING_SNAKE_CASE_  (						self	:		List[str]     ,    SCREAMING_SNAKE_CASE	:		Optional[int]     ,    SCREAMING_SNAKE_CASE	:		Any     ,    SCREAMING_SNAKE_CASE	:		Tuple						)			->	List[str]:




											'''simple docstring'''

											__snake_case				=		self.num_labels
											__snake_case				=		SegformerForSemanticSegmentation(SCREAMING_SNAKE_CASE						)
											model.to(SCREAMING_SNAKE_CASE						)
											model.eval()
											__snake_case				=		model(SCREAMING_SNAKE_CASE						)
											self.parent.assertEqual(
											    result.logits.shape     ,    (self.batch_size, self.num_labels, self.image_size // 4, self.image_size // 4)						)
											__snake_case				=		model(SCREAMING_SNAKE_CASE     ,    labels=SCREAMING_SNAKE_CASE						)
											self.parent.assertEqual(
											    result.logits.shape     ,    (self.batch_size, self.num_labels, self.image_size // 4, self.image_size // 4)						)
											self.parent.assertGreater(result.loss     ,    0.0						)


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Optional[Any]     ,    SCREAMING_SNAKE_CASE	:		List[Any]     ,    SCREAMING_SNAKE_CASE	:		Union[str, Any]     ,    SCREAMING_SNAKE_CASE	:		List[str]						)			->	Dict:




											'''simple docstring'''

											__snake_case				=		1
											__snake_case				=		SegformerForSemanticSegmentation(config=SCREAMING_SNAKE_CASE						)
											model.to(SCREAMING_SNAKE_CASE						)
											model.eval()
											__snake_case				=		torch.randint(0     ,    1     ,    (self.batch_size, self.image_size, self.image_size)						).to(SCREAMING_SNAKE_CASE						)
											__snake_case				=		model(SCREAMING_SNAKE_CASE     ,    labels=SCREAMING_SNAKE_CASE						)
											self.parent.assertGreater(result.loss     ,    0.0						)






					def 							SCREAMING_SNAKE_CASE_  (						self	:		Union[str, Any]						)			->	List[Any]:




											'''simple docstring'''

											__snake_case				=		self.prepare_config_and_inputs()
											__snake_case		,					__snake_case		,					__snake_case				=		config_and_inputs
											__snake_case				=		{"pixel_values": pixel_values}
											return config, inputs_dict






@require_torch
class     UpperCamelCase(  _a     ,							_a     ,							unittest.TestCase   ):
					snake_case_		:				Union[str, Any]										=	(
					    (
					        SegformerModel,
					        SegformerForSemanticSegmentation,
					        SegformerForImageClassification,
					    )
					    if is_torch_available()
					    else ()
					)
					snake_case_		:				Dict										=	(
					    {
					        """feature-extraction""": SegformerModel,
					        """image-classification""": SegformerForImageClassification,
					        """image-segmentation""": SegformerForSemanticSegmentation,
					    }
					    if is_torch_available()
					    else {}
					)

					snake_case_		:				Tuple										=	True
					snake_case_		:				int										=	False
					snake_case_		:				Tuple										=	False
					snake_case_		:				Optional[Any]										=	False


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Any						)			->	Tuple:




											'''simple docstring'''

											__snake_case				=		SegformerModelTester(self						)
											__snake_case				=		SegformerConfigTester(self     ,    config_class=SCREAMING_SNAKE_CASE						)


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




											'''simple docstring'''

											self.config_tester.run_common_tests()


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




											'''simple docstring'''

											__snake_case				=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE						)


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Union[str, Any]						)			->	int:




											'''simple docstring'''

											__snake_case				=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_binary_image_segmentation(*SCREAMING_SNAKE_CASE						)


					def 							SCREAMING_SNAKE_CASE_  (						self	:		str						)			->	Tuple:




											'''simple docstring'''

											__snake_case				=		self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_image_segmentation(*SCREAMING_SNAKE_CASE						)


					@unittest.skip("SegFormer does not use inputs_embeds"						)
					def 							SCREAMING_SNAKE_CASE_  (						self	:		Tuple						)			->	Tuple:




											'''simple docstring'''

											pass


					@unittest.skip("SegFormer does not have get_input_embeddings method and get_output_embeddings methods"						)
					def 							SCREAMING_SNAKE_CASE_  (						self	:		List[Any]						)			->	str:




											'''simple docstring'''

											pass


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




											'''simple docstring'''

											__snake_case		,					__snake_case				=		self.model_tester.prepare_config_and_inputs_for_common()

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

																	__snake_case				=		["pixel_values"]
																	self.assertListEqual(arg_names[:1]     ,    SCREAMING_SNAKE_CASE						)


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Any						)			->	Optional[int]:




											'''simple docstring'''

											__snake_case		,					__snake_case				=		self.model_tester.prepare_config_and_inputs_for_common()
											__snake_case				=		True

											for model_class in self.all_model_classes:
																	__snake_case				=		True
																	__snake_case				=		False
																	__snake_case				=		True
																	__snake_case				=		model_class(SCREAMING_SNAKE_CASE						)
																	model.to(SCREAMING_SNAKE_CASE						)
																	model.eval()
																	with torch.no_grad():
																							__snake_case				=		model(**self._prepare_for_class(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE						)						)
																	__snake_case				=		outputs.attentions

																	__snake_case				=		sum(self.model_tester.depths						)
																	self.assertEqual(len(SCREAMING_SNAKE_CASE						)     ,    SCREAMING_SNAKE_CASE						)

																	# check that output_attentions also work using config
																	del inputs_dict["output_attentions"]
																	__snake_case				=		True
																	__snake_case				=		model_class(SCREAMING_SNAKE_CASE						)
																	model.to(SCREAMING_SNAKE_CASE						)
																	model.eval()
																	with torch.no_grad():
																							__snake_case				=		model(**self._prepare_for_class(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE						)						)
																	__snake_case				=		outputs.attentions

																	self.assertEqual(len(SCREAMING_SNAKE_CASE						)     ,    SCREAMING_SNAKE_CASE						)

																	# verify the first attentions (first block, first layer)
																	__snake_case				=		(self.model_tester.image_size // 4) ** 2
																	__snake_case				=		(self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
																	self.assertListEqual(
																	    list(attentions[0].shape[-3:]						)     ,    [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len]     ,    )

																	# verify the last attentions (last block, last layer)
																	__snake_case				=		(self.model_tester.image_size // 3_2) ** 2
																	__snake_case				=		(self.model_tester.image_size // (3_2 * self.model_tester.sr_ratios[-1])) ** 2
																	self.assertListEqual(
																	    list(attentions[-1].shape[-3:]						)     ,    [self.model_tester.num_attention_heads[-1], expected_seq_len, expected_reduced_seq_len]     ,    )
																	__snake_case				=		len(SCREAMING_SNAKE_CASE						)

																	# Check attention is always last and order is fine
																	__snake_case				=		True
																	__snake_case				=		True
																	__snake_case				=		model_class(SCREAMING_SNAKE_CASE						)
																	model.to(SCREAMING_SNAKE_CASE						)
																	model.eval()
																	with torch.no_grad():
																							__snake_case				=		model(**self._prepare_for_class(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE						)						)

																	self.assertEqual(out_len + 1     ,    len(SCREAMING_SNAKE_CASE						)						)

																	__snake_case				=		outputs.attentions

																	self.assertEqual(len(SCREAMING_SNAKE_CASE						)     ,    SCREAMING_SNAKE_CASE						)
																	# verify the first attentions (first block, first layer)
																	__snake_case				=		(self.model_tester.image_size // 4) ** 2
																	__snake_case				=		(self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
																	self.assertListEqual(
																	    list(self_attentions[0].shape[-3:]						)     ,    [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len]     ,    )


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Optional[int]						)			->	int:




											'''simple docstring'''

											def check_hidden_states_output(SCREAMING_SNAKE_CASE	:		List[str]     ,    SCREAMING_SNAKE_CASE	:		List[str]     ,    SCREAMING_SNAKE_CASE	:		int						):
																	__snake_case				=		model_class(SCREAMING_SNAKE_CASE						)
																	model.to(SCREAMING_SNAKE_CASE						)
																	model.eval()

																	with torch.no_grad():
																							__snake_case				=		model(**self._prepare_for_class(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE						)						)

																	__snake_case				=		outputs.hidden_states

																	__snake_case				=		self.model_tester.num_encoder_blocks
																	self.assertEqual(len(SCREAMING_SNAKE_CASE						)     ,    SCREAMING_SNAKE_CASE						)

																	# verify the first hidden states (first block)
																	self.assertListEqual(
																	    list(hidden_states[0].shape[-3:]						)     ,    [
																	        self.model_tester.hidden_sizes[0],
																	        self.model_tester.image_size // 4,
																	        self.model_tester.image_size // 4,
																	    ]     ,    )

											__snake_case		,					__snake_case				=		self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
																	__snake_case				=		True
																	check_hidden_states_output(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE						)

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

																	check_hidden_states_output(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE						)


					def 							SCREAMING_SNAKE_CASE_  (						self	:		Any						)			->	int:




											'''simple docstring'''

											if not self.model_tester.is_training:
																	return

											__snake_case		,					__snake_case				=		self.model_tester.prepare_config_and_inputs_for_common()
											__snake_case				=		True

											for model_class in self.all_model_classes:
																	if model_class in get_values(SCREAMING_SNAKE_CASE						):
																							continue

																	__snake_case				=		model_class(SCREAMING_SNAKE_CASE						)
																	model.to(SCREAMING_SNAKE_CASE						)
																	model.train()
																	__snake_case				=		self._prepare_for_class(SCREAMING_SNAKE_CASE     ,    SCREAMING_SNAKE_CASE     ,    return_labels=SCREAMING_SNAKE_CASE						)
																	__snake_case				=		model(**SCREAMING_SNAKE_CASE						).loss
																	loss.backward()


					@unittest.skip("Will be fixed soon by reducing the size of the model used for common tests."						)
					def 							SCREAMING_SNAKE_CASE_  (						self	:		Union[str, Any]						)			->	Any:




											'''simple docstring'''

											pass






					@slow
					def 							SCREAMING_SNAKE_CASE_  (						self	:		Any						)			->	int:




											'''simple docstring'''

											for model_name in SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																	__snake_case				=		SegformerModel.from_pretrained(SCREAMING_SNAKE_CASE						)
																	self.assertIsNotNone(SCREAMING_SNAKE_CASE						)





def 	_lowerCAmelCase       (    )						->	Optional[Any]:


						'''simple docstring'''






						__snake_case				=		Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png" )
						return image






@require_torch
class     UpperCamelCase(  unittest.TestCase   ):


					@slow
					def 							SCREAMING_SNAKE_CASE_  (						self	:		str						)			->	int:




											'''simple docstring'''

											__snake_case				=		SegformerImageProcessor(
											    image_scale=(5_1_2, 5_1_2)     ,    keep_ratio=SCREAMING_SNAKE_CASE     ,    align=SCREAMING_SNAKE_CASE     ,    do_random_crop=SCREAMING_SNAKE_CASE						)
											__snake_case				=		SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512"						).to(
											    SCREAMING_SNAKE_CASE						)

											__snake_case				=		prepare_img()
											__snake_case				=		image_processor(images=SCREAMING_SNAKE_CASE     ,    return_tensors="pt"						)
											__snake_case				=		encoded_inputs.pixel_values.to(SCREAMING_SNAKE_CASE						)

											with torch.no_grad():
																	__snake_case				=		model(SCREAMING_SNAKE_CASE						)

											__snake_case				=		torch.Size((1, model.config.num_labels, 1_2_8, 1_2_8)						)
											self.assertEqual(outputs.logits.shape     ,    SCREAMING_SNAKE_CASE						)

											__snake_case				=		torch.tensor(
											    [
											        [[-4.6310, -5.5232, -6.2356], [-5.1921, -6.1444, -6.5996], [-5.4424, -6.2790, -6.7574]],
											        [[-12.1391, -13.3122, -13.9554], [-12.8732, -13.9352, -14.3563], [-12.9438, -13.8226, -14.2513]],
											        [[-12.5134, -13.4686, -14.4915], [-12.8669, -14.4343, -14.7758], [-13.2523, -14.5819, -15.0694]],
											    ]						).to(SCREAMING_SNAKE_CASE						)
											self.assertTrue(torch.allclose(outputs.logits[0, :3, :3, :3]     ,    SCREAMING_SNAKE_CASE     ,    atol=1e-4						)						)


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




											'''simple docstring'''

											__snake_case				=		SegformerImageProcessor(
											    image_scale=(5_1_2, 5_1_2)     ,    keep_ratio=SCREAMING_SNAKE_CASE     ,    align=SCREAMING_SNAKE_CASE     ,    do_random_crop=SCREAMING_SNAKE_CASE						)
											__snake_case				=		SegformerForSemanticSegmentation.from_pretrained(
											    "nvidia/segformer-b1-finetuned-cityscapes-1024-1024"						).to(SCREAMING_SNAKE_CASE						)

											__snake_case				=		prepare_img()
											__snake_case				=		image_processor(images=SCREAMING_SNAKE_CASE     ,    return_tensors="pt"						)
											__snake_case				=		encoded_inputs.pixel_values.to(SCREAMING_SNAKE_CASE						)

											with torch.no_grad():
																	__snake_case				=		model(SCREAMING_SNAKE_CASE						)

											__snake_case				=		torch.Size((1, model.config.num_labels, 1_2_8, 1_2_8)						)
											self.assertEqual(outputs.logits.shape     ,    SCREAMING_SNAKE_CASE						)

											__snake_case				=		torch.tensor(
											    [
											        [[-13.5748, -13.9111, -12.6500], [-14.3500, -15.3683, -14.2328], [-14.7532, -16.0424, -15.6087]],
											        [[-17.1651, -15.8725, -12.9653], [-17.2580, -17.3718, -14.8223], [-16.6058, -16.8783, -16.7452]],
											        [[-3.6456, -3.0209, -1.4203], [-3.0797, -3.1959, -2.0000], [-1.8757, -1.9217, -1.6997]],
											    ]						).to(SCREAMING_SNAKE_CASE						)
											self.assertTrue(torch.allclose(outputs.logits[0, :3, :3, :3]     ,    SCREAMING_SNAKE_CASE     ,    atol=1e-1						)						)






					@slow
					def 							SCREAMING_SNAKE_CASE_  (						self	:		str						)			->	List[Any]:




											'''simple docstring'''

											__snake_case				=		SegformerImageProcessor(
											    image_scale=(5_1_2, 5_1_2)     ,    keep_ratio=SCREAMING_SNAKE_CASE     ,    align=SCREAMING_SNAKE_CASE     ,    do_random_crop=SCREAMING_SNAKE_CASE						)
											__snake_case				=		SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512"						).to(
											    SCREAMING_SNAKE_CASE						)

											__snake_case				=		prepare_img()
											__snake_case				=		image_processor(images=SCREAMING_SNAKE_CASE     ,    return_tensors="pt"						)
											__snake_case				=		encoded_inputs.pixel_values.to(SCREAMING_SNAKE_CASE						)

											with torch.no_grad():
																	__snake_case				=		model(SCREAMING_SNAKE_CASE						)

											__snake_case				=		outputs.logits.detach().cpu()

											__snake_case				=		image_processor.post_process_semantic_segmentation(outputs=SCREAMING_SNAKE_CASE     ,    target_sizes=[(5_0_0, 3_0_0)]						)
											__snake_case				=		torch.Size((5_0_0, 3_0_0)						)
											self.assertEqual(segmentation[0].shape     ,    SCREAMING_SNAKE_CASE						)

											__snake_case				=		image_processor.post_process_semantic_segmentation(outputs=SCREAMING_SNAKE_CASE						)
											__snake_case				=		torch.Size((1_2_8, 1_2_8)						)
											self.assertEqual(segmentation[0].shape     ,    SCREAMING_SNAKE_CASE						)









from collections import OrderedDict
from typing import Mapping

from packaging import version

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


A							:					Union[str, Any]     						=     logging.get_logger(__name__)

A							:					Tuple     						=     {
    'facebook/data2vec-vision-base-ft': (
        'https://huggingface.co/facebook/data2vec-vision-base-ft/resolve/main/config.json'
    ),
}






class     UpperCamelCase(  _a   ):
					snake_case_		:				List[Any]										=	"""data2vec-vision"""


					def __init__(						self	:		Any     ,    SCREAMING_SNAKE_CASE	:		List[str]=7_6_8     ,    SCREAMING_SNAKE_CASE	:		Tuple=1_2     ,    SCREAMING_SNAKE_CASE	:		int=1_2     ,    SCREAMING_SNAKE_CASE	:		List[str]=3_0_7_2     ,    SCREAMING_SNAKE_CASE	:		Tuple="gelu"     ,    SCREAMING_SNAKE_CASE	:		Optional[Any]=0.0     ,    SCREAMING_SNAKE_CASE	:		List[Any]=0.0     ,    SCREAMING_SNAKE_CASE	:		Any=0.02     ,    SCREAMING_SNAKE_CASE	:		List[str]=1e-1_2     ,    SCREAMING_SNAKE_CASE	:		Optional[int]=2_2_4     ,    SCREAMING_SNAKE_CASE	:		Optional[int]=1_6     ,    SCREAMING_SNAKE_CASE	:		str=3     ,    SCREAMING_SNAKE_CASE	:		Optional[Any]=False     ,    SCREAMING_SNAKE_CASE	:		Any=False     ,    SCREAMING_SNAKE_CASE	:		Dict=False     ,    SCREAMING_SNAKE_CASE	:		int=False     ,    SCREAMING_SNAKE_CASE	:		Tuple=0.1     ,    SCREAMING_SNAKE_CASE	:		Any=0.1     ,    SCREAMING_SNAKE_CASE	:		Any=True     ,    SCREAMING_SNAKE_CASE	:		List[str]=[3, 5, 7, 1_1]     ,    SCREAMING_SNAKE_CASE	:		int=[1, 2, 3, 6]     ,    SCREAMING_SNAKE_CASE	:		List[str]=True     ,    SCREAMING_SNAKE_CASE	:		Tuple=0.4     ,    SCREAMING_SNAKE_CASE	:		Optional[Any]=2_5_6     ,    SCREAMING_SNAKE_CASE	:		Tuple=1     ,    SCREAMING_SNAKE_CASE	:		Optional[int]=False     ,    SCREAMING_SNAKE_CASE	:		List[Any]=2_5_5     ,    **SCREAMING_SNAKE_CASE	:		Any     ,    )			->	List[str]:




											'''simple docstring'''

											super().__init__(**SCREAMING_SNAKE_CASE						)

											__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				=		initializer_range
											__snake_case				=		layer_norm_eps

											__snake_case				=		image_size
											__snake_case				=		patch_size
											__snake_case				=		num_channels
											__snake_case				=		use_mask_token
											__snake_case				=		use_absolute_position_embeddings
											__snake_case				=		use_relative_position_bias
											__snake_case				=		use_shared_relative_position_bias
											__snake_case				=		layer_scale_init_value
											__snake_case				=		drop_path_rate
											__snake_case				=		use_mean_pooling
											# decode head attributes (semantic segmentation)
											__snake_case				=		out_indices
											__snake_case				=		pool_scales
											# auxiliary head attributes (semantic segmentation)
											__snake_case				=		use_auxiliary_head
											__snake_case				=		auxiliary_loss_weight
											__snake_case				=		auxiliary_channels
											__snake_case				=		auxiliary_num_convs
											__snake_case				=		auxiliary_concat_input
											__snake_case				=		semantic_loss_ignore_index






class     UpperCamelCase(  _a   ):
					snake_case_		:				Any										=	version.parse("""1.11"""   )


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




											'''simple docstring'''

											return OrderedDict(
											    [
											        ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
											    ]						)






					@property
					def 							SCREAMING_SNAKE_CASE_  (						self	:		Union[str, Any]						)			->	float:




											'''simple docstring'''

											return 1e-4





