






import os
from typing import Optional

import fsspec
from fsspec.archive import AbstractArchiveFileSystem
from fsspec.utils import DEFAULT_BLOCK_SIZE
class       _UpperCAmelCase					(       A__	):

				"""simple docstring"""




				lowercase__											=       ""
				lowercase__											=       (
				    None  # protocol passed in prefix to the url. ex: "gzip", for gzip://file.txt::http://foo.bar/file.txt.gz
				)
				lowercase__											=       None  # compression type in fsspec. ex: "gzip"
				lowercase__											=       None  # extension of the filename to strip. ex: "".gz" to get file.txt from file.txt.gz




				def __init__(     self						:    List[Any],  lowerCamelCase						:    Optional[int] = "",  lowerCamelCase						:    Any = None,  lowerCamelCase						:    int = None,  **lowerCamelCase						:    Any  ):

								'''simple docstring'''
								super().__init__(self,  **__A  )
								# always open as "rb" since fsspec can then use the TextIOWrapper to make it work for "r" mode
								lowercase__    =			fsspec.open(
								    __A,  mode='''rb''',  protocol=__A,  compression=self.compression,  client_kwargs={
								        '''requote_redirect_url''': False,  # see https://github.com/huggingface/datasets/pull/5459
								        '''trust_env''': True,  # Enable reading proxy env variables.
								        **(target_options or {}).pop('''client_kwargs''',  {}  ),  # To avoid issues if it was already passed.
								    },  **(target_options or {}),  )
								lowercase__    =			os.path.basename(self.file.path.split('''::'''  )[0]  )
								lowercase__    =			(
								    self.compressed_name[: self.compressed_name.rindex('''.'''  )]
								    if "." in self.compressed_name
								    else self.compressed_name
								)
								lowercase__    =			None




				@classmethod
				def 				lowercase__   (     cls						:    Optional[Any],  lowerCamelCase						:    Dict  ):

								'''simple docstring'''
								return super()._strip_protocol(__A  ).lstrip('''/'''  )




				def 				lowercase__   (     self						:    Tuple  ):

								'''simple docstring'''





								if self.dir_cache is None:
												lowercase__    =			{**self.file.fs.info(self.file.path  ), "name": self.uncompressed_name}
												lowercase__    =			{f["name"]: f}




				def 				lowercase__   (     self						:    Union[str, Any],  lowerCamelCase						:    Dict  ):

								'''simple docstring'''
								return self.file.open().read()




				def 				lowercase__   (     self						:    Optional[int],  lowerCamelCase						:    Dict,  lowerCamelCase						:    Optional[Any] = "rb",  lowerCamelCase						:    int=None,  lowerCamelCase						:    Union[str, Any]=True,  lowerCamelCase						:    Optional[Any]=None,  **lowerCamelCase						:    str,  ):

								'''simple docstring'''
								lowercase__    =			self._strip_protocol(__A  )
								if mode != "rb":
												raise ValueError(F"""Tried to read with mode {mode} on file {self.file.path} opened with mode 'rb'"""  )
								return self.file.open()



class       _UpperCAmelCase					(       A__	):

				"""simple docstring"""




				lowercase__											=       "bz2"
				lowercase__											=       "bz2"
				lowercase__											=       ".bz2"



class       _UpperCAmelCase					(       A__	):

				"""simple docstring"""




				lowercase__											=       "gzip"
				lowercase__											=       "gzip"
				lowercase__											=       ".gz"



class       _UpperCAmelCase					(       A__	):

				"""simple docstring"""




				lowercase__											=       "lz4"
				lowercase__											=       "lz4"
				lowercase__											=       ".lz4"



class       _UpperCAmelCase					(       A__	):

				"""simple docstring"""




				lowercase__											=       "xz"
				lowercase__											=       "xz"
				lowercase__											=       ".xz"



class       _UpperCAmelCase					(       A__	):

				"""simple docstring"""




				lowercase__											=       "zstd"
				lowercase__											=       "zstd"
				lowercase__											=       ".zst"




				def __init__(     self						:    Optional[int],  lowerCamelCase						:    List[Any],  lowerCamelCase						:    Optional[int] = "rb",  lowerCamelCase						:    List[Any] = None,  lowerCamelCase						:    Any = None,  lowerCamelCase						:    Optional[int] = DEFAULT_BLOCK_SIZE,  **lowerCamelCase						:    Any,  ):

								'''simple docstring'''
								super().__init__(
								    fo=__A,  mode=__A,  target_protocol=__A,  target_options=__A,  block_size=__A,  **__A,  )
								# We need to wrap the zstd decompressor to avoid this error in fsspec==2021.7.0 and zstandard==0.15.2:
								#
								# File "/Users/user/.virtualenvs/hf-datasets/lib/python3.7/site-packages/fsspec/core.py", line 145, in open
								#     out.close = close
								# AttributeError: 'zstd.ZstdDecompressionReader' object attribute 'close' is read-only
								#
								# see https://github.com/intake/filesystem_spec/issues/725
								lowercase__    =			self.file.__enter__
								class       _UpperCAmelCase					:

												"""simple docstring"""




												def __init__(     self						:    List[str],  lowerCamelCase						:    Optional[int]  ):

																'''simple docstring'''
																lowercase__    =			file_




												def __enter__(     self						:    Optional[Any]  ):

																'''simple docstring'''
																self._file.__enter__()
																return self




												def __exit__(     self						:    Tuple,  *lowerCamelCase						:    Union[str, Any],  **lowerCamelCase						:    Optional[int]  ):

																'''simple docstring'''
																self._file.__exit__(*__A,  **__A  )




												def __iter__(     self						:    int  ):

																'''simple docstring'''
																return iter(self._file  )




												def 				lowercase__   (     self						:    Dict  ):

																'''simple docstring'''
																return next(self._file  )




												def __getattr__(     self						:    Any,  lowerCamelCase						:    str  ):

																'''simple docstring'''
																return getattr(self._file,  __A  )

								def fixed_enter(*lowerCamelCase						:    List[Any],  **lowerCamelCase						:    List[Any]  ):
												return WrappedFile(_enter(*__A,  **__A  )  )

								lowercase__    =			fixed_enter








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


_snake_case             =     logging.get_logger(__name__)

_snake_case             =     {
    '''google/mobilenet_v2_1.4_224''': '''https://huggingface.co/google/mobilenet_v2_1.4_224/resolve/main/config.json''',
    '''google/mobilenet_v2_1.0_224''': '''https://huggingface.co/google/mobilenet_v2_1.0_224/resolve/main/config.json''',
    '''google/mobilenet_v2_0.75_160''': '''https://huggingface.co/google/mobilenet_v2_0.75_160/resolve/main/config.json''',
    '''google/mobilenet_v2_0.35_96''': '''https://huggingface.co/google/mobilenet_v2_0.35_96/resolve/main/config.json''',
    # See all MobileNetV2 models at https://huggingface.co/models?filter=mobilenet_v2
}
class 	UpperCAmelCase_					(					UpperCamelCase    ):

   '''simple docstring'''




   __A :      Dict     		=		"mobilenet_v2"






   def __init__(		self						,				__A=3						,				__A=224						,				__A=1.0						,				__A=8						,				__A=8						,				__A=6						,				__A=32						,				__A=True						,				__A=True						,				__A="relu6"						,				__A=True						,				__A=0.8						,				__A=0.02						,				__A=0.001						,				__A=255						,				**__A						,				):






     """simple docstring"""





     super().__init__(**__A )

     if depth_multiplier <= 0:
       raise ValueError("depth_multiplier must be greater than zero." )

     lowerCamelCase :					str    =				num_channels
     lowerCamelCase :					Any    =				image_size
     lowerCamelCase :					Union[str, Any]    =				depth_multiplier
     lowerCamelCase :					Tuple    =				depth_divisible_by
     lowerCamelCase :					Dict    =				min_depth
     lowerCamelCase :					Dict    =				expand_ratio
     lowerCamelCase :					Optional[Any]    =				output_stride
     lowerCamelCase :					int    =				first_layer_is_expansion
     lowerCamelCase :					Union[str, Any]    =				finegrained_output
     lowerCamelCase :					Optional[Any]    =				hidden_act
     lowerCamelCase :					Optional[Any]    =				tf_padding
     lowerCamelCase :					Optional[Any]    =				classifier_dropout_prob
     lowerCamelCase :					Dict    =				initializer_range
     lowerCamelCase :					str    =				layer_norm_eps
     lowerCamelCase :					Optional[Any]    =				semantic_loss_ignore_index



class 	UpperCAmelCase_					(					UpperCamelCase    ):

   '''simple docstring'''




   __A :      Union[str, Any]     		=		version.parse("1.11"    )






   @property
   def _snake_case    (		self ):






     """simple docstring"""





     return OrderedDict([("pixel_values", {0: "batch"})] )






   @property
   def _snake_case    (		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 _snake_case    (		self ):






     """simple docstring"""





     return 1e-4



