





'''simple docstring'''




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


__UpperCAmelCase            =       {
    """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCAmelCase            =       [
							    """FALCON_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """FalconForCausalLM""",
							    """FalconModel""",
							    """FalconPreTrainedModel""",
							    """FalconForSequenceClassification""",
							    """FalconForTokenClassification""",
							    """FalconForQuestionAnswering""",
							]


if TYPE_CHECKING:
							from .configuration_falcon import FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP, FalconConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_falcon import (
														    FALCON_PRETRAINED_MODEL_ARCHIVE_LIST,
														    FalconForCausalLM,
														    FalconForQuestionAnswering,
														    FalconForSequenceClassification,
														    FalconForTokenClassification,
														    FalconModel,
														    FalconPreTrainedModel,
														)


else:
							import sys

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










'''simple docstring'''




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


__UpperCAmelCase            =       logging.get_logger(__name__)

__UpperCAmelCase            =       {
    """naver-clova-ix/donut-base""": """https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json""",
    # See all Donut models at https://huggingface.co/models?filter=donut-swin
}




class      UpperCamelCase__					(					lowercase_			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	'''donut-swin'''

					SCREAMING_SNAKE_CASE__				=	{
					    '''num_attention_heads''': '''num_heads''',
					    '''num_hidden_layers''': '''num_layers''',
					}


					def __init__(						self				:			str      ,						lowerCamelCase_				:			Union[str, Any]=2_24      ,						lowerCamelCase_				:			Union[str, Any]=4      ,						lowerCamelCase_				:			Optional[Any]=3      ,						lowerCamelCase_				:			Dict=96      ,						lowerCamelCase_				:			int=[2, 2, 6, 2]      ,						lowerCamelCase_				:			Optional[Any]=[3, 6, 12, 24]      ,						lowerCamelCase_				:			List[str]=7      ,						lowerCamelCase_				:			List[str]=4.0      ,						lowerCamelCase_				:			Optional[Any]=True      ,						lowerCamelCase_				:			List[str]=0.0      ,						lowerCamelCase_				:			Dict=0.0      ,						lowerCamelCase_				:			Dict=0.1      ,						lowerCamelCase_				:			Union[str, Any]="gelu"      ,						lowerCamelCase_				:			List[str]=False      ,						lowerCamelCase_				:			Optional[int]=0.02      ,						lowerCamelCase_				:			Any=1e-5      ,						**lowerCamelCase_				:			Union[str, Any]      ,						):

							'''simple docstring'''



							super().__init__(**lowerCamelCase_						)

							SCREAMING_SNAKE_CASE :				int		=			image_size
							SCREAMING_SNAKE_CASE :				Dict		=			patch_size
							SCREAMING_SNAKE_CASE :				str		=			num_channels
							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			embed_dim
							SCREAMING_SNAKE_CASE :				Optional[int]		=			depths
							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			len(lowerCamelCase_						)
							SCREAMING_SNAKE_CASE :				Optional[int]		=			num_heads
							SCREAMING_SNAKE_CASE :				Optional[int]		=			window_size
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			mlp_ratio
							SCREAMING_SNAKE_CASE :				Dict		=			qkv_bias
							SCREAMING_SNAKE_CASE :				Optional[int]		=			hidden_dropout_prob
							SCREAMING_SNAKE_CASE :				Tuple		=			attention_probs_dropout_prob
							SCREAMING_SNAKE_CASE :				Dict		=			drop_path_rate
							SCREAMING_SNAKE_CASE :				List[str]		=			hidden_act
							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			use_absolute_embeddings
							SCREAMING_SNAKE_CASE :				Tuple		=			layer_norm_eps
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			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
							SCREAMING_SNAKE_CASE :				str		=			int(embed_dim * 2 ** (len(lowerCamelCase_						) - 1)						)



