
'''simple docstring'''

import copy

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


UpperCAmelCase__   : int					=		logging.get_logger(__name__)

UpperCAmelCase__   : Tuple					=		{
    "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     (	SCREAMING_SNAKE_CASE__    ):





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


				"""simple docstring"""

				super().__init__(**__magic_name__							)
				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    A     (	SCREAMING_SNAKE_CASE__    ):





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


				"""simple docstring"""

				super().__init__(**__magic_name__							)
				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    A     (	SCREAMING_SNAKE_CASE__    ):





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


				"""simple docstring"""

				super().__init__(**__magic_name__							)

				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    A     (	SCREAMING_SNAKE_CASE__    ):
	snake_case__      :str        =     'sam'
	snake_case__      :int        =     True





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


				"""simple docstring"""

				super().__init__(**__magic_name__							)
				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(__magic_name__      ,							__magic_name__							):
							lowerCAmelCase__								=							vision_config.to_dict()
				if isinstance(__magic_name__      ,							__magic_name__							):
							lowerCAmelCase__								=							prompt_encoder_config.to_dict()
				if isinstance(__magic_name__      ,							__magic_name__							):
							lowerCAmelCase__								=							mask_decoder_config.to_dict()

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







	def 							__SCREAMING_SNAKE_CASE  (					self			:       Optional[int]							):


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

from ..utils import DummyObject, requires_backends






class    A     (	metaclass=SCREAMING_SNAKE_CASE__    ):
	snake_case__      :Optional[Any]        =     ['torch', 'transformers', 'k_diffusion']





	def __init__(					self			:       Optional[Any]      ,							*__magic_name__			:       Optional[int]      ,							**__magic_name__			:       str							):


				"""simple docstring"""

				requires_backends(self      ,							["torch", "transformers", "k_diffusion"]							)





	@classmethod
	def 							__SCREAMING_SNAKE_CASE  (					cls			:       str      ,							*__magic_name__			:       Union[str, Any]      ,							**__magic_name__			:       int							):


				"""simple docstring"""

				requires_backends(cls      ,							["torch", "transformers", "k_diffusion"]							)







	@classmethod
	def 							__SCREAMING_SNAKE_CASE  (					cls			:       int      ,							*__magic_name__			:       Dict      ,							**__magic_name__			:       str							):


				"""simple docstring"""

				requires_backends(cls      ,							["torch", "transformers", "k_diffusion"]							)





