



"""simple docstring"""



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


lowercase_							 =       logging.get_logger(__name__)

lowercase_							 =       {
    "apple/mobilevit-small": "https://huggingface.co/apple/mobilevit-small/resolve/main/config.json",
    "apple/mobilevit-x-small": "https://huggingface.co/apple/mobilevit-x-small/resolve/main/config.json",
    "apple/mobilevit-xx-small": "https://huggingface.co/apple/mobilevit-xx-small/resolve/main/config.json",
    "apple/deeplabv3-mobilevit-small": (
        "https://huggingface.co/apple/deeplabv3-mobilevit-small/resolve/main/config.json"
    ),
    "apple/deeplabv3-mobilevit-x-small": (
        "https://huggingface.co/apple/deeplabv3-mobilevit-x-small/resolve/main/config.json"
    ),
    "apple/deeplabv3-mobilevit-xx-small": (
        "https://huggingface.co/apple/deeplabv3-mobilevit-xx-small/resolve/main/config.json"
    ),
    # See all MobileViT models at https://huggingface.co/models?filter=mobilevit
}







class       __a	(   SCREAMING_SNAKE_CASE__       ):
				lowerCamelCase    :					Any 					='mobilevit'







				def __init__(   self			,  UpperCAmelCase=3			,  UpperCAmelCase=256			,  UpperCAmelCase=2			,  UpperCAmelCase=[144, 192, 240]			,  UpperCAmelCase=[16, 32, 64, 96, 128, 160, 640]			,  UpperCAmelCase=4			,  UpperCAmelCase=2.0			,  UpperCAmelCase=4.0			,  UpperCAmelCase="silu"			,  UpperCAmelCase=3			,  UpperCAmelCase=32			,  UpperCAmelCase=0.1			,  UpperCAmelCase=0.0			,  UpperCAmelCase=0.1			,  UpperCAmelCase=0.0_2			,  UpperCAmelCase=1E-5			,  UpperCAmelCase=True			,  UpperCAmelCase=256			,  UpperCAmelCase=[6, 12, 18]			,  UpperCAmelCase=0.1			,  UpperCAmelCase=255			,  **UpperCAmelCase			,  ):

					'''simple docstring'''






					super().__init__(**a_      )

					lowerCAmelCase_			       = num_channels
					lowerCAmelCase_			       = image_size
					lowerCAmelCase_			       = patch_size
					lowerCAmelCase_			       = hidden_sizes
					lowerCAmelCase_			       = neck_hidden_sizes
					lowerCAmelCase_			       = num_attention_heads
					lowerCAmelCase_			       = mlp_ratio
					lowerCAmelCase_			       = expand_ratio
					lowerCAmelCase_			       = hidden_act
					lowerCAmelCase_			       = conv_kernel_size
					lowerCAmelCase_			       = output_stride
					lowerCAmelCase_			       = hidden_dropout_prob
					lowerCAmelCase_			       = attention_probs_dropout_prob
					lowerCAmelCase_			       = classifier_dropout_prob
					lowerCAmelCase_			       = initializer_range
					lowerCAmelCase_			       = layer_norm_eps
					lowerCAmelCase_			       = qkv_bias

					# decode head attributes for semantic segmentation
					lowerCAmelCase_			       = aspp_out_channels
					lowerCAmelCase_			       = atrous_rates
					lowerCAmelCase_			       = aspp_dropout_prob
					lowerCAmelCase_			       = semantic_loss_ignore_index







class       __a	(   SCREAMING_SNAKE_CASE__       ):
				lowerCamelCase    :					Optional[Any] 					=version.parse('1.11'       )







				@property
				def     lowerCamelCase_    (   self      ):

					'''simple docstring'''






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







				@property
				def     lowerCamelCase_    (   self      ):

					'''simple docstring'''






					if self.task == "image-classification":
						return OrderedDict([('''logits''', {0: '''batch'''})]      )
					else:
						return OrderedDict([('''last_hidden_state''', {0: '''batch'''}), ('''pooler_output''', {0: '''batch'''})]      )







				@property
				def     lowerCamelCase_    (   self      ):

					'''simple docstring'''






					return 1E-4



"""simple docstring"""



from typing import TYPE_CHECKING

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


lowercase_							 =       {'configuration_pegasus': ['PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusConfig']}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							 =       ['PegasusTokenizer']

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							 =       ['PegasusTokenizerFast']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							 =       [
		    'PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'PegasusForCausalLM',
		    'PegasusForConditionalGeneration',
		    'PegasusModel',
		    'PegasusPreTrainedModel',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							 =       [
		    'TFPegasusForConditionalGeneration',
		    'TFPegasusModel',
		    'TFPegasusPreTrainedModel',
		]

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							 =       [
		    'FlaxPegasusForConditionalGeneration',
		    'FlaxPegasusModel',
		    'FlaxPegasusPreTrainedModel',
		]


if TYPE_CHECKING:
		from .configuration_pegasus import PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_pegasus import PegasusTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_pegasus_fast import PegasusTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_pegasus import (
				    PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST,
				    PegasusForCausalLM,
				    PegasusForConditionalGeneration,
				    PegasusModel,
				    PegasusPreTrainedModel,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_pegasus import TFPegasusForConditionalGeneration, TFPegasusModel, TFPegasusPreTrainedModel

		try:
				if not is_flax_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_flax_pegasus import (
				    FlaxPegasusForConditionalGeneration,
				    FlaxPegasusModel,
				    FlaxPegasusPreTrainedModel,
				)

else:
		import sys

		lowercase_							 =       _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)