


"""simple docstring"""


from typing import TYPE_CHECKING

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


_snake_case          =							{
    "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:
   _snake_case          =							["LayoutLMv3TokenizerFast"]

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _snake_case          =							[
       "LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST",
       "LayoutLMv3ForQuestionAnswering",
       "LayoutLMv3ForSequenceClassification",
       "LayoutLMv3ForTokenClassification",
       "LayoutLMv3Model",
       "LayoutLMv3PreTrainedModel",
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _snake_case          =							[
       "TF_LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST",
       "TFLayoutLMv3ForQuestionAnswering",
       "TFLayoutLMv3ForSequenceClassification",
       "TFLayoutLMv3ForTokenClassification",
       "TFLayoutLMv3Model",
       "TFLayoutLMv3PreTrainedModel",
   ]

try:
   if not is_vision_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _snake_case          =							["LayoutLMv3FeatureExtractor"]
   _snake_case          =							["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

   _snake_case          =							_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)







"""simple docstring"""


from ...configuration_utils import PretrainedConfig
from ...utils import logging


_snake_case          =							logging.get_logger(__name__)

_snake_case          =							{
    "microsoft/swinv2-tiny-patch4-window8-256": (
        "https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256/resolve/main/config.json"
    ),
}



class   _a      (      SCREAMING_SNAKE_CASE_ ):
    a_    :				Union[str, Any]             =    'swinv2'

    a_    :				Optional[int]             =    {
        'num_attention_heads': 'num_heads',
        'num_hidden_layers': 'num_layers',
    }
    def __init__( self							:					List[str]							,					SCREAMING_SNAKE_CASE__							:					int=2_24							,					SCREAMING_SNAKE_CASE__							:					str=4							,					SCREAMING_SNAKE_CASE__							:					List[Any]=3							,					SCREAMING_SNAKE_CASE__							:					str=96							,					SCREAMING_SNAKE_CASE__							:					Dict=[2, 2, 6, 2]							,					SCREAMING_SNAKE_CASE__							:					Union[str, Any]=[3, 6, 12, 24]							,					SCREAMING_SNAKE_CASE__							:					Tuple=7							,					SCREAMING_SNAKE_CASE__							:					Union[str, Any]=4.0							,					SCREAMING_SNAKE_CASE__							:					List[str]=True							,					SCREAMING_SNAKE_CASE__							:					List[Any]=0.0							,					SCREAMING_SNAKE_CASE__							:					Optional[int]=0.0							,					SCREAMING_SNAKE_CASE__							:					Dict=0.1							,					SCREAMING_SNAKE_CASE__							:					Tuple="gelu"							,					SCREAMING_SNAKE_CASE__							:					Tuple=False							,					SCREAMING_SNAKE_CASE__							:					Any=0.02							,					SCREAMING_SNAKE_CASE__							:					List[Any]=1e-5							,					SCREAMING_SNAKE_CASE__							:					int=32							,					**SCREAMING_SNAKE_CASE__							:					List[str]							,					):
          super().__init__(**SCREAMING_SNAKE_CASE__				)

          lowerCamelCase__           =		image_size
          lowerCamelCase__           =		patch_size
          lowerCamelCase__           =		num_channels
          lowerCamelCase__           =		embed_dim
          lowerCamelCase__           =		depths
          lowerCamelCase__           =		len(SCREAMING_SNAKE_CASE__				)
          lowerCamelCase__           =		num_heads
          lowerCamelCase__           =		window_size
          lowerCamelCase__           =		mlp_ratio
          lowerCamelCase__           =		qkv_bias
          lowerCamelCase__           =		hidden_dropout_prob
          lowerCamelCase__           =		attention_probs_dropout_prob
          lowerCamelCase__           =		drop_path_rate
          lowerCamelCase__           =		hidden_act
          lowerCamelCase__           =		use_absolute_embeddings
          lowerCamelCase__           =		layer_norm_eps
          lowerCamelCase__           =		initializer_range
          lowerCamelCase__           =		encoder_stride
          # we set the hidden_size attribute in order to make Swinv2 work with VisionEncoderDecoderModel
          # this indicates the channel dimension after the last stage of the model
          lowerCamelCase__           =		int(embed_dim * 2 ** (len(SCREAMING_SNAKE_CASE__				) - 1)				)
          lowerCamelCase__           =		(0, 0, 0, 0)



