




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						:   Optional[Any]		=   logging.get_logger(__name__)

_lowerCAmelCase						:   int		=   {
    "facebook/levit-128S": "https://huggingface.co/facebook/levit-128S/resolve/main/config.json",
    # See all LeViT models at https://huggingface.co/models?filter=levit
}
class 			_UpperCamelCase      (				_snake_case		):
      UpperCAmelCase_        =		"""levit"""
      def __init__(			self   :int ,      lowerCamelCase   :List[Any]=224 ,      lowerCamelCase   :Dict=3 ,      lowerCamelCase   :str=3 ,      lowerCamelCase   :List[str]=2 ,      lowerCamelCase   :Any=1 ,      lowerCamelCase   :Union[str, Any]=16 ,      lowerCamelCase   :Dict=[128, 256, 384] ,      lowerCamelCase   :List[Any]=[4, 8, 12] ,      lowerCamelCase   :Dict=[4, 4, 4] ,      lowerCamelCase   :List[Any]=[16, 16, 16] ,      lowerCamelCase   :Dict=0 ,      lowerCamelCase   :str=[2, 2, 2] ,      lowerCamelCase   :Optional[int]=[2, 2, 2] ,      lowerCamelCase   :Optional[Any]=0.02 ,      **lowerCamelCase   :str ,      )     ->			str:
       super().__init__(**lowerCAmelCase__      )
       UpperCAmelCase__							 =						image_size
       UpperCAmelCase__							 =						num_channels
       UpperCAmelCase__							 =						kernel_size
       UpperCAmelCase__							 =						stride
       UpperCAmelCase__							 =						padding
       UpperCAmelCase__							 =						hidden_sizes
       UpperCAmelCase__							 =						num_attention_heads
       UpperCAmelCase__							 =						depths
       UpperCAmelCase__							 =						key_dim
       UpperCAmelCase__							 =						drop_path_rate
       UpperCAmelCase__							 =						patch_size
       UpperCAmelCase__							 =						attention_ratio
       UpperCAmelCase__							 =						mlp_ratio
       UpperCAmelCase__							 =						initializer_range
       UpperCAmelCase__							 =						[
           ["Subsample", key_dim[0], hidden_sizes[0] // key_dim[0], 4, 2, 2],
           ["Subsample", key_dim[0], hidden_sizes[1] // key_dim[0], 4, 2, 2],
       ]



class 			_UpperCamelCase      (				_snake_case		):
      UpperCAmelCase_        =		version.parse("""1.11"""		)
      @property
      def 	UpperCAmelCase_						(			self   :Tuple      )     ->			Mapping[str, Mapping[int, str]]:
       return OrderedDict(
           [
               ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
           ]      )







      @property
      def 	UpperCAmelCase_						(			self   :Tuple      )     ->			float:
       return 1e-4












from ..utils import DummyObject, requires_backends
class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :List[Any] ,      *lowerCamelCase   :int ,      **lowerCamelCase   :List[Any]      )     ->			Dict:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :Union[str, Any] ,      *lowerCamelCase   :Any ,      **lowerCamelCase   :List[str]      )     ->			int:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :Optional[int] ,      *lowerCamelCase   :List[str] ,      **lowerCamelCase   :List[Any]      )     ->			Dict:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :Dict ,      *lowerCamelCase   :int ,      **lowerCamelCase   :str      )     ->			str:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :Optional[int] ,      *lowerCamelCase   :Tuple ,      **lowerCamelCase   :List[Any]      )     ->			Optional[int]:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :Optional[Any] ,      *lowerCamelCase   :Dict ,      **lowerCamelCase   :Optional[int]      )     ->			List[Any]:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :List[str] ,      *lowerCamelCase   :Union[str, Any] ,      **lowerCamelCase   :Any      )     ->			Union[str, Any]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :List[Any] ,      *lowerCamelCase   :str ,      **lowerCamelCase   :List[Any]      )     ->			Tuple:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :str ,      *lowerCamelCase   :Any ,      **lowerCamelCase   :Dict      )     ->			int:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :Union[str, Any] ,      *lowerCamelCase   :int ,      **lowerCamelCase   :Dict      )     ->			List[Any]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :int ,      *lowerCamelCase   :Union[str, Any] ,      **lowerCamelCase   :str      )     ->			Optional[int]:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :List[str] ,      *lowerCamelCase   :Optional[int] ,      **lowerCamelCase   :Tuple      )     ->			Dict:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :Union[str, Any] ,      *lowerCamelCase   :Any ,      **lowerCamelCase   :List[str]      )     ->			Union[str, Any]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :Optional[Any] ,      *lowerCamelCase   :Union[str, Any] ,      **lowerCamelCase   :Optional[Any]      )     ->			Optional[int]:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :List[Any] ,      *lowerCamelCase   :Dict ,      **lowerCamelCase   :Optional[int]      )     ->			List[str]:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :Tuple ,      *lowerCamelCase   :str ,      **lowerCamelCase   :List[str]      )     ->			List[Any]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :Any ,      *lowerCamelCase   :List[str] ,      **lowerCamelCase   :Any      )     ->			int:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :List[Any] ,      *lowerCamelCase   :List[Any] ,      **lowerCamelCase   :Optional[Any]      )     ->			Tuple:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :Any ,      *lowerCamelCase   :List[Any] ,      **lowerCamelCase   :List[str]      )     ->			List[str]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :Optional[Any] ,      *lowerCamelCase   :Optional[int] ,      **lowerCamelCase   :Dict      )     ->			Union[str, Any]:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :int ,      *lowerCamelCase   :List[Any] ,      **lowerCamelCase   :str      )     ->			str:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :str ,      *lowerCamelCase   :Any ,      **lowerCamelCase   :Union[str, Any]      )     ->			Optional[Any]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :Optional[Any] ,      *lowerCamelCase   :Any ,      **lowerCamelCase   :List[str]      )     ->			int:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :List[Any] ,      *lowerCamelCase   :Union[str, Any] ,      **lowerCamelCase   :Union[str, Any]      )     ->			List[Any]:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :Dict ,      *lowerCamelCase   :Dict ,      **lowerCamelCase   :int      )     ->			List[Any]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :Tuple ,      *lowerCamelCase   :Optional[Any] ,      **lowerCamelCase   :Optional[int]      )     ->			Dict:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :Any ,      *lowerCamelCase   :Optional[int] ,      **lowerCamelCase   :List[str]      )     ->			List[Any]:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :List[Any] ,      *lowerCamelCase   :int ,      **lowerCamelCase   :Optional[Any]      )     ->			List[str]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :int ,      *lowerCamelCase   :List[Any] ,      **lowerCamelCase   :List[Any]      )     ->			Any:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :str ,      *lowerCamelCase   :Optional[int] ,      **lowerCamelCase   :str      )     ->			List[str]:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :List[Any] ,      *lowerCamelCase   :str ,      **lowerCamelCase   :int      )     ->			List[Any]:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :List[str] ,      *lowerCamelCase   :List[Any] ,      **lowerCamelCase   :Any      )     ->			List[Any]:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :Optional[Any] ,      *lowerCamelCase   :Any ,      **lowerCamelCase   :Tuple      )     ->			int:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :Any ,      *lowerCamelCase   :List[Any] ,      **lowerCamelCase   :Tuple      )     ->			Dict:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :List[Any] ,      *lowerCamelCase   :int ,      **lowerCamelCase   :Union[str, Any]      )     ->			List[Any]:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :str ,      *lowerCamelCase   :int ,      **lowerCamelCase   :List[str]      )     ->			List[str]:
       requires_backends(cls ,      ["flax"]      )



class 			_UpperCamelCase      (				metaclass=lowerCAmelCase		):
      UpperCAmelCase_        =		["""flax"""]
      def __init__(			self   :int ,      *lowerCamelCase   :Dict ,      **lowerCamelCase   :Optional[int]      )     ->			str:
       requires_backends(self ,      ["flax"]      )
      @classmethod
      def 	UpperCAmelCase_						(			cls   :Union[str, Any] ,      *lowerCamelCase   :Any ,      **lowerCamelCase   :Union[str, Any]      )     ->			Optional[int]:
       requires_backends(cls ,      ["flax"]      )







      @classmethod
      def 	UpperCAmelCase_						(			cls   :int ,      *lowerCamelCase   :Union[str, Any] ,      **lowerCamelCase   :Any      )     ->			Optional[Any]:
       requires_backends(cls ,      ["flax"]      )





