






"""simple docstring"""


import copy

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


lowercase_								=	logging.get_logger(__name__)

lowercase_								=	{
    '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    snake_case						(				a__		):


   '''simple docstring'''

   def __init__(      self					:	Any,			_lowerCamelCase					:	Optional[int]=2_56,			_lowerCamelCase					:	List[Any]=10_24,			_lowerCamelCase					:	Dict=16,			_lowerCamelCase					:	Any=16,			_lowerCamelCase					:	Any=4,			_lowerCamelCase					:	int="gelu",			_lowerCamelCase					:	Union[str, Any]=1e-6,			**_lowerCamelCase					:	Dict,			):

     '''simple docstring'''
     super().__init__(**__UpperCAmelCase    )
     __A		     =					hidden_size
     __A		     =					image_size
     __A		     =					patch_size
     __A		     =					image_size // patch_size
     __A		     =					mask_input_channels
     __A		     =					num_point_embeddings
     __A		     =					hidden_act
     __A		     =					layer_norm_eps





class    snake_case						(				a__		):


   '''simple docstring'''

   def __init__(      self					:	Optional[int],			_lowerCamelCase					:	Dict=2_56,			_lowerCamelCase					:	str="relu",			_lowerCamelCase					:	Optional[int]=20_48,			_lowerCamelCase					:	List[str]=2,			_lowerCamelCase					:	Any=8,			_lowerCamelCase					:	List[str]=2,			_lowerCamelCase					:	Optional[int]=3,			_lowerCamelCase					:	int=3,			_lowerCamelCase					:	Optional[Any]=2_56,			_lowerCamelCase					:	Any=1e-6,			**_lowerCamelCase					:	Union[str, Any],			):

     '''simple docstring'''
     super().__init__(**__UpperCAmelCase    )
     __A		     =					hidden_size
     __A		     =					hidden_act
     __A		     =					mlp_dim
     __A		     =					num_hidden_layers
     __A		     =					num_attention_heads
     __A		     =					attention_downsample_rate
     __A		     =					num_multimask_outputs
     __A		     =					iou_head_depth
     __A		     =					iou_head_hidden_dim
     __A		     =					layer_norm_eps





class    snake_case						(				a__		):


   '''simple docstring'''

   def __init__(      self					:	Optional[int],			_lowerCamelCase					:	int=7_68,			_lowerCamelCase					:	Dict=2_56,			_lowerCamelCase					:	List[str]=12,			_lowerCamelCase					:	Optional[int]=12,			_lowerCamelCase					:	Union[str, Any]=3,			_lowerCamelCase					:	Dict=10_24,			_lowerCamelCase					:	str=16,			_lowerCamelCase					:	Union[str, Any]="gelu",			_lowerCamelCase					:	Optional[Any]=1e-06,			_lowerCamelCase					:	List[Any]=0.0,			_lowerCamelCase					:	Tuple=1e-10,			_lowerCamelCase					:	Union[str, Any]=True,			_lowerCamelCase					:	List[str]=4.0,			_lowerCamelCase					:	Optional[Any]=True,			_lowerCamelCase					:	Dict=True,			_lowerCamelCase					:	str=14,			_lowerCamelCase					:	Any=[2, 5, 8, 11],			_lowerCamelCase					:	List[str]=1_28,			_lowerCamelCase					:	Optional[Any]=None,			**_lowerCamelCase					:	Optional[int],			):

     '''simple docstring'''
     super().__init__(**__UpperCAmelCase    )

     __A		     =					hidden_size
     __A		     =					output_channels
     __A		     =					num_hidden_layers
     __A		     =					num_attention_heads
     __A		     =					num_channels
     __A		     =					image_size
     __A		     =					patch_size
     __A		     =					hidden_act
     __A		     =					layer_norm_eps
     __A		     =					attention_dropout
     __A		     =					initializer_range
     __A		     =					qkv_bias
     __A		     =					mlp_ratio
     __A		     =					use_abs_pos
     __A		     =					use_rel_pos
     __A		     =					window_size
     __A		     =					global_attn_indexes
     __A		     =					num_pos_feats
     __A		     =					int(hidden_size * mlp_ratio    ) if mlp_dim is None else mlp_dim





class    snake_case						(				a__		):


   '''simple docstring'''

   A_		:      List[Any]							=					'sam'
   A_		:      Union[str, Any]							=					True


   def __init__(      self					:	Optional[int],			_lowerCamelCase					:	Union[str, Any]=None,			_lowerCamelCase					:	Optional[int]=None,			_lowerCamelCase					:	Optional[int]=None,			_lowerCamelCase					:	Optional[Any]=0.02,			**_lowerCamelCase					:	Union[str, Any],			):

     '''simple docstring'''
     super().__init__(**__UpperCAmelCase    )
     __A		     =					vision_config if vision_config is not None else {}
     __A		     =					prompt_encoder_config if prompt_encoder_config is not None else {}
     __A		     =					mask_decoder_config if mask_decoder_config is not None else {}

     if isinstance(__UpperCAmelCase,			__UpperCAmelCase    ):
       __A		     =					vision_config.to_dict()
     if isinstance(__UpperCAmelCase,			__UpperCAmelCase    ):
       __A		     =					prompt_encoder_config.to_dict()
     if isinstance(__UpperCAmelCase,			__UpperCAmelCase    ):
       __A		     =					mask_decoder_config.to_dict()

     __A		     =					SamVisionConfig(**__UpperCAmelCase    )
     __A		     =					SamPromptEncoderConfig(**__UpperCAmelCase    )
     __A		     =					SamMaskDecoderConfig(**__UpperCAmelCase    )
     __A		     =					initializer_range






   def 							_SCREAMING_SNAKE_CASE							(      self					:	List[Any]    ):

     '''simple docstring'''
     __A		     =					copy.deepcopy(self.__dict__    )
     __A		     =					self.vision_config.to_dict()
     __A		     =					self.prompt_encoder_config.to_dict()
     __A		     =					self.mask_decoder_config.to_dict()
     __A		     =					self.__class__.model_type
     return output








"""simple docstring"""






def    A_ ( _lowerCAmelCase  :       str							):






     """simple docstring"""

     return "".join(chr(ord(_lowerCAmelCase							) + 32							) if '''A''' <= char <= '''Z''' else char for char in word							)


if __name__ == "__main__":
   from doctest import testmod

   testmod()