
"""simple docstring"""




from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


A__      :	Dict          =    logging.get_logger(__name__)







class   _lowercase						(       lowerCAmelCase_	,   lowerCAmelCase_				):


     '''simple docstring'''





     _A								=							'maskformer-swin'

     _A								=							{
         'num_attention_heads': 'num_heads',
         'num_hidden_layers': 'num_layers',
     }



     def __init__(      self ,			__UpperCamelCase=2_24 ,			__UpperCamelCase=4 ,			__UpperCamelCase=3 ,			__UpperCamelCase=96 ,			__UpperCamelCase=[2, 2, 6, 2] ,			__UpperCamelCase=[3, 6, 12, 24] ,			__UpperCamelCase=7 ,			__UpperCamelCase=4.0 ,			__UpperCamelCase=True ,			__UpperCamelCase=0.0 ,			__UpperCamelCase=0.0 ,			__UpperCamelCase=0.1 ,			__UpperCamelCase="gelu" ,			__UpperCamelCase=False ,			__UpperCamelCase=0.02 ,			__UpperCamelCase=1E-5 ,			__UpperCamelCase=None ,			__UpperCamelCase=None ,			**__UpperCamelCase ,			)->					Dict:
          super().__init__(**__UpperCamelCase  )

          UpperCAmelCase__							: List[str] 							=						image_size
          UpperCAmelCase__							: Dict 							=						patch_size
          UpperCAmelCase__							: Tuple 							=						num_channels
          UpperCAmelCase__							: List[Any] 							=						embed_dim
          UpperCAmelCase__							: Tuple 							=						depths
          UpperCAmelCase__							: int 							=						len(__UpperCamelCase  )
          UpperCAmelCase__							: Dict 							=						num_heads
          UpperCAmelCase__							: Any 							=						window_size
          UpperCAmelCase__							: List[str] 							=						mlp_ratio
          UpperCAmelCase__							: Any 							=						qkv_bias
          UpperCAmelCase__							: List[str] 							=						hidden_dropout_prob
          UpperCAmelCase__							: Optional[Any] 							=						attention_probs_dropout_prob
          UpperCAmelCase__							: List[Any] 							=						drop_path_rate
          UpperCAmelCase__							: Any 							=						hidden_act
          UpperCAmelCase__							: str 							=						use_absolute_embeddings
          UpperCAmelCase__							: Tuple 							=						layer_norm_eps
          UpperCAmelCase__							: Optional[int] 							=						initializer_range
          # we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
          # this indicates the channel dimension after the last stage of the model
          UpperCAmelCase__							: Tuple 							=						int(embed_dim * 2 ** (len(__UpperCamelCase  ) - 1)  )
          UpperCAmelCase__							: Union[str, Any] 							=						["stem"] + [F"stage{idx}" for idx in range(1 ,			len(__UpperCamelCase  ) + 1  )]
          UpperCAmelCase__							,	UpperCAmelCase__							: List[Any] 							=						get_aligned_output_features_output_indices(
              out_features=__UpperCamelCase ,			out_indices=__UpperCamelCase ,			stage_names=self.stage_names  )





"""simple docstring"""




import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin







class   _lowercase						(       unittest.TestCase	,   lowerCAmelCase_				):


     '''simple docstring'''





     def  lowerCAmelCase__       (      self  )->					Dict:
          UpperCAmelCase__							: Optional[Any] 							=						load_tool("text-classification"  )
          self.tool.setup()
          UpperCAmelCase__							: List[str] 							=						load_tool("text-classification" ,			remote=__UpperCamelCase  )



     def  lowerCAmelCase__       (      self  )->					Union[str, Any]:
          UpperCAmelCase__							: Dict 							=						self.tool("That's quite cool" ,			["positive", "negative"]  )
          self.assertEqual(__UpperCamelCase ,			"positive"  )



     def  lowerCAmelCase__       (      self  )->					str:
          UpperCAmelCase__							: List[Any] 							=						self.remote_tool("That's quite cool" ,			["positive", "negative"]  )
          self.assertEqual(__UpperCamelCase ,			"positive"  )



     def  lowerCAmelCase__       (      self  )->					Optional[int]:
          UpperCAmelCase__							: Any 							=						self.tool(text="That's quite cool" ,			labels=["positive", "negative"]  )
          self.assertEqual(__UpperCamelCase ,			"positive"  )



     def  lowerCAmelCase__       (      self  )->					str:
          UpperCAmelCase__							: str 							=						self.remote_tool(text="That's quite cool" ,			labels=["positive", "negative"]  )
          self.assertEqual(__UpperCamelCase ,			"positive"  )



