





__lowercase							:dict[str, float]							=	{
    "kilogram": 1,
    "gram": pow(10, 3),
    "milligram": pow(10, 6),
    "metric-ton": pow(10, -3),
    "long-ton": 0.0_0_0_9_8_4_2_0_7_3,
    "short-ton": 0.0_0_1_1_0_2_3_1_2_2,
    "pound": 2.2_0_4_6_2_4_4_2_0_2,
    "stone": 0.1_5_7_4_7_3_1_7_2_8,
    "ounce": 3_5.2_7_3_9_9_0_7_2_3,
    "carrat": 5_000,
    "atomic-mass-unit": 6.022136652e26,
}

__lowercase							:dict[str, float]							=	{
    "kilogram": 1,
    "gram": pow(10, -3),
    "milligram": pow(10, -6),
    "metric-ton": pow(10, 3),
    "long-ton": 1_0_1_6.0_4_6_0_8,
    "short-ton": 9_0_7.1_8_4,
    "pound": 0.4_5_3_5_9_2,
    "stone": 6.3_5_0_2_9,
    "ounce": 0.0_2_8_3_4_9_5,
    "carrat": 0.0_0_0_2,
    "atomic-mass-unit": 1.660540199e-27,
}







def    UpperCAmelCase				(  _lowerCamelCase   :	str      , _lowerCamelCase   :	str      , _lowerCamelCase   :	float  ):





						'''simple docstring'''


						if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
												SCREAMING_SNAKE_CASE__  :					str =       (
												    f"""Invalid 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"""
												    f"""Supported values are: {', '.join(_lowerCamelCase  )}"""
												)
												raise ValueError(_lowerCamelCase  )
						return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]


if __name__ == "__main__":
				import doctest

				doctest.testmod()






import copy

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


__lowercase							:List[Any]							=	logging.get_logger(__name__)

__lowercase							:Optional[Any]							=	{
    "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  (					lowercase__				):






							"""simple docstring"""

							def __init__(   self					:  List[Any]				,						a					:  int=2_56				,						a					:  Tuple=10_24				,						a					:  Optional[Any]=16				,						a					:  Dict=16				,						a					:  str=4				,						a					:  Union[str, Any]="gelu"				,						a					:  Optional[Any]=1E-6				,						**a					:  Dict				,						)						->Union[str, Any]:
													super().__init__(**a     )
													SCREAMING_SNAKE_CASE__  :					Any =       hidden_size
													SCREAMING_SNAKE_CASE__  :					List[Any] =       image_size
													SCREAMING_SNAKE_CASE__  :					List[str] =       patch_size
													SCREAMING_SNAKE_CASE__  :					str =       image_size // patch_size
													SCREAMING_SNAKE_CASE__  :					Union[str, Any] =       mask_input_channels
													SCREAMING_SNAKE_CASE__  :					Any =       num_point_embeddings
													SCREAMING_SNAKE_CASE__  :					str =       hidden_act
													SCREAMING_SNAKE_CASE__  :					Union[str, Any] =       layer_norm_eps







class  _a  (					lowercase__				):






							"""simple docstring"""

							def __init__(   self					:  Union[str, Any]				,						a					:  Optional[int]=2_56				,						a					:  Dict="relu"				,						a					:  Dict=20_48				,						a					:  Union[str, Any]=2				,						a					:  str=8				,						a					:  str=2				,						a					:  List[Any]=3				,						a					:  str=3				,						a					:  List[str]=2_56				,						a					:  str=1E-6				,						**a					:  Optional[int]				,						)						->Dict:
													super().__init__(**a     )
													SCREAMING_SNAKE_CASE__  :					List[Any] =       hidden_size
													SCREAMING_SNAKE_CASE__  :					List[Any] =       hidden_act
													SCREAMING_SNAKE_CASE__  :					Dict =       mlp_dim
													SCREAMING_SNAKE_CASE__  :					List[Any] =       num_hidden_layers
													SCREAMING_SNAKE_CASE__  :					Union[str, Any] =       num_attention_heads
													SCREAMING_SNAKE_CASE__  :					List[Any] =       attention_downsample_rate
													SCREAMING_SNAKE_CASE__  :					List[str] =       num_multimask_outputs
													SCREAMING_SNAKE_CASE__  :					Optional[int] =       iou_head_depth
													SCREAMING_SNAKE_CASE__  :					Union[str, Any] =       iou_head_hidden_dim
													SCREAMING_SNAKE_CASE__  :					Optional[int] =       layer_norm_eps







class  _a  (					lowercase__				):






							"""simple docstring"""

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

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







class  _a  (					lowercase__				):






							"""simple docstring"""

							snake_case_							=    "sam"
							snake_case_							=    True

							def __init__(   self					:  str				,						a					:  Optional[int]=None				,						a					:  Any=None				,						a					:  Any=None				,						a					:  str=0.02				,						**a					:  int				,						)						->Optional[int]:
													super().__init__(**a     )
													SCREAMING_SNAKE_CASE__  :					Dict =       vision_config if vision_config is not None else {}
													SCREAMING_SNAKE_CASE__  :					str =       prompt_encoder_config if prompt_encoder_config is not None else {}
													SCREAMING_SNAKE_CASE__  :					Tuple =       mask_decoder_config if mask_decoder_config is not None else {}

													if isinstance(a				,						a     ):
																			SCREAMING_SNAKE_CASE__  :					Tuple =       vision_config.to_dict()
													if isinstance(a				,						a     ):
																			SCREAMING_SNAKE_CASE__  :					Dict =       prompt_encoder_config.to_dict()
													if isinstance(a				,						a     ):
																			SCREAMING_SNAKE_CASE__  :					List[Any] =       mask_decoder_config.to_dict()

													SCREAMING_SNAKE_CASE__  :					str =       SamVisionConfig(**a     )
													SCREAMING_SNAKE_CASE__  :					str =       SamPromptEncoderConfig(**a     )
													SCREAMING_SNAKE_CASE__  :					int =       SamMaskDecoderConfig(**a     )
													SCREAMING_SNAKE_CASE__  :					List[str] =       initializer_range






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