
import copy

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


A__       :   int   						=					logging.get_logger(__name__)

A__       :   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 						lowercase       (  __UpperCamelCase					):
					def __init__(		self ,	SCREAMING_SNAKE_CASE__=256 ,	SCREAMING_SNAKE_CASE__=1024 ,	SCREAMING_SNAKE_CASE__=16 ,	SCREAMING_SNAKE_CASE__=16 ,	SCREAMING_SNAKE_CASE__=4 ,	SCREAMING_SNAKE_CASE__="gelu" ,	SCREAMING_SNAKE_CASE__=1E-6 ,	**SCREAMING_SNAKE_CASE__ ,	):
								"""simple docstring"""







								super().__init__(**SCREAMING_SNAKE_CASE__    )
								lowerCAmelCase__ :    int				      =			hidden_size
								lowerCAmelCase__ :    Tuple				      =			image_size
								lowerCAmelCase__ :    Dict				      =			patch_size
								lowerCAmelCase__ :    List[Any]				      =			image_size // patch_size
								lowerCAmelCase__ :    List[Any]				      =			mask_input_channels
								lowerCAmelCase__ :    Tuple				      =			num_point_embeddings
								lowerCAmelCase__ :    Optional[Any]				      =			hidden_act
								lowerCAmelCase__ :    Dict				      =			layer_norm_eps





class 						lowercase       (  __UpperCamelCase					):
					def __init__(		self ,	SCREAMING_SNAKE_CASE__=256 ,	SCREAMING_SNAKE_CASE__="relu" ,	SCREAMING_SNAKE_CASE__=2048 ,	SCREAMING_SNAKE_CASE__=2 ,	SCREAMING_SNAKE_CASE__=8 ,	SCREAMING_SNAKE_CASE__=2 ,	SCREAMING_SNAKE_CASE__=3 ,	SCREAMING_SNAKE_CASE__=3 ,	SCREAMING_SNAKE_CASE__=256 ,	SCREAMING_SNAKE_CASE__=1E-6 ,	**SCREAMING_SNAKE_CASE__ ,	):
								"""simple docstring"""







								super().__init__(**SCREAMING_SNAKE_CASE__    )
								lowerCAmelCase__ :    List[Any]				      =			hidden_size
								lowerCAmelCase__ :    Dict				      =			hidden_act
								lowerCAmelCase__ :    Any				      =			mlp_dim
								lowerCAmelCase__ :    Tuple				      =			num_hidden_layers
								lowerCAmelCase__ :    Tuple				      =			num_attention_heads
								lowerCAmelCase__ :    Dict				      =			attention_downsample_rate
								lowerCAmelCase__ :    Optional[int]				      =			num_multimask_outputs
								lowerCAmelCase__ :    Dict				      =			iou_head_depth
								lowerCAmelCase__ :    int				      =			iou_head_hidden_dim
								lowerCAmelCase__ :    Union[str, Any]				      =			layer_norm_eps





class 						lowercase       (  __UpperCamelCase					):
					def __init__(		self ,	SCREAMING_SNAKE_CASE__=768 ,	SCREAMING_SNAKE_CASE__=256 ,	SCREAMING_SNAKE_CASE__=12 ,	SCREAMING_SNAKE_CASE__=12 ,	SCREAMING_SNAKE_CASE__=3 ,	SCREAMING_SNAKE_CASE__=1024 ,	SCREAMING_SNAKE_CASE__=16 ,	SCREAMING_SNAKE_CASE__="gelu" ,	SCREAMING_SNAKE_CASE__=1E-06 ,	SCREAMING_SNAKE_CASE__=0.0 ,	SCREAMING_SNAKE_CASE__=1E-10 ,	SCREAMING_SNAKE_CASE__=True ,	SCREAMING_SNAKE_CASE__=4.0 ,	SCREAMING_SNAKE_CASE__=True ,	SCREAMING_SNAKE_CASE__=True ,	SCREAMING_SNAKE_CASE__=14 ,	SCREAMING_SNAKE_CASE__=[2, 5, 8, 11] ,	SCREAMING_SNAKE_CASE__=128 ,	SCREAMING_SNAKE_CASE__=None ,	**SCREAMING_SNAKE_CASE__ ,	):
								"""simple docstring"""







								super().__init__(**SCREAMING_SNAKE_CASE__    )

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





class 						lowercase       (  __UpperCamelCase					):
					__a					=    """sam"""
					__a					=    True
					def __init__(		self ,	SCREAMING_SNAKE_CASE__=None ,	SCREAMING_SNAKE_CASE__=None ,	SCREAMING_SNAKE_CASE__=None ,	SCREAMING_SNAKE_CASE__=0.02 ,	**SCREAMING_SNAKE_CASE__ ,	):
								"""simple docstring"""







								super().__init__(**SCREAMING_SNAKE_CASE__    )
								lowerCAmelCase__ :    List[str]				      =			vision_config if vision_config is not None else {}
								lowerCAmelCase__ :    Dict				      =			prompt_encoder_config if prompt_encoder_config is not None else {}
								lowerCAmelCase__ :    List[str]				      =			mask_decoder_config if mask_decoder_config is not None else {}

								if isinstance(SCREAMING_SNAKE_CASE__ ,	SCREAMING_SNAKE_CASE__    ):
											lowerCAmelCase__ :    Optional[int]				      =			vision_config.to_dict()
								if isinstance(SCREAMING_SNAKE_CASE__ ,	SCREAMING_SNAKE_CASE__    ):
											lowerCAmelCase__ :    Any				      =			prompt_encoder_config.to_dict()
								if isinstance(SCREAMING_SNAKE_CASE__ ,	SCREAMING_SNAKE_CASE__    ):
											lowerCAmelCase__ :    Optional[Any]				      =			mask_decoder_config.to_dict()

								lowerCAmelCase__ :    List[Any]				      =			SamVisionConfig(**SCREAMING_SNAKE_CASE__    )
								lowerCAmelCase__ :    Tuple				      =			SamPromptEncoderConfig(**SCREAMING_SNAKE_CASE__    )
								lowerCAmelCase__ :    List[Any]				      =			SamMaskDecoderConfig(**SCREAMING_SNAKE_CASE__    )
								lowerCAmelCase__ :    int				      =			initializer_range
					def lowercase_			(		self    ):
								"""simple docstring"""







								lowerCAmelCase__ :    Any				      =			copy.deepcopy(self.__dict__    )
								lowerCAmelCase__ :    Optional[Any]				      =			self.vision_config.to_dict()
								lowerCAmelCase__ :    List[Any]				      =			self.prompt_encoder_config.to_dict()
								lowerCAmelCase__ :    int				      =			self.mask_decoder_config.to_dict()
								lowerCAmelCase__ :    int				      =			self.__class__.model_type
								return output





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


A__       :   Union[str, Any]   						=					{"""configuration_cvt""": ["""CVT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CvtConfig"""]}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__       :   Union[str, Any]   						=					[
							    """CVT_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """CvtForImageClassification""",
							    """CvtModel""",
							    """CvtPreTrainedModel""",
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A__       :   str   						=					[
							    """TF_CVT_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """TFCvtForImageClassification""",
							    """TFCvtModel""",
							    """TFCvtPreTrainedModel""",
							]

if TYPE_CHECKING:
							from .configuration_cvt import CVT_PRETRAINED_CONFIG_ARCHIVE_MAP, CvtConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_cvt import (
														    CVT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    CvtForImageClassification,
														    CvtModel,
														    CvtPreTrainedModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_cvt import (
														    TF_CVT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFCvtForImageClassification,
														    TFCvtModel,
														    TFCvtPreTrainedModel,
														)


else:
							import sys

							A__       :   Optional[Any]   						=					_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



