
"""simple docstring"""



import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast
@dataclass
class        _SCREAMING_SNAKE_CASE  (  datasets.BuilderConfig							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Optional[datasets.Features]							=					None






class        _SCREAMING_SNAKE_CASE  (  datasets.ArrowBasedBuilder							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Any							=					PandasConfig


				def 				__lowerCamelCase	(					self	:			Optional[int]  )		->  int:







											"""simple docstring"""




											return datasets.DatasetInfo(features=self.config.features  )


				def 				__lowerCamelCase	(					self	:			Union[str, Any]				,     UpperCAmelCase_	:			Dict  )		->  Tuple:







											"""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}"""  )
											_lowerCAmelCase  	=			dl_manager.download_and_extract(self.config.data_files  )
											if isinstance(UpperCAmelCase_				,     (str, list, tuple)  ):
																		_lowerCAmelCase  	=			data_files
																		if isinstance(UpperCAmelCase_				,     UpperCAmelCase_  ):
																									_lowerCAmelCase  	=			[files]
																		# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
																		_lowerCAmelCase  	=			[dl_manager.iter_files(UpperCAmelCase_  ) for file in files]
																		return [datasets.SplitGenerator(name=datasets.Split.TRAIN				,     gen_kwargs={'files': files}  )]
											_lowerCAmelCase  	=			[]
											for split_name, files in data_files.items():
																		if isinstance(UpperCAmelCase_				,     UpperCAmelCase_  ):
																									_lowerCAmelCase  	=			[files]
																		# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
																		_lowerCAmelCase  	=			[dl_manager.iter_files(UpperCAmelCase_  ) for file in files]
																		splits.append(datasets.SplitGenerator(name=UpperCAmelCase_				,     gen_kwargs={'files': files}  )  )
											return splits


				def 				__lowerCamelCase	(					self	:			Tuple				,     UpperCAmelCase_	:			pa.Table  )		->  pa.Table:







											"""simple docstring"""




											if self.config.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
																		_lowerCAmelCase  	=			table_cast(UpperCAmelCase_				,     self.config.features.arrow_schema  )
											return pa_table







				def 				__lowerCamelCase	(					self	:			Union[str, Any]				,     UpperCAmelCase_	:			Union[str, Any]  )		->  Dict:







											"""simple docstring"""




											for i, file in enumerate(itertools.chain.from_iterable(UpperCAmelCase_  )  ):
																		with open(UpperCAmelCase_				,     'rb'  ) as f:
																									_lowerCAmelCase  	=			pa.Table.from_pandas(pd.read_pickle(UpperCAmelCase_  )  )
																									yield i, self._cast_table(UpperCAmelCase_  )



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


_snake_case          =						logging.get_logger(__name__)

_snake_case          =						{
    '''google/mobilenet_v1_1.0_224''': '''https://huggingface.co/google/mobilenet_v1_1.0_224/resolve/main/config.json''',
    '''google/mobilenet_v1_0.75_192''': '''https://huggingface.co/google/mobilenet_v1_0.75_192/resolve/main/config.json''',
    # See all MobileNetV1 models at https://huggingface.co/models?filter=mobilenet_v1
}
class        _SCREAMING_SNAKE_CASE  (  UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Dict							=					"mobilenet_v1"


				def __init__(					self	:			List[Any]				,     UpperCAmelCase_	:			Optional[int]=3				,     UpperCAmelCase_	:			str=224				,     UpperCAmelCase_	:			Union[str, Any]=1.0				,     UpperCAmelCase_	:			List[str]=8				,     UpperCAmelCase_	:			Union[str, Any]="relu6"				,     UpperCAmelCase_	:			Optional[Any]=True				,     UpperCAmelCase_	:			Optional[int]=0.999				,     UpperCAmelCase_	:			Optional[Any]=0.02				,     UpperCAmelCase_	:			Union[str, Any]=0.001				,     **UpperCAmelCase_	:			List[Any]				,     )		->  Dict:







											"""simple docstring"""




											super().__init__(**UpperCAmelCase_  )

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

											_lowerCAmelCase  	=			num_channels
											_lowerCAmelCase  	=			image_size
											_lowerCAmelCase  	=			depth_multiplier
											_lowerCAmelCase  	=			min_depth
											_lowerCAmelCase  	=			hidden_act
											_lowerCAmelCase  	=			tf_padding
											_lowerCAmelCase  	=			classifier_dropout_prob
											_lowerCAmelCase  	=			initializer_range
											_lowerCAmelCase  	=			layer_norm_eps






class        _SCREAMING_SNAKE_CASE  (  UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Optional[int]							=					version.parse("1.11"							)


				@property
				def 				__lowerCamelCase	(					self	:			List[str]  )		->  Mapping[str, Mapping[int, str]]:







											"""simple docstring"""




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


				@property
				def 				__lowerCamelCase	(					self	:			Dict  )		->  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 				__lowerCamelCase	(					self	:			Optional[Any]  )		->  float:







											"""simple docstring"""




											return 1E-4






