

import copy

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


__UpperCAmelCase     					=  logging.get_logger(__name__)

__UpperCAmelCase     					=  {
    'facebook/sam-vit-huge': 'https://huggingface.co/facebook/sam-vit-huge/resolve/main/config.json',
    'facebook/sam-vit-large': 'https://huggingface.co/facebook/sam-vit-large/resolve/main/config.json',
    'facebook/sam-vit-base': 'https://huggingface.co/facebook/sam-vit-base/resolve/main/config.json',
}





class A__     (			__UpperCamelCase			):



 """simple docstring"""







 def __init__(		self			:						str  ,    A_			:						Tuple=2_5_6  ,    A_			:						Optional[int]=1_0_2_4  ,    A_			:						Tuple=1_6  ,    A_			:						List[str]=1_6  ,    A_			:						Tuple=4  ,    A_			:						Optional[int]="gelu"  ,    A_			:						Any=1E-6  ,    **A_			:						Dict  ,    ):






      '''simple docstring'''




      super().__init__(**lowerCAmelCase__							)
      _lowerCAmelCase :       List[str]	   =     hidden_size
      _lowerCAmelCase :       Tuple	   =     image_size
      _lowerCAmelCase :       Any	   =     patch_size
      _lowerCAmelCase :       Any	   =     image_size // patch_size
      _lowerCAmelCase :       List[str]	   =     mask_input_channels
      _lowerCAmelCase :       Union[str, Any]	   =     num_point_embeddings
      _lowerCAmelCase :       int	   =     hidden_act
      _lowerCAmelCase :       Optional[int]	   =     layer_norm_eps





class A__     (			__UpperCamelCase			):



 """simple docstring"""







 def __init__(		self			:						Any  ,    A_			:						Any=2_5_6  ,    A_			:						Tuple="relu"  ,    A_			:						List[Any]=2_0_4_8  ,    A_			:						Tuple=2  ,    A_			:						Dict=8  ,    A_			:						Any=2  ,    A_			:						int=3  ,    A_			:						str=3  ,    A_			:						Union[str, Any]=2_5_6  ,    A_			:						Any=1E-6  ,    **A_			:						List[Any]  ,    ):






      '''simple docstring'''




      super().__init__(**lowerCAmelCase__							)
      _lowerCAmelCase :       Any	   =     hidden_size
      _lowerCAmelCase :       Optional[Any]	   =     hidden_act
      _lowerCAmelCase :       List[Any]	   =     mlp_dim
      _lowerCAmelCase :       List[str]	   =     num_hidden_layers
      _lowerCAmelCase :       str	   =     num_attention_heads
      _lowerCAmelCase :       Optional[int]	   =     attention_downsample_rate
      _lowerCAmelCase :       List[str]	   =     num_multimask_outputs
      _lowerCAmelCase :       List[str]	   =     iou_head_depth
      _lowerCAmelCase :       Dict	   =     iou_head_hidden_dim
      _lowerCAmelCase :       Tuple	   =     layer_norm_eps





class A__     (			__UpperCamelCase			):



 """simple docstring"""







 def __init__(		self			:						Any  ,    A_			:						Union[str, Any]=7_6_8  ,    A_			:						List[Any]=2_5_6  ,    A_			:						Dict=1_2  ,    A_			:						Dict=1_2  ,    A_			:						Dict=3  ,    A_			:						Union[str, Any]=1_0_2_4  ,    A_			:						List[Any]=1_6  ,    A_			:						Any="gelu"  ,    A_			:						int=1E-06  ,    A_			:						List[Any]=0.0  ,    A_			:						Union[str, Any]=1E-10  ,    A_			:						Dict=True  ,    A_			:						List[str]=4.0  ,    A_			:						Optional[Any]=True  ,    A_			:						Tuple=True  ,    A_			:						Any=1_4  ,    A_			:						Any=[2, 5, 8, 1_1]  ,    A_			:						str=1_2_8  ,    A_			:						Optional[Any]=None  ,    **A_			:						int  ,    ):






      '''simple docstring'''




      super().__init__(**lowerCAmelCase__							)

      _lowerCAmelCase :       Optional[int]	   =     hidden_size
      _lowerCAmelCase :       List[Any]	   =     output_channels
      _lowerCAmelCase :       Dict	   =     num_hidden_layers
      _lowerCAmelCase :       Tuple	   =     num_attention_heads
      _lowerCAmelCase :       str	   =     num_channels
      _lowerCAmelCase :       Optional[Any]	   =     image_size
      _lowerCAmelCase :       Optional[int]	   =     patch_size
      _lowerCAmelCase :       Tuple	   =     hidden_act
      _lowerCAmelCase :       List[str]	   =     layer_norm_eps
      _lowerCAmelCase :       Dict	   =     attention_dropout
      _lowerCAmelCase :       Optional[int]	   =     initializer_range
      _lowerCAmelCase :       Union[str, Any]	   =     qkv_bias
      _lowerCAmelCase :       Optional[int]	   =     mlp_ratio
      _lowerCAmelCase :       int	   =     use_abs_pos
      _lowerCAmelCase :       Dict	   =     use_rel_pos
      _lowerCAmelCase :       Optional[Any]	   =     window_size
      _lowerCAmelCase :       Tuple	   =     global_attn_indexes
      _lowerCAmelCase :       Dict	   =     num_pos_feats
      _lowerCAmelCase :       List[str]	   =     int(hidden_size * mlp_ratio							) if mlp_dim is None else mlp_dim





class A__     (			__UpperCamelCase			):



 """simple docstring"""







 _lowercase  :       str  			=    'sam'
 _lowercase  :       List[str]  			=    True

 def __init__(		self			:						Optional[Any]  ,    A_			:						str=None  ,    A_			:						List[str]=None  ,    A_			:						str=None  ,    A_			:						Optional[Any]=0.02  ,    **A_			:						Dict  ,    ):






      '''simple docstring'''




      super().__init__(**lowerCAmelCase__							)
      _lowerCAmelCase :       Optional[int]	   =     vision_config if vision_config is not None else {}
      _lowerCAmelCase :       str	   =     prompt_encoder_config if prompt_encoder_config is not None else {}
      _lowerCAmelCase :       Dict	   =     mask_decoder_config if mask_decoder_config is not None else {}

      if isinstance(lowerCAmelCase__  ,    lowerCAmelCase__							):
           _lowerCAmelCase :       List[str]	   =     vision_config.to_dict()
      if isinstance(lowerCAmelCase__  ,    lowerCAmelCase__							):
           _lowerCAmelCase :       Optional[int]	   =     prompt_encoder_config.to_dict()
      if isinstance(lowerCAmelCase__  ,    lowerCAmelCase__							):
           _lowerCAmelCase :       Union[str, Any]	   =     mask_decoder_config.to_dict()

      _lowerCAmelCase :       Optional[Any]	   =     SamVisionConfig(**lowerCAmelCase__							)
      _lowerCAmelCase :       str	   =     SamPromptEncoderConfig(**lowerCAmelCase__							)
      _lowerCAmelCase :       Any	   =     SamMaskDecoderConfig(**lowerCAmelCase__							)
      _lowerCAmelCase :       Union[str, Any]	   =     initializer_range


 def  __magic_name__							(		self			:						str							):






      '''simple docstring'''




      _lowerCAmelCase :       Optional[int]	   =     copy.deepcopy(self.__dict__							)
      _lowerCAmelCase :       Optional[int]	   =     self.vision_config.to_dict()
      _lowerCAmelCase :       Tuple	   =     self.prompt_encoder_config.to_dict()
      _lowerCAmelCase :       List[Any]	   =     self.mask_decoder_config.to_dict()
      _lowerCAmelCase :       Union[str, Any]	   =     self.__class__.model_type
      return output










from typing import Callable




def   snake_case_	(    snake_case	)    ->							Tuple:

       def wrapper(snake_case	):
              lowercase__:  Tuple         =  function_with_docstring.__doc__
              return target_function

       return wrapper


