



"""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


UpperCamelCase     =							logging.get_logger(__name__)

UpperCamelCase     =							{
    """facebook/levit-128S""": """https://huggingface.co/facebook/levit-128S/resolve/main/config.json""",
    # See all LeViT models at https://huggingface.co/models?filter=levit
}






class       UpperCamelCase__			(   _lowerCAmelCase      ):

			"""simple docstring"""


			A__	:					Optional[int]							  =     "levit"


			def __init__(      self						,	SCREAMING_SNAKE_CASE__=224						,	SCREAMING_SNAKE_CASE__=3						,	SCREAMING_SNAKE_CASE__=3						,	SCREAMING_SNAKE_CASE__=2						,	SCREAMING_SNAKE_CASE__=1						,	SCREAMING_SNAKE_CASE__=16						,	SCREAMING_SNAKE_CASE__=[128, 256, 384]						,	SCREAMING_SNAKE_CASE__=[4, 8, 12]						,	SCREAMING_SNAKE_CASE__=[4, 4, 4]						,	SCREAMING_SNAKE_CASE__=[16, 16, 16]						,	SCREAMING_SNAKE_CASE__=0						,	SCREAMING_SNAKE_CASE__=[2, 2, 2]						,	SCREAMING_SNAKE_CASE__=[2, 2, 2]						,	SCREAMING_SNAKE_CASE__=0.0_2						,	**SCREAMING_SNAKE_CASE__						,	)      ->	Optional[int]:
				super().__init__(**SCREAMING_SNAKE_CASE__		)
				A__											=					image_size
				A__											=					num_channels
				A__											=					kernel_size
				A__											=					stride
				A__											=					padding
				A__											=					hidden_sizes
				A__											=					num_attention_heads
				A__											=					depths
				A__											=					key_dim
				A__											=					drop_path_rate
				A__											=					patch_size
				A__											=					attention_ratio
				A__											=					mlp_ratio
				A__											=					initializer_range
				A__											=					[
				    ["Subsample", key_dim[0], hidden_sizes[0] // key_dim[0], 4, 2, 2],
				    ["Subsample", key_dim[0], hidden_sizes[1] // key_dim[0], 4, 2, 2],
				]






class       UpperCamelCase__			(   _lowerCAmelCase      ):

			"""simple docstring"""


			A__	:					int							  =     version.parse("1.11"      )


			@property
			def   snake_case__	(      self		)      ->	Mapping[str, Mapping[int, str]]:
				return OrderedDict(
				    [
				        ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
				    ]		)







			@property
			def   snake_case__	(      self		)      ->	float:
				return 1e-4









"""simple docstring"""







from typing import TYPE_CHECKING

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


UpperCamelCase     =							{
    """configuration_perceiver""": ["""PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PerceiverConfig""", """PerceiverOnnxConfig"""],
    """tokenization_perceiver""": ["""PerceiverTokenizer"""],
}

try:
			if not is_vision_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			UpperCamelCase     =							["""PerceiverFeatureExtractor"""]
			UpperCamelCase     =							["""PerceiverImageProcessor"""]

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			UpperCamelCase     =							[
			    """PERCEIVER_PRETRAINED_MODEL_ARCHIVE_LIST""",
			    """PerceiverForImageClassificationConvProcessing""",
			    """PerceiverForImageClassificationFourier""",
			    """PerceiverForImageClassificationLearned""",
			    """PerceiverForMaskedLM""",
			    """PerceiverForMultimodalAutoencoding""",
			    """PerceiverForOpticalFlow""",
			    """PerceiverForSequenceClassification""",
			    """PerceiverLayer""",
			    """PerceiverModel""",
			    """PerceiverPreTrainedModel""",
			]


if TYPE_CHECKING:
			from .configuration_perceiver import PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP, PerceiverConfig, PerceiverOnnxConfig
			from .tokenization_perceiver import PerceiverTokenizer

			try:
						if not is_vision_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .feature_extraction_perceiver import PerceiverFeatureExtractor
						from .image_processing_perceiver import PerceiverImageProcessor

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_perceiver import (
						    PERCEIVER_PRETRAINED_MODEL_ARCHIVE_LIST,
						    PerceiverForImageClassificationConvProcessing,
						    PerceiverForImageClassificationFourier,
						    PerceiverForImageClassificationLearned,
						    PerceiverForMaskedLM,
						    PerceiverForMultimodalAutoencoding,
						    PerceiverForOpticalFlow,
						    PerceiverForSequenceClassification,
						    PerceiverLayer,
						    PerceiverModel,
						    PerceiverPreTrainedModel,
						)

else:
			import sys

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




