




'''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_			=						logging.get_logger(__name__)

lowerCamelCase_			=						{
    'sail/poolformer_s12': 'https://huggingface.co/sail/poolformer_s12/resolve/main/config.json',
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
}







class 		lowercase_   (			A       ):


   """simple docstring"""

   lowerCamelCase_      =						'''poolformer'''



   def __init__(   self :     Union[str, Any]  ,				__lowerCamelCase :     Optional[int]=3  ,				__lowerCamelCase :     Union[str, Any]=1_6  ,				__lowerCamelCase :     Any=1_6  ,				__lowerCamelCase :     int=3  ,				__lowerCamelCase :     Optional[int]=4.0  ,				__lowerCamelCase :     Optional[int]=[2, 2, 6, 2]  ,				__lowerCamelCase :     Tuple=[6_4, 1_2_8, 3_2_0, 5_1_2]  ,				__lowerCamelCase :     str=[7, 3, 3, 3]  ,				__lowerCamelCase :     str=[4, 2, 2, 2]  ,				__lowerCamelCase :     str=[2, 1, 1, 1]  ,				__lowerCamelCase :     Any=4  ,				__lowerCamelCase :     str=0.0  ,				__lowerCamelCase :     Tuple="gelu"  ,				__lowerCamelCase :     Union[str, Any]=True  ,				__lowerCamelCase :     Dict=1e-5  ,				__lowerCamelCase :     List[str]=0.0_2  ,				**__lowerCamelCase :     Dict  ,				):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				num_channels
      _SCREAMING_SNAKE_CASE	=				patch_size
      _SCREAMING_SNAKE_CASE	=				stride
      _SCREAMING_SNAKE_CASE	=				padding
      _SCREAMING_SNAKE_CASE	=				pool_size
      _SCREAMING_SNAKE_CASE	=				hidden_sizes
      _SCREAMING_SNAKE_CASE	=				mlp_ratio
      _SCREAMING_SNAKE_CASE	=				depths
      _SCREAMING_SNAKE_CASE	=				patch_sizes
      _SCREAMING_SNAKE_CASE	=				strides
      _SCREAMING_SNAKE_CASE	=				num_encoder_blocks
      _SCREAMING_SNAKE_CASE	=				drop_path_rate
      _SCREAMING_SNAKE_CASE	=				hidden_act
      _SCREAMING_SNAKE_CASE	=				use_layer_scale
      _SCREAMING_SNAKE_CASE	=				layer_scale_init_value
      _SCREAMING_SNAKE_CASE	=				initializer_range
      super().__init__(**__lowerCamelCase   )







class 		lowercase_   (			A       ):


   """simple docstring"""

   lowerCamelCase_      =						version.parse('''1.11'''       )



   @property
   def 							lowerCAmelCase_      (   self :     Optional[int]   ):

      """simple docstring"""
      return OrderedDict(
          [
              ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
          ]   )



   @property
   def 							lowerCAmelCase_      (   self :     Optional[Any]   ):

      """simple docstring"""
      return 2e-3







'''simple docstring'''



import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible







class 		lowercase_   (			unittest.TestCase       ):


   """simple docstring"""

   def 							lowerCAmelCase_      (   self :     List[Any]   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "safety_checker/pytorch_model.bin",
          "safety_checker/model.safetensors",
          "vae/diffusion_pytorch_model.bin",
          "vae/diffusion_pytorch_model.safetensors",
          "text_encoder/pytorch_model.bin",
          "text_encoder/model.safetensors",
          "unet/diffusion_pytorch_model.bin",
          "unet/diffusion_pytorch_model.safetensors",
      ]
      self.assertTrue(is_safetensors_compatible(__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     Dict   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "unet/diffusion_pytorch_model.bin",
          "unet/diffusion_pytorch_model.safetensors",
      ]
      self.assertTrue(is_safetensors_compatible(__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     Tuple   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "safety_checker/pytorch_model.bin",
          "safety_checker/model.safetensors",
          "vae/diffusion_pytorch_model.bin",
          "vae/diffusion_pytorch_model.safetensors",
          "text_encoder/pytorch_model.bin",
          "text_encoder/model.safetensors",
          "unet/diffusion_pytorch_model.bin",
          # Removed: 'unet/diffusion_pytorch_model.safetensors',
      ]
      self.assertFalse(is_safetensors_compatible(__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     List[str]   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "text_encoder/pytorch_model.bin",
          "text_encoder/model.safetensors",
      ]
      self.assertTrue(is_safetensors_compatible(__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     int   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "safety_checker/pytorch_model.bin",
          "safety_checker/model.safetensors",
          "vae/diffusion_pytorch_model.bin",
          "vae/diffusion_pytorch_model.safetensors",
          "text_encoder/pytorch_model.bin",
          # Removed: 'text_encoder/model.safetensors',
          "unet/diffusion_pytorch_model.bin",
          "unet/diffusion_pytorch_model.safetensors",
      ]
      self.assertFalse(is_safetensors_compatible(__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     Optional[int]   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "safety_checker/pytorch_model.fp16.bin",
          "safety_checker/model.fp16.safetensors",
          "vae/diffusion_pytorch_model.fp16.bin",
          "vae/diffusion_pytorch_model.fp16.safetensors",
          "text_encoder/pytorch_model.fp16.bin",
          "text_encoder/model.fp16.safetensors",
          "unet/diffusion_pytorch_model.fp16.bin",
          "unet/diffusion_pytorch_model.fp16.safetensors",
      ]
      _SCREAMING_SNAKE_CASE	=				"fp16"
      self.assertTrue(is_safetensors_compatible(__lowerCamelCase  ,				variant=__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     Any   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "unet/diffusion_pytorch_model.fp16.bin",
          "unet/diffusion_pytorch_model.fp16.safetensors",
      ]
      _SCREAMING_SNAKE_CASE	=				"fp16"
      self.assertTrue(is_safetensors_compatible(__lowerCamelCase  ,				variant=__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     Tuple   ):

      """simple docstring"""
      # pass variant but use the non-variant filenames
      _SCREAMING_SNAKE_CASE	=				[
          "unet/diffusion_pytorch_model.bin",
          "unet/diffusion_pytorch_model.safetensors",
      ]
      _SCREAMING_SNAKE_CASE	=				"fp16"
      self.assertTrue(is_safetensors_compatible(__lowerCamelCase  ,				variant=__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     int   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "safety_checker/pytorch_model.fp16.bin",
          "safety_checker/model.fp16.safetensors",
          "vae/diffusion_pytorch_model.fp16.bin",
          "vae/diffusion_pytorch_model.fp16.safetensors",
          "text_encoder/pytorch_model.fp16.bin",
          "text_encoder/model.fp16.safetensors",
          "unet/diffusion_pytorch_model.fp16.bin",
          # Removed: 'unet/diffusion_pytorch_model.fp16.safetensors',
      ]
      _SCREAMING_SNAKE_CASE	=				"fp16"
      self.assertFalse(is_safetensors_compatible(__lowerCamelCase  ,				variant=__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     Dict   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "text_encoder/pytorch_model.fp16.bin",
          "text_encoder/model.fp16.safetensors",
      ]
      _SCREAMING_SNAKE_CASE	=				"fp16"
      self.assertTrue(is_safetensors_compatible(__lowerCamelCase  ,				variant=__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     str   ):

      """simple docstring"""
      # pass variant but use the non-variant filenames
      _SCREAMING_SNAKE_CASE	=				[
          "text_encoder/pytorch_model.bin",
          "text_encoder/model.safetensors",
      ]
      _SCREAMING_SNAKE_CASE	=				"fp16"
      self.assertTrue(is_safetensors_compatible(__lowerCamelCase  ,				variant=__lowerCamelCase   )   )



   def 							lowerCAmelCase_      (   self :     Optional[Any]   ):

      """simple docstring"""
      _SCREAMING_SNAKE_CASE	=				[
          "safety_checker/pytorch_model.fp16.bin",
          "safety_checker/model.fp16.safetensors",
          "vae/diffusion_pytorch_model.fp16.bin",
          "vae/diffusion_pytorch_model.fp16.safetensors",
          "text_encoder/pytorch_model.fp16.bin",
          # 'text_encoder/model.fp16.safetensors',
          "unet/diffusion_pytorch_model.fp16.bin",
          "unet/diffusion_pytorch_model.fp16.safetensors",
      ]
      _SCREAMING_SNAKE_CASE	=				"fp16"
      self.assertFalse(is_safetensors_compatible(__lowerCamelCase  ,				variant=__lowerCamelCase   )   )

