
import copy

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


SCREAMING_SNAKE_CASE   :		Dict					 =       logging.get_logger(__name__)

SCREAMING_SNAKE_CASE   :		List[str]					 =       {
    "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 					__lowercase		(					A       ):


					def __init__(	self       ,       a__=2_5_6       ,       a__=1_0_2_4       ,       a__=1_6       ,       a__=1_6       ,       a__=4       ,       a__="gelu"       ,       a__=1E-6       ,       **a__       ,       )		->							str:





									'''simple docstring'''
									super().__init__(**a__						)
									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 					__lowercase		(					A       ):


					def __init__(	self       ,       a__=2_5_6       ,       a__="relu"       ,       a__=2_0_4_8       ,       a__=2       ,       a__=8       ,       a__=2       ,       a__=3       ,       a__=3       ,       a__=2_5_6       ,       a__=1E-6       ,       **a__       ,       )		->							Dict:





									'''simple docstring'''
									super().__init__(**a__						)
									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 					__lowercase		(					A       ):


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





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

									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 					__lowercase		(					A       ):
					__magic_name__						:							str     	=	'''sam'''
					__magic_name__						:							List[str]     	=	True


					def __init__(	self       ,       a__=None       ,       a__=None       ,       a__=None       ,       a__=0.02       ,       **a__       ,       )		->							Optional[Any]:





									'''simple docstring'''
									super().__init__(**a__						)
									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(a__       ,       a__						):
													A_       	=  vision_config.to_dict()
									if isinstance(a__       ,       a__						):
													A_       	=  prompt_encoder_config.to_dict()
									if isinstance(a__       ,       a__						):
													A_       	=  mask_decoder_config.to_dict()

									A_       	=  SamVisionConfig(**a__						)
									A_       	=  SamPromptEncoderConfig(**a__						)
									A_       	=  SamMaskDecoderConfig(**a__						)
									A_       	=  initializer_range


					def        lowerCAmelCase_    (	self						)		->							Dict:





									'''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

from collections import namedtuple

SCREAMING_SNAKE_CASE   :		Any					 =       namedtuple("from_to", "from_ to")

SCREAMING_SNAKE_CASE   :		str					 =       {
    "atm": from_to(1, 1),
    "pascal": from_to(0.0000098, 10_1325),
    "bar": from_to(0.986923, 1.01325),
    "kilopascal": from_to(0.00986923, 101.325),
    "megapascal": from_to(9.86923, 0.101325),
    "psi": from_to(0.068046, 14.6959),
    "inHg": from_to(0.0334211, 29.9213),
    "torr": from_to(0.00131579, 760),
}



def        lowerCamelCase_  (   __UpperCamelCase ,						__UpperCamelCase ,						__UpperCamelCase     ):
				if from_type not in PRESSURE_CONVERSION:
								raise ValueError(
								    F"Invalid 'from_type' value: {from_type!r}  Supported values are:\n"
								    + ''', '''.join(__UpperCamelCase     )     )
				if to_type not in PRESSURE_CONVERSION:
								raise ValueError(
								    F"Invalid 'to_type' value: {to_type!r}.  Supported values are:\n"
								    + ''', '''.join(__UpperCamelCase     )     )
				return (
				    value * PRESSURE_CONVERSION[from_type].from_ * PRESSURE_CONVERSION[to_type].to
				)


if __name__ == "__main__":
						import doctest

						doctest.testmod()