code: 
  
  
  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
  
  
  SCREAMING_SNAKE_CASE : Dict          =    logging.get_logger(__name__)
  
  SCREAMING_SNAKE_CASE : str          =    {
      "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 					snake_case__  ( __A       ):
  	UpperCAmelCase   :							List[str]         = """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.02				,    UpperCamelCase_=1e-5				,    UpperCamelCase_=True				,    UpperCamelCase_=256				,    UpperCamelCase_=[6, 12, 18]				,    UpperCamelCase_=0.1				,    UpperCamelCase_=255				,    **UpperCamelCase_				,    )		->			str:
  								"""simple docstring"""
  
  
  
  
  
  
  								super().__init__(**UpperCamelCase_							)
  
  								a_       :   Optional[int]			=	num_channels
  								a_       :   Optional[Any]			=	image_size
  								a_       :   int			=	patch_size
  								a_       :   List[str]			=	hidden_sizes
  								a_       :   Optional[int]			=	neck_hidden_sizes
  								a_       :   List[Any]			=	num_attention_heads
  								a_       :   Union[str, Any]			=	mlp_ratio
  								a_       :   List[str]			=	expand_ratio
  								a_       :   str			=	hidden_act
  								a_       :   Union[str, Any]			=	conv_kernel_size
  								a_       :   Optional[Any]			=	output_stride
  								a_       :   Union[str, Any]			=	hidden_dropout_prob
  								a_       :   List[Any]			=	attention_probs_dropout_prob
  								a_       :   List[Any]			=	classifier_dropout_prob
  								a_       :   Union[str, Any]			=	initializer_range
  								a_       :   List[Any]			=	layer_norm_eps
  								a_       :   str			=	qkv_bias
  
  								# decode head attributes for semantic segmentation
  								a_       :   Optional[Any]			=	aspp_out_channels
  								a_       :   Any			=	atrous_rates
  								a_       :   Union[str, Any]			=	aspp_dropout_prob
  								a_       :   Any			=	semantic_loss_ignore_index
  
  
  
  
  
  class 					snake_case__  ( __A       ):
  	UpperCAmelCase   :							Optional[int]         = version.parse("""1.11"""       )
  
  
  
  
  
  	@property
  	def     A				(  self							)		->			Mapping[str, Mapping[int, str]]:
  								"""simple docstring"""
  
  
  
  
  
  
  								return OrderedDict([("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""})]							)
  
  
  
  
  
  	@property
  	def     A				(  self							)		->			Mapping[str, Mapping[int, str]]:
  								"""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     A				(  self							)		->			float:
  								"""simple docstring"""
  
  
  
  
  
  
  								return 1e-4
  
  
  
style_context: 
  
  
  import itertools
  from dataclasses import dataclass
  from typing import Optional
  
  import pyarrow as pa
  
  import datasets
  from datasets.table import table_cast
  
  
  SCREAMING_SNAKE_CASE : int          =    datasets.utils.logging.get_logger(__name__)
  
  
  
  
  
  @dataclass
  class 					snake_case__  ( datasets.BuilderConfig       ):
  	UpperCAmelCase   :							Optional[datasets.Features]         = None
  
  
  
  
  
  class 					snake_case__  ( datasets.ArrowBasedBuilder       ):
  	UpperCAmelCase   :							Optional[int]         = ArrowConfig
  
  
  
  
  
  	def     A				(  self							)		->			str:
  								"""simple docstring"""
  
  
  
  
  
  
  								return datasets.DatasetInfo(features=self.config.features							)
  
  
  
  
  
  	def     A				(  self				,    UpperCamelCase_							)		->			str:
  								"""simple docstring"""
  
  
  
  
  
  
  								if not self.config.data_files:
  															raise ValueError(f"""At least one data file must be specified, but got data_files={self.config.data_files}"""							)
  								a_       :   List[str]			=	dl_manager.download_and_extract(self.config.data_files							)
  								if isinstance(UpperCamelCase_				,    (str, list, tuple)							):
  															a_       :   Dict			=	data_files
  															if isinstance(UpperCamelCase_				,    UpperCamelCase_							):
  																						a_       :   Optional[Any]			=	[files]
  															# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
  															a_       :   List[Any]			=	[dl_manager.iter_files(UpperCamelCase_							) for file in files]
  															return [datasets.SplitGenerator(name=datasets.Split.TRAIN				,    gen_kwargs={"""files""": files}							)]
  								a_       :   Any			=	[]
  								for split_name, files in data_files.items():
  															if isinstance(UpperCamelCase_				,    UpperCamelCase_							):
  																						a_       :   Dict			=	[files]
  															# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
  															a_       :   List[Any]			=	[dl_manager.iter_files(UpperCamelCase_							) for file in files]
  															# Infer features is they are stoed in the arrow schema
  															if self.info.features is None:
  																						for file in itertools.chain.from_iterable(UpperCamelCase_							):
  																													with open(UpperCamelCase_				,    """rb"""							) as f:
  																																				a_       :   List[str]			=	datasets.Features.from_arrow_schema(pa.ipc.open_stream(UpperCamelCase_							).schema							)
  																													break
  															splits.append(datasets.SplitGenerator(name=UpperCamelCase_				,    gen_kwargs={"""files""": files}							)							)
  								return splits
  
  
  
  
  
  	def     A				(  self				,    UpperCamelCase_							)		->			pa.Table:
  								"""simple docstring"""
  
  
  
  
  
  
  								if self.info.features is not None:
  															# more expensive cast to support nested features with keys in a different order
  															# allows str <-> int/float or str to Audio for example
  															a_       :   int			=	table_cast(UpperCamelCase_				,    self.info.features.arrow_schema							)
  								return pa_table
  
  
  
  
  
  	def     A				(  self				,    UpperCamelCase_							)		->			Optional[Any]:
  								"""simple docstring"""
  
  
  
  
  
  
  								for file_idx, file in enumerate(itertools.chain.from_iterable(UpperCamelCase_							)							):
  															with open(UpperCamelCase_				,    """rb"""							) as f:
  																						try:
  																													for batch_idx, record_batch in enumerate(pa.ipc.open_stream(UpperCamelCase_							)							):
  																																				a_       :   Tuple			=	pa.Table.from_batches([record_batch]							)
  																																				# Uncomment for debugging (will print the Arrow table size and elements)
  																																				# logger.warning(f"pa_table: {pa_table} num rows: {pa_table.num_rows}")
  																																				# logger.warning('\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))
  																																				yield f"""{file_idx}_{batch_idx}""", self._cast_table(UpperCamelCase_							)
  																						except ValueError as e:
  																													logger.error(f"""Failed to read file '{file}' with error {type(UpperCamelCase_							)}: {e}"""							)
  																													raise
  
  
  