


import copy

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


_UpperCAmelCase      :	List[str]  =logging.get_logger(__name__)

_UpperCAmelCase      :	int  ={
    """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__(				UpperCAmelCase__				):







						'''simple docstring'''




						def __init__(					self ,    __lowercase=2_5_6 ,    __lowercase=1_0_2_4 ,    __lowercase=1_6 ,    __lowercase=1_6 ,    __lowercase=4 ,    __lowercase="gelu" ,    __lowercase=1e-6 ,    **__lowercase ,    )       ->     List[str]:
										super().__init__(**__lowercase				)
										lowerCAmelCase_			:   Optional[Any]     					=					hidden_size
										lowerCAmelCase_			:   List[Any]     					=					image_size
										lowerCAmelCase_			:   int     					=					patch_size
										lowerCAmelCase_			:   List[str]     					=					image_size // patch_size
										lowerCAmelCase_			:   Tuple     					=					mask_input_channels
										lowerCAmelCase_			:   Optional[Any]     					=					num_point_embeddings
										lowerCAmelCase_			:   Optional[Any]     					=					hidden_act
										lowerCAmelCase_			:   str     					=					layer_norm_eps







class 					snake_case__(				UpperCAmelCase__				):







						'''simple docstring'''




						def __init__(					self ,    __lowercase=2_5_6 ,    __lowercase="relu" ,    __lowercase=2_0_4_8 ,    __lowercase=2 ,    __lowercase=8 ,    __lowercase=2 ,    __lowercase=3 ,    __lowercase=3 ,    __lowercase=2_5_6 ,    __lowercase=1e-6 ,    **__lowercase ,    )       ->     List[str]:
										super().__init__(**__lowercase				)
										lowerCAmelCase_			:   Any     					=					hidden_size
										lowerCAmelCase_			:   str     					=					hidden_act
										lowerCAmelCase_			:   int     					=					mlp_dim
										lowerCAmelCase_			:   List[Any]     					=					num_hidden_layers
										lowerCAmelCase_			:   List[Any]     					=					num_attention_heads
										lowerCAmelCase_			:   List[Any]     					=					attention_downsample_rate
										lowerCAmelCase_			:   List[Any]     					=					num_multimask_outputs
										lowerCAmelCase_			:   int     					=					iou_head_depth
										lowerCAmelCase_			:   Any     					=					iou_head_hidden_dim
										lowerCAmelCase_			:   Union[str, Any]     					=					layer_norm_eps







class 					snake_case__(				UpperCAmelCase__				):







						'''simple docstring'''




						def __init__(					self ,    __lowercase=7_6_8 ,    __lowercase=2_5_6 ,    __lowercase=1_2 ,    __lowercase=1_2 ,    __lowercase=3 ,    __lowercase=1_0_2_4 ,    __lowercase=1_6 ,    __lowercase="gelu" ,    __lowercase=1e-06 ,    __lowercase=0.0 ,    __lowercase=1e-10 ,    __lowercase=True ,    __lowercase=4.0 ,    __lowercase=True ,    __lowercase=True ,    __lowercase=1_4 ,    __lowercase=[2, 5, 8, 1_1] ,    __lowercase=1_2_8 ,    __lowercase=None ,    **__lowercase ,    )       ->     Optional[Any]:
										super().__init__(**__lowercase				)

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







class 					snake_case__(				UpperCAmelCase__				):







						'''simple docstring'''




						SCREAMING_SNAKE_CASE__   :	List[str]       =				"""sam"""
						SCREAMING_SNAKE_CASE__   :	Dict       =				True




						def __init__(					self ,    __lowercase=None ,    __lowercase=None ,    __lowercase=None ,    __lowercase=0.02 ,    **__lowercase ,    )       ->     Tuple:
										super().__init__(**__lowercase				)
										lowerCAmelCase_			:   Tuple     					=					vision_config if vision_config is not None else {}
										lowerCAmelCase_			:   Any     					=					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(__lowercase ,    __lowercase				):
														lowerCAmelCase_			:   Dict     					=					vision_config.to_dict()
										if isinstance(__lowercase ,    __lowercase				):
														lowerCAmelCase_			:   Optional[Any]     					=					prompt_encoder_config.to_dict()
										if isinstance(__lowercase ,    __lowercase				):
														lowerCAmelCase_			:   Any     					=					mask_decoder_config.to_dict()

										lowerCAmelCase_			:   List[str]     					=					SamVisionConfig(**__lowercase				)
										lowerCAmelCase_			:   str     					=					SamPromptEncoderConfig(**__lowercase				)
										lowerCAmelCase_			:   Optional[Any]     					=					SamMaskDecoderConfig(**__lowercase				)
										lowerCAmelCase_			:   Optional[int]     					=					initializer_range




						def     lowercase_			(					self				)       ->     List[Any]:
										lowerCAmelCase_			:   Dict     					=					copy.deepcopy(self.__dict__				)
										lowerCAmelCase_			:   Union[str, Any]     					=					self.vision_config.to_dict()
										lowerCAmelCase_			:   Union[str, Any]     					=					self.prompt_encoder_config.to_dict()
										lowerCAmelCase_			:   List[str]     					=					self.mask_decoder_config.to_dict()
										lowerCAmelCase_			:   Optional[int]     					=					self.__class__.model_type
										return output



def       lowerCAmelCase			(		lowerCAmelCase_			, lowerCAmelCase_			)->			set:
				assert isinstance(lowerCAmelCase_			, lowerCAmelCase_			), f"""The input value of [set_a={set_a}] is not a set"""
				assert isinstance(lowerCAmelCase_			, lowerCAmelCase_			), f"""The input value of [set_b={set_b}] is not a set"""

				return {a + b for a in set_a for b in set_b}


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

						testmod()