


from typing import List

from ...configuration_utils import PretrainedConfig
from ...utils import logging


__UpperCamelCase       :       Dict						       =				logging.get_logger(__name__)

__UpperCamelCase       :       Tuple						       =				{
    "snap-research/efficientformer-l1-300": (
        "https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json"
    ),
}

class       __magic_name__	(     __lowerCAmelCase):
     A:		str			=      "efficientformer"


     def __init__(      self							:     Any							,	lowerCamelCase__							:     List[int] = [3, 2, 6, 4]							,	lowerCamelCase__							:     List[int] = [48, 96, 224, 448]							,	lowerCamelCase__							:     List[bool] = [True, True, True, True]							,	lowerCamelCase__							:     int = 448							,	lowerCamelCase__							:     int = 32							,	lowerCamelCase__							:     int = 4							,	lowerCamelCase__							:     int = 7							,	lowerCamelCase__							:     int = 5							,	lowerCamelCase__							:     int = 8							,	lowerCamelCase__							:     int = 4							,	lowerCamelCase__							:     float = 0.0							,	lowerCamelCase__							:     int = 16							,	lowerCamelCase__							:     int = 3							,	lowerCamelCase__							:     int = 3							,	lowerCamelCase__							:     int = 3							,	lowerCamelCase__							:     int = 2							,	lowerCamelCase__							:     int = 1							,	lowerCamelCase__							:     float = 0.0							,	lowerCamelCase__							:     int = 1							,	lowerCamelCase__							:     bool = True							,	lowerCamelCase__							:     bool = True							,	lowerCamelCase__							:     float = 1E-5							,	lowerCamelCase__							:     str = "gelu"							,	lowerCamelCase__							:     float = 0.02							,	lowerCamelCase__							:     float = 1E-1_2							,	lowerCamelCase__							:     int = 224							,	lowerCamelCase__							:     float = 1E-0_5							,	**lowerCamelCase__							:     str							,	)  ->      None:





      '''simple docstring'''






      super().__init__(**lowerCamelCase__			)

      UpperCamelCase__					:    List[Any]          =   hidden_act
      UpperCamelCase__					:    List[str]          =   hidden_dropout_prob
      UpperCamelCase__					:    Optional[Any]          =   hidden_sizes
      UpperCamelCase__					:    Optional[int]          =   num_hidden_layers
      UpperCamelCase__					:    Dict          =   num_attention_heads
      UpperCamelCase__					:    Any          =   initializer_range
      UpperCamelCase__					:    List[Any]          =   layer_norm_eps
      UpperCamelCase__					:    Tuple          =   patch_size
      UpperCamelCase__					:    Union[str, Any]          =   num_channels
      UpperCamelCase__					:    List[Any]          =   depths
      UpperCamelCase__					:    List[Any]          =   mlp_expansion_ratio
      UpperCamelCase__					:    Union[str, Any]          =   downsamples
      UpperCamelCase__					:    Tuple          =   dim
      UpperCamelCase__					:    Union[str, Any]          =   key_dim
      UpperCamelCase__					:    Optional[int]          =   attention_ratio
      UpperCamelCase__					:    List[Any]          =   resolution
      UpperCamelCase__					:    Union[str, Any]          =   pool_size
      UpperCamelCase__					:    List[Any]          =   downsample_patch_size
      UpperCamelCase__					:    Union[str, Any]          =   downsample_stride
      UpperCamelCase__					:    List[str]          =   downsample_pad
      UpperCamelCase__					:    List[Any]          =   drop_path_rate
      UpperCamelCase__					:    List[str]          =   num_metaad_blocks
      UpperCamelCase__					:    Union[str, Any]          =   distillation
      UpperCamelCase__					:    str          =   use_layer_scale
      UpperCamelCase__					:    Union[str, Any]          =   layer_scale_init_value
      UpperCamelCase__					:    Union[str, Any]          =   image_size
      UpperCamelCase__					:    int          =   batch_norm_eps






import contextlib
import importlib
import io
import unittest

import transformers

# Try to import everything from transformers to ensure every object can be loaded.
from transformers import *  # noqa F406
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_tf, require_torch
from transformers.utils import ContextManagers, find_labels, is_flax_available, is_tf_available, is_torch_available


if is_torch_available():
       from transformers import BertForPreTraining, BertForQuestionAnswering, BertForSequenceClassification

if is_tf_available():
       from transformers import TFBertForPreTraining, TFBertForQuestionAnswering, TFBertForSequenceClassification

if is_flax_available():
       from transformers import FlaxBertForPreTraining, FlaxBertForQuestionAnswering, FlaxBertForSequenceClassification


__UpperCamelCase       :       Dict						       =				DUMMY_UNKNOWN_IDENTIFIER
# An actual model hosted on huggingface.co

__UpperCamelCase       :       Optional[int]						       =				"main"
# Default branch name
__UpperCamelCase       :       Optional[Any]						       =				"f2c752cfc5c0ab6f4bdec59acea69eefbee381c2"
# One particular commit (not the top of `main`)
__UpperCamelCase       :       str						       =				"aaaaaaa"
# This commit does not exist, so we should 404.

__UpperCamelCase       :       Optional[Any]						       =				"d9e9f15bc825e4b2c9249e9578f884bbcb5e3684"
# Sha-1 of config.json on the top of `main`, for checking purposes
__UpperCamelCase       :       Tuple						       =				"4b243c475af8d0a7754e87d7d096c92e5199ec2fe168a2ee7998e3b8e9bcb1d3"

@contextlib.contextmanager
def 			_a  (				):







 """simple docstring"""



 print('''Welcome!'''     )
 yield
 print('''Bye!'''     )

@contextlib.contextmanager
def 			_a  (				):







 """simple docstring"""



 print('''Bonjour!'''     )
 yield
 print('''Au revoir!'''     )

class       __magic_name__	(     unittest.TestCase):


     def      UpperCAmelCase__	(      self							:     Union[str, Any]			)  ->      Any:





      '''simple docstring'''






      assert transformers.__spec__ is not None
      assert importlib.util.find_spec('''transformers'''			) is not None



class       __magic_name__	(     unittest.TestCase):


     @unittest.mock.patch('''sys.stdout'''							,	new_callable=io.StringIO			)
     def      UpperCAmelCase__	(      self							:     Union[str, Any]							,	lowerCamelCase__							:     Union[str, Any]			)  ->      Optional[Any]:





      '''simple docstring'''






      with ContextManagers([]			):
       print('''Transformers are awesome!'''			)
      # The print statement adds a new line at the end of the output
      self.assertEqual(mock_stdout.getvalue()							,	'''Transformers are awesome!\n'''			)


     @unittest.mock.patch('''sys.stdout'''							,	new_callable=io.StringIO			)
     def      UpperCAmelCase__	(      self							:     Any							,	lowerCamelCase__							:     Union[str, Any]			)  ->      Dict:





      '''simple docstring'''






      with ContextManagers([context_en()]			):
       print('''Transformers are awesome!'''			)
      # The output should be wrapped with an English welcome and goodbye
      self.assertEqual(mock_stdout.getvalue()							,	'''Welcome!\nTransformers are awesome!\nBye!\n'''			)


     @unittest.mock.patch('''sys.stdout'''							,	new_callable=io.StringIO			)
     def      UpperCAmelCase__	(      self							:     List[Any]							,	lowerCamelCase__							:     List[str]			)  ->      Tuple:





      '''simple docstring'''






      with ContextManagers([context_fr(), context_en()]			):
       print('''Transformers are awesome!'''			)
      # The output should be wrapped with an English and French welcome and goodbye
      self.assertEqual(mock_stdout.getvalue()							,	'''Bonjour!\nWelcome!\nTransformers are awesome!\nBye!\nAu revoir!\n'''			)


     @require_torch
     def      UpperCAmelCase__	(      self							:     Tuple			)  ->      Optional[int]:





      '''simple docstring'''






      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''']			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''', '''next_sentence_label''']			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''start_positions''', '''end_positions''']			)

      class       __magic_name__	(     __lowerCAmelCase):
           pass



      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''']			)


     @require_tf
     def      UpperCAmelCase__	(      self							:     Union[str, Any]			)  ->      Tuple:





      '''simple docstring'''






      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''']			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''', '''next_sentence_label''']			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''start_positions''', '''end_positions''']			)

      class       __magic_name__	(     __lowerCAmelCase):
           pass



      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''']			)


     @require_flax
     def      UpperCAmelCase__	(      self							:     str			)  ->      Optional[Any]:





      '''simple docstring'''






      self.assertEqual(find_labels(lowerCamelCase__			)							,	[]			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	[]			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	[]			)

      class       __magic_name__	(     __lowerCAmelCase):
           pass



      self.assertEqual(find_labels(lowerCamelCase__			)							,	[]			)


