






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


lowerCAmelCase_ : List[Any]						  =      logging.get_logger(__name__)

lowerCAmelCase_ : Optional[int]						  =      {
    "facebook/deit-base-distilled-patch16-224": (
        "https://huggingface.co/facebook/deit-base-patch16-224/resolve/main/config.json"
    ),
    # See all DeiT models at https://huggingface.co/models?filter=deit
}





class 							lowercase						(						__lowerCamelCase ):
   lowerCamelCase_    					='deit'


   def __init__(   self				:	Union[str, Any]   ,		__lowerCAmelCase				:	Optional[int]=768   ,		__lowerCAmelCase				:	Optional[Any]=12   ,		__lowerCAmelCase				:	Tuple=12   ,		__lowerCAmelCase				:	Optional[int]=3072   ,		__lowerCAmelCase				:	Dict="gelu"   ,		__lowerCAmelCase				:	List[Any]=0.0   ,		__lowerCAmelCase				:	str=0.0   ,		__lowerCAmelCase				:	List[Any]=0.02   ,		__lowerCAmelCase				:	Dict=1e-12   ,		__lowerCAmelCase				:	str=224   ,		__lowerCAmelCase				:	List[str]=16   ,		__lowerCAmelCase				:	Tuple=3   ,		__lowerCAmelCase				:	int=True   ,		__lowerCAmelCase				:	int=16   ,		**__lowerCAmelCase				:	Any   ,		)      ->					int:
         super().__init__(**__lowerCAmelCase)

         lowercase_     =      hidden_size
         lowercase_     =      num_hidden_layers
         lowercase_     =      num_attention_heads
         lowercase_     =      intermediate_size
         lowercase_     =      hidden_act
         lowercase_     =      hidden_dropout_prob
         lowercase_     =      attention_probs_dropout_prob
         lowercase_     =      initializer_range
         lowercase_     =      layer_norm_eps
         lowercase_     =      image_size
         lowercase_     =      patch_size
         lowercase_     =      num_channels
         lowercase_     =      qkv_bias
         lowercase_     =      encoder_stride





class 							lowercase						(						__lowerCamelCase ):
   lowerCamelCase_    					=version.parse('1.11' )


   @property
   def __UpperCAmelCase       (   self				:	List[Any])      ->					Mapping[str, Mapping[int, str]]:
         return OrderedDict(
             [
                 ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
             ])


   @property
   def __UpperCAmelCase       (   self				:	Dict)      ->					float:
         return 1e-4







'''simple docstring'''

from typing import Callable, Optional

from .. import Features
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream





class 							lowercase						(						__lowerCamelCase ):


   def __init__(   self				:	str   ,		__lowerCAmelCase				:	Callable   ,		__lowerCAmelCase				:	Optional[Features] = None   ,		__lowerCAmelCase				:	str = None   ,		__lowerCAmelCase				:	bool = False   ,		__lowerCAmelCase				:	bool = False   ,		__lowerCAmelCase				:	Optional[dict] = None   ,		__lowerCAmelCase				:	Optional[int] = None   ,		**__lowerCAmelCase				:	Union[str, Any]   ,		)      ->					List[Any]:
         super().__init__(
             features=__lowerCAmelCase   ,		cache_dir=__lowerCAmelCase   ,		keep_in_memory=__lowerCAmelCase   ,		streaming=__lowerCAmelCase   ,		num_proc=__lowerCAmelCase   ,		**__lowerCAmelCase   ,		)
         lowercase_     =      Generator(
             cache_dir=__lowerCAmelCase   ,		features=__lowerCAmelCase   ,		generator=__lowerCAmelCase   ,		gen_kwargs=__lowerCAmelCase   ,		**__lowerCAmelCase   ,		)


   def __UpperCAmelCase       (   self				:	Optional[int])      ->					List[str]:
         # Build iterable dataset
         if self.streaming:
               lowercase_     =      self.builder.as_streaming_dataset(split="train")
         # Build regular (map-style) dataset
         else:
               lowercase_     =      None
               lowercase_     =      None
               lowercase_     =      None
               lowercase_     =      None

               self.builder.download_and_prepare(
                   download_config=__lowerCAmelCase   ,		download_mode=__lowerCAmelCase   ,		verification_mode=__lowerCAmelCase   ,		base_path=__lowerCAmelCase   ,		num_proc=self.num_proc   ,		)
               lowercase_     =      self.builder.as_dataset(
                   split="train"   ,		verification_mode=__lowerCAmelCase   ,		in_memory=self.keep_in_memory)
         return dataset






