'''simple docstring'''




import copy

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


snake_case  =			logging.get_logger(__name__)

snake_case  =			{
    '''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        SCREAMING_SNAKE_CASE   (				UpperCamelCase_ ):
  """simple docstring"""







  def __init__(  self   :					int					,					__lowerCAmelCase   :					List[Any]=256					,					__lowerCAmelCase   :					Any=1024					,					__lowerCAmelCase   :					int=16					,					__lowerCAmelCase   :					Optional[int]=16					,					__lowerCAmelCase   :					List[str]=4					,					__lowerCAmelCase   :					Optional[int]="gelu"					,					__lowerCAmelCase   :					str=1e-6					,					**__lowerCAmelCase   :					Union[str, Any]					,					):


        """simple docstring"""



        super().__init__(**__SCREAMING_SNAKE_CASE					)
        _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        SCREAMING_SNAKE_CASE   (				UpperCamelCase_ ):
  """simple docstring"""







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


        """simple docstring"""



        super().__init__(**__SCREAMING_SNAKE_CASE					)
        _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        SCREAMING_SNAKE_CASE   (				UpperCamelCase_ ):
  """simple docstring"""







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


        """simple docstring"""



        super().__init__(**__SCREAMING_SNAKE_CASE					)

        _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        SCREAMING_SNAKE_CASE   (				UpperCamelCase_ ):
  """simple docstring"""







  __A     =		"""sam"""
  __A     =		True



  def __init__(  self   :					Any					,					__lowerCAmelCase   :					Dict=None					,					__lowerCAmelCase   :					Dict=None					,					__lowerCAmelCase   :					Any=None					,					__lowerCAmelCase   :					int=0.0_2					,					**__lowerCAmelCase   :					str					,					):


        """simple docstring"""



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

        _lowerCAmelCase		   =   SamVisionConfig(**__SCREAMING_SNAKE_CASE					)
        _lowerCAmelCase		   =   SamPromptEncoderConfig(**__SCREAMING_SNAKE_CASE					)
        _lowerCAmelCase		   =   SamMaskDecoderConfig(**__SCREAMING_SNAKE_CASE					)
        _lowerCAmelCase		   =   initializer_range



  def   a   (  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 typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


snake_case  =			{
    '''configuration_align''': [
        '''ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''AlignConfig''',
        '''AlignTextConfig''',
        '''AlignVisionConfig''',
    ],
    '''processing_align''': ['''AlignProcessor'''],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 snake_case  =			[
     '''ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''AlignModel''',
     '''AlignPreTrainedModel''',
     '''AlignTextModel''',
     '''AlignVisionModel''',
 ]

if TYPE_CHECKING:
 from .configuration_align import (
     ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP,
     AlignConfig,
     AlignTextConfig,
     AlignVisionConfig,
 )
 from .processing_align import AlignProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_align import (
      ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST,
      AlignModel,
      AlignPreTrainedModel,
      AlignTextModel,
      AlignVisionModel,
  )

else:
 import sys

 snake_case  =			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





