
from ctypes import c_float, sizeof
from enum import Enum
from typing import TYPE_CHECKING, Optional, Union


if TYPE_CHECKING:
							from .. import AutoFeatureExtractor, AutoProcessor, AutoTokenizer  # tests_ignore



class 			UpperCamelCase_			(						__UpperCamelCase   ):




							'''simple docstring'''

							UpperCamelCase_					   =							c_float
							@property
							def        lowerCAmelCase__ (				self) ->	int:
										return sizeof(self.value)



def       _lowercase					(      __SCREAMING_SNAKE_CASE				,    __SCREAMING_SNAKE_CASE				,    __SCREAMING_SNAKE_CASE = 0 )	->     int:
			# < 0 is possible if using a dynamic axis
			if dimension <= 0:
						UpperCamelCase__    :		List[Any]     =				fixed_dimension

			dimension -= num_token_to_add
			return dimension



def       _lowercase					(      __SCREAMING_SNAKE_CASE				,    __SCREAMING_SNAKE_CASE )	->     int:
			return num_parameters * dtype.size



def       _lowercase					(      __SCREAMING_SNAKE_CASE )	->     Optional[Union["AutoTokenizer", "AutoFeatureExtractor", "AutoProcessor"]]:
			from .. import AutoFeatureExtractor, AutoProcessor, AutoTokenizer  # tests_ignore

			try:
						return AutoProcessor.from_pretrained(__SCREAMING_SNAKE_CASE )
			except (ValueError, OSError, KeyError):
						UpperCamelCase__    :		str     =				None, None
						try:
									UpperCamelCase__    :		str     =				AutoTokenizer.from_pretrained(__SCREAMING_SNAKE_CASE )
						except (OSError, KeyError):
									pass
						try:
									UpperCamelCase__    :		Optional[Any]     =				AutoFeatureExtractor.from_pretrained(__SCREAMING_SNAKE_CASE )
						except (OSError, KeyError):
									pass

						if tokenizer is not None and feature_extractor is not None:
									raise ValueError(
									    F"""Couldn't auto-detect preprocessor for {model_name}. Found both a tokenizer and a feature extractor.""" )
						elif tokenizer is None and feature_extractor is None:
									return None
						elif tokenizer is not None:
									return tokenizer
						else:
									return feature_extractor





from typing import TYPE_CHECKING

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


UpperCAmelCase__				:  str       					=				{
    '''configuration_mobilevitv2''': [
        '''MOBILEVITV2_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''MobileViTV2Config''',
        '''MobileViTV2OnnxConfig''',
    ],
}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__				:  List[Any]       					=				[
							    '''MOBILEVITV2_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''MobileViTV2ForImageClassification''',
							    '''MobileViTV2ForSemanticSegmentation''',
							    '''MobileViTV2Model''',
							    '''MobileViTV2PreTrainedModel''',
							]

if TYPE_CHECKING:
							from .configuration_mobilevitva import (
							    MOBILEVITV2_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    MobileViTVaConfig,
							    MobileViTVaOnnxConfig,
							)

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_mobilevitva import (
														    MOBILEVITV2_PRETRAINED_MODEL_ARCHIVE_LIST,
														    MobileViTVaForImageClassification,
														    MobileViTVaForSemanticSegmentation,
														    MobileViTVaModel,
														    MobileViTVaPreTrainedModel,
														)

else:
							import sys

							UpperCAmelCase__				:  List[str]       					=				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



