






'''simple docstring'''


from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowerCamelCase_				: List[str]    	=							logging.get_logger(__name__)
class    _SCREAMING_SNAKE_CASE							(		SCREAMING_SNAKE_CASE       ,SCREAMING_SNAKE_CASE	):


			'''simple docstring'''





			__a							:							Union[str, Any]					     =					"maskformer-swin"

			__a							:							Tuple					     =					{
			    "num_attention_heads": "num_heads",
			    "num_hidden_layers": "num_layers",
			}






			def __init__(   self							:						str ,      lowercase							:						str=2_2_4 ,      lowercase							:						str=4 ,      lowercase							:						Tuple=3 ,      lowercase							:						List[str]=9_6 ,      lowercase							:						str=[2, 2, 6, 2] ,      lowercase							:						Tuple=[3, 6, 1_2, 2_4] ,      lowercase							:						Tuple=7 ,      lowercase							:						List[Any]=4.0 ,      lowercase							:						Union[str, Any]=True ,      lowercase							:						List[Any]=0.0 ,      lowercase							:						Any=0.0 ,      lowercase							:						Tuple=0.1 ,      lowercase							:						str="gelu" ,      lowercase							:						Dict=False ,      lowercase							:						Optional[int]=0.0_2 ,      lowercase							:						Union[str, Any]=1e-5 ,      lowercase							:						Any=None ,      lowercase							:						List[str]=None ,      **lowercase							:						str ,      )							->    str:

									'''simple docstring'''







									super().__init__(**lowercase			)

									UpperCamelCase__         = image_size
									UpperCamelCase__         = patch_size
									UpperCamelCase__         = num_channels
									UpperCamelCase__         = embed_dim
									UpperCamelCase__         = depths
									UpperCamelCase__         = len(lowercase			)
									UpperCamelCase__         = num_heads
									UpperCamelCase__         = window_size
									UpperCamelCase__         = mlp_ratio
									UpperCamelCase__         = qkv_bias
									UpperCamelCase__         = hidden_dropout_prob
									UpperCamelCase__         = attention_probs_dropout_prob
									UpperCamelCase__         = drop_path_rate
									UpperCamelCase__         = hidden_act
									UpperCamelCase__         = use_absolute_embeddings
									UpperCamelCase__         = layer_norm_eps
									UpperCamelCase__         = initializer_range
									# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
									# this indicates the channel dimension after the last stage of the model
									UpperCamelCase__         = int(embed_dim * 2 ** (len(lowercase			) - 1)			)
									UpperCamelCase__         = ["""stem"""] + [f"stage{idx}" for idx in range(1 ,      len(lowercase			) + 1			)]
									UpperCamelCase__    ,   UpperCamelCase__         = get_aligned_output_features_output_indices(
									    out_features=lowercase ,      out_indices=lowercase ,      stage_names=self.stage_names			)








'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


lowerCamelCase_				: Tuple    	=							{
    '''configuration_layoutlmv3''': [
        '''LAYOUTLMV3_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''LayoutLMv3Config''',
        '''LayoutLMv3OnnxConfig''',
    ],
    '''processing_layoutlmv3''': ['''LayoutLMv3Processor'''],
    '''tokenization_layoutlmv3''': ['''LayoutLMv3Tokenizer'''],
}

try:
					if not is_tokenizers_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_				: Tuple    	=							['''LayoutLMv3TokenizerFast''']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_				: Union[str, Any]    	=							[
					    '''LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''LayoutLMv3ForQuestionAnswering''',
					    '''LayoutLMv3ForSequenceClassification''',
					    '''LayoutLMv3ForTokenClassification''',
					    '''LayoutLMv3Model''',
					    '''LayoutLMv3PreTrainedModel''',
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_				: Optional[Any]    	=							[
					    '''TF_LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''TFLayoutLMv3ForQuestionAnswering''',
					    '''TFLayoutLMv3ForSequenceClassification''',
					    '''TFLayoutLMv3ForTokenClassification''',
					    '''TFLayoutLMv3Model''',
					    '''TFLayoutLMv3PreTrainedModel''',
					]

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCamelCase_				: Optional[Any]    	=							['''LayoutLMv3FeatureExtractor''']
					lowerCamelCase_				: Dict    	=							['''LayoutLMv3ImageProcessor''']


if TYPE_CHECKING:
					from .configuration_layoutlmva import (
					    LAYOUTLMV3_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    LayoutLMvaConfig,
					    LayoutLMvaOnnxConfig,
					)
					from .processing_layoutlmva import LayoutLMvaProcessor
					from .tokenization_layoutlmva import LayoutLMvaTokenizer

					try:
										if not is_tokenizers_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_layoutlmva_fast import LayoutLMvaTokenizerFast

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_layoutlmva import (
										    LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST,
										    LayoutLMvaForQuestionAnswering,
										    LayoutLMvaForSequenceClassification,
										    LayoutLMvaForTokenClassification,
										    LayoutLMvaModel,
										    LayoutLMvaPreTrainedModel,
										)

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_layoutlmva import (
										    TF_LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFLayoutLMvaForQuestionAnswering,
										    TFLayoutLMvaForSequenceClassification,
										    TFLayoutLMvaForTokenClassification,
										    TFLayoutLMvaModel,
										    TFLayoutLMvaPreTrainedModel,
										)

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .feature_extraction_layoutlmva import LayoutLMvaFeatureExtractor
										from .image_processing_layoutlmva import LayoutLMvaImageProcessor

else:
					import sys

					lowerCamelCase_				: Optional[Any]    	=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
