



'''simple docstring'''







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      lowerCamelCase__     (     _A				):






	'''simple docstring'''

	def __init__(  self		:  List[Any]   ,		__A		:  str=256   ,		__A		:  Dict=1024   ,		__A		:  str=16   ,		__A		:  str=16   ,		__A		:  Tuple=4   ,		__A		:  Union[str, Any]="gelu"   ,		__A		:  Any=1E-6   ,		**__A		:  List[str]   ,		)     ->			Dict:




								'''simple docstring'''





								super().__init__(**__A					)
								lowerCAmelCase__  =   hidden_size
								lowerCAmelCase__  =   image_size
								lowerCAmelCase__  =   patch_size
								lowerCAmelCase__  =   image_size // patch_size
								lowerCAmelCase__  =   mask_input_channels
								lowerCAmelCase__  =   num_point_embeddings
								lowerCAmelCase__  =   hidden_act
								lowerCAmelCase__  =   layer_norm_eps





class      lowerCamelCase__     (     _A				):






	'''simple docstring'''

	def __init__(  self		:  List[str]   ,		__A		:  List[str]=256   ,		__A		:  List[str]="relu"   ,		__A		:  Optional[Any]=2048   ,		__A		:  Optional[Any]=2   ,		__A		:  Any=8   ,		__A		:  Dict=2   ,		__A		:  str=3   ,		__A		:  int=3   ,		__A		:  int=256   ,		__A		:  Any=1E-6   ,		**__A		:  Tuple   ,		)     ->			Dict:




								'''simple docstring'''





								super().__init__(**__A					)
								lowerCAmelCase__  =   hidden_size
								lowerCAmelCase__  =   hidden_act
								lowerCAmelCase__  =   mlp_dim
								lowerCAmelCase__  =   num_hidden_layers
								lowerCAmelCase__  =   num_attention_heads
								lowerCAmelCase__  =   attention_downsample_rate
								lowerCAmelCase__  =   num_multimask_outputs
								lowerCAmelCase__  =   iou_head_depth
								lowerCAmelCase__  =   iou_head_hidden_dim
								lowerCAmelCase__  =   layer_norm_eps





class      lowerCamelCase__     (     _A				):






	'''simple docstring'''

	def __init__(  self		:  Optional[int]   ,		__A		:  Optional[Any]=768   ,		__A		:  Optional[Any]=256   ,		__A		:  str=12   ,		__A		:  List[str]=12   ,		__A		:  str=3   ,		__A		:  int=1024   ,		__A		:  List[Any]=16   ,		__A		:  Tuple="gelu"   ,		__A		:  List[str]=1E-06   ,		__A		:  List[Any]=0.0   ,		__A		:  int=1E-10   ,		__A		:  List[str]=True   ,		__A		:  Union[str, Any]=4.0   ,		__A		:  str=True   ,		__A		:  Union[str, Any]=True   ,		__A		:  Optional[Any]=14   ,		__A		:  Tuple=[2, 5, 8, 11]   ,		__A		:  Dict=128   ,		__A		:  Tuple=None   ,		**__A		:  Tuple   ,		)     ->			str:




								'''simple docstring'''





								super().__init__(**__A					)

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





class      lowerCamelCase__     (     _A				):






	'''simple docstring'''

	A__		=	'''sam'''
	A__		=	True




	def __init__(  self		:  List[Any]   ,		__A		:  List[Any]=None   ,		__A		:  int=None   ,		__A		:  Any=None   ,		__A		:  Any=0.0_2   ,		**__A		:  Dict   ,		)     ->			Tuple:




								'''simple docstring'''





								super().__init__(**__A					)
								lowerCAmelCase__  =   vision_config if vision_config is not None else {}
								lowerCAmelCase__  =   prompt_encoder_config if prompt_encoder_config is not None else {}
								lowerCAmelCase__  =   mask_decoder_config if mask_decoder_config is not None else {}

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

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




	def      lowercase__							(  self		:  List[Any]					)     ->			str:




								'''simple docstring'''





								lowerCAmelCase__  =   copy.deepcopy(self.__dict__					)
								lowerCAmelCase__  =   self.vision_config.to_dict()
								lowerCAmelCase__  =   self.prompt_encoder_config.to_dict()
								lowerCAmelCase__  =   self.mask_decoder_config.to_dict()
								lowerCAmelCase__  =   self.__class__.model_type
								return output










'''simple docstring'''







_UpperCamelCase  						=			{
    "kilogram": 1,
    "gram": pow(10, 3),
    "milligram": pow(10, 6),
    "metric-ton": pow(10, -3),
    "long-ton": 0.0009842073,
    "short-ton": 0.0011023122,
    "pound": 2.2046244202,
    "stone": 0.1574731728,
    "ounce": 35.273990723,
    "carrat": 5000,
    "atomic-mass-unit": 6.0_2213_6652e26,
}

_UpperCamelCase  						=			{
    "kilogram": 1,
    "gram": pow(10, -3),
    "milligram": pow(10, -6),
    "metric-ton": pow(10, 3),
    "long-ton": 1016.04608,
    "short-ton": 907.184,
    "pound": 0.453592,
    "stone": 6.35029,
    "ounce": 0.0283495,
    "carrat": 0.0002,
    "atomic-mass-unit": 1.6_6054_0199e-27,
}
def 			_lowerCAmelCase(      UpperCAmelCase_      :	str					, UpperCAmelCase_      :	str					, UpperCAmelCase_      :	float						) ->							float:
							if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
														lowerCAmelCase__  =   (
														    F'''Invalid \'from_type\' or \'to_type\' value: {from_type!r}, {to_type!r}\n'''
														    F'''Supported values are: {", ".join(UpperCAmelCase_						)}'''
														)
														raise ValueError(UpperCAmelCase_						)
							return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]


if __name__ == "__main__":
		import doctest

		doctest.testmod()





