




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      a__       (   snake_case__ ):






						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						,     ):




											"""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      a__       (   snake_case__ ):






						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						,     ):




											"""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      a__       (   snake_case__ ):






						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-0_6						,     _A=0.0						,     _A=1E-1_0						,     _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						,     ):




											"""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      a__       (   snake_case__ ):
						_a				:       Optional[int]   =       """sam"""
						_a				:       Dict   =       True






						def __init__(  self						,     _A=None						,     _A=None						,     _A=None						,     _A=0.02						,     **_A						,     ):




											"""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 							__SCREAMING_SNAKE_CASE(  self     ):




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










from typing import TYPE_CHECKING

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


UpperCamelCase__            =     {"""configuration_vit_hybrid""": ["""VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViTHybridConfig"""]}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__            =     [
					    """VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST""",
					    """ViTHybridForImageClassification""",
					    """ViTHybridModel""",
					    """ViTHybridPreTrainedModel""",
					]

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__            =     ["""ViTHybridImageProcessor"""]


if TYPE_CHECKING:
					from .configuration_vit_hybrid import VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTHybridConfig

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_vit_hybrid import (
										    VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST,
										    ViTHybridForImageClassification,
										    ViTHybridModel,
										    ViTHybridPreTrainedModel,
										)

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .image_processing_vit_hybrid import ViTHybridImageProcessor


else:
					import sys

					UpperCamelCase__            =     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)




