
"""simple docstring"""







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


_SCREAMING_SNAKE_CASE	       =      logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE	       =      {
    """google/bit-50""": """https://huggingface.co/google/bit-50/resolve/main/config.json""",
}







class 							__magic_name__     (		lowercase__      ,		lowercase__   ):
					_SCREAMING_SNAKE_CASE       :					Union[str, Any]     							=   'bit'
					_SCREAMING_SNAKE_CASE       :					List[Any]     							=   ['preactivation', 'bottleneck']
					_SCREAMING_SNAKE_CASE       :					Dict     							=   ['SAME', 'VALID']





					def __init__(				self   :							Union[str, Any]							,						snake_case_   :							int=3							,						snake_case_   :							Tuple=64							,						snake_case_   :							str=[256, 512, 1024, 2048]							,						snake_case_   :							int=[3, 4, 6, 3]							,						snake_case_   :							int="preactivation"							,						snake_case_   :							Union[str, Any]="relu"							,						snake_case_   :							Dict=None							,						snake_case_   :							Dict=32							,						snake_case_   :							List[Any]=0.0							,						snake_case_   :							Optional[int]=False							,						snake_case_   :							Optional[int]=32							,						snake_case_   :							List[Any]=1							,						snake_case_   :							str=None							,						snake_case_   :							str=None							,						**snake_case_   :							Tuple							,						):
												super().__init__(**snake_case_    )
												if layer_type not in self.layer_types:
																			raise ValueError(F'''layer_type={layer_type} is not one of {",".join(self.layer_types    )}'''    )
												if global_padding is not None:
																			if global_padding.upper() in self.supported_padding:
																										__snake_case     			=       global_padding.upper()
																			else:
																										raise ValueError(F'''Padding strategy {global_padding} not supported'''    )
												__snake_case     			=       num_channels
												__snake_case     			=       embedding_size
												__snake_case     			=       hidden_sizes
												__snake_case     			=       depths
												__snake_case     			=       layer_type
												__snake_case     			=       hidden_act
												__snake_case     			=       global_padding
												__snake_case     			=       num_groups
												__snake_case     			=       drop_path_rate
												__snake_case     			=       embedding_dynamic_padding
												__snake_case     			=       output_stride
												__snake_case     			=       width_factor

												__snake_case     			=       ["stem"] + [F'''stage{idx}''' for idx in range(1							,						len(snake_case_    ) + 1    )]
												__snake_case			,   __snake_case     			=       get_aligned_output_features_output_indices(
												    out_features=snake_case_							,						out_indices=snake_case_							,						stage_names=self.stage_names    )


"""simple docstring"""







from typing import TYPE_CHECKING

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


_SCREAMING_SNAKE_CASE	       =      {
    """configuration_mobilevit""": ["""MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MobileViTConfig""", """MobileViTOnnxConfig"""],
}

try:
		if not is_vision_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_SCREAMING_SNAKE_CASE	       =      ["""MobileViTFeatureExtractor"""]
		_SCREAMING_SNAKE_CASE	       =      ["""MobileViTImageProcessor"""]

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_SCREAMING_SNAKE_CASE	       =      [
		    """MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
		    """MobileViTForImageClassification""",
		    """MobileViTForSemanticSegmentation""",
		    """MobileViTModel""",
		    """MobileViTPreTrainedModel""",
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_SCREAMING_SNAKE_CASE	       =      [
		    """TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
		    """TFMobileViTForImageClassification""",
		    """TFMobileViTForSemanticSegmentation""",
		    """TFMobileViTModel""",
		    """TFMobileViTPreTrainedModel""",
		]

if TYPE_CHECKING:
		from .configuration_mobilevit import MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP, MobileViTConfig, MobileViTOnnxConfig

		try:
				if not is_vision_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .feature_extraction_mobilevit import MobileViTFeatureExtractor
				from .image_processing_mobilevit import MobileViTImageProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_mobilevit import (
				    MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    MobileViTForImageClassification,
				    MobileViTForSemanticSegmentation,
				    MobileViTModel,
				    MobileViTPreTrainedModel,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_mobilevit import (
				    TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFMobileViTForImageClassification,
				    TFMobileViTForSemanticSegmentation,
				    TFMobileViTModel,
				    TFMobileViTPreTrainedModel,
				)


else:
		import sys

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