






"""simple docstring"""
import copy

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


snake_case   :   Union[str, Any]    		=		logging.get_logger(__name__)

snake_case   :   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 					UpperCamelCase__   (							a_):







    """simple docstring"""







    def __init__(		self   :  Any							,						UpperCamelCase_   :  int=2_5_6							,						UpperCamelCase_   :  Any=1_0_2_4							,						UpperCamelCase_   :  Union[str, Any]=1_6							,						UpperCamelCase_   :  Tuple=1_6							,						UpperCamelCase_   :  List[str]=4							,						UpperCamelCase_   :  Tuple="gelu"							,						UpperCamelCase_   :  List[Any]=1e-6							,						**UpperCamelCase_   :  Tuple							,						):





           '''simple docstring'''

           super().__init__(**UpperCamelCase_   )
           __magic_name__										=						hidden_size
           __magic_name__										=						image_size
           __magic_name__										=						patch_size
           __magic_name__										=						image_size // patch_size
           __magic_name__										=						mask_input_channels
           __magic_name__										=						num_point_embeddings
           __magic_name__										=						hidden_act
           __magic_name__										=						layer_norm_eps



class 					UpperCamelCase__   (							a_):







    """simple docstring"""







    def __init__(		self   :  List[Any]							,						UpperCamelCase_   :  int=2_5_6							,						UpperCamelCase_   :  Optional[int]="relu"							,						UpperCamelCase_   :  Optional[int]=2_0_4_8							,						UpperCamelCase_   :  Optional[Any]=2							,						UpperCamelCase_   :  List[Any]=8							,						UpperCamelCase_   :  Optional[int]=2							,						UpperCamelCase_   :  str=3							,						UpperCamelCase_   :  Tuple=3							,						UpperCamelCase_   :  int=2_5_6							,						UpperCamelCase_   :  Optional[int]=1e-6							,						**UpperCamelCase_   :  List[str]							,						):





           '''simple docstring'''

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



class 					UpperCamelCase__   (							a_):







    """simple docstring"""







    def __init__(		self   :  Optional[int]							,						UpperCamelCase_   :  Any=7_6_8							,						UpperCamelCase_   :  Union[str, Any]=2_5_6							,						UpperCamelCase_   :  Any=1_2							,						UpperCamelCase_   :  int=1_2							,						UpperCamelCase_   :  Dict=3							,						UpperCamelCase_   :  Optional[int]=1_0_2_4							,						UpperCamelCase_   :  Optional[Any]=1_6							,						UpperCamelCase_   :  List[Any]="gelu"							,						UpperCamelCase_   :  List[Any]=1e-0_6							,						UpperCamelCase_   :  List[str]=0.0							,						UpperCamelCase_   :  str=1e-1_0							,						UpperCamelCase_   :  Optional[int]=True							,						UpperCamelCase_   :  Tuple=4.0							,						UpperCamelCase_   :  Optional[int]=True							,						UpperCamelCase_   :  Dict=True							,						UpperCamelCase_   :  Any=1_4							,						UpperCamelCase_   :  List[Any]=[2, 5, 8, 1_1]							,						UpperCamelCase_   :  Any=1_2_8							,						UpperCamelCase_   :  Optional[Any]=None							,						**UpperCamelCase_   :  List[Any]							,						):





           '''simple docstring'''

           super().__init__(**UpperCamelCase_   )

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



class 					UpperCamelCase__   (							a_):







    """simple docstring"""
    __UpperCAmelCase											=   """sam"""
    __UpperCAmelCase											=   True







    def __init__(		self   :  Tuple							,						UpperCamelCase_   :  Optional[int]=None							,						UpperCamelCase_   :  Any=None							,						UpperCamelCase_   :  int=None							,						UpperCamelCase_   :  List[Any]=0.02							,						**UpperCamelCase_   :  Dict							,						):





           '''simple docstring'''

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

           if isinstance(UpperCamelCase_							,						UpperCamelCase_   ):
                  __magic_name__										=						vision_config.to_dict()
           if isinstance(UpperCamelCase_							,						UpperCamelCase_   ):
                  __magic_name__										=						prompt_encoder_config.to_dict()
           if isinstance(UpperCamelCase_							,						UpperCamelCase_   ):
                  __magic_name__										=						mask_decoder_config.to_dict()

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







    def 							a__ (		self   :  str   ):





           '''simple docstring'''

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







"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


snake_case   :   str    		=		{"""configuration_sew_d""": ["""SEW_D_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SEWDConfig"""]}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 snake_case   :   Union[str, Any]    		=		[
     """SEW_D_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """SEWDForCTC""",
     """SEWDForSequenceClassification""",
     """SEWDModel""",
     """SEWDPreTrainedModel""",
 ]

if TYPE_CHECKING:
 from .configuration_sew_d import SEW_D_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWDConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_sew_d import (
      SEW_D_PRETRAINED_MODEL_ARCHIVE_LIST,
      SEWDForCTC,
      SEWDForSequenceClassification,
      SEWDModel,
      SEWDPreTrainedModel,
  )


else:
 import sys

 snake_case   :   Union[str, Any]    		=		_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)