


import copy

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


__lowerCAmelCase									=				logging.get_logger(__name__)

__lowerCAmelCase									=				{
    '''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     (       __UpperCamelCase ):
 def __init__(  self							,					lowerCAmelCase__=256							,					lowerCAmelCase__=1_024							,					lowerCAmelCase__=16							,					lowerCAmelCase__=16							,					lowerCAmelCase__=4							,					lowerCAmelCase__="gelu"							,					lowerCAmelCase__=1E-6							,					**lowerCAmelCase__							,					)   ->							List[Any]:




        '''simple docstring'''
        super().__init__(**lowerCAmelCase__					)
        lowercase__:  List[str]         =  hidden_size
        lowercase__:  Tuple         =  image_size
        lowercase__:  Any         =  patch_size
        lowercase__:  Any         =  image_size // patch_size
        lowercase__:  List[str]         =  mask_input_channels
        lowercase__:  Union[str, Any]         =  num_point_embeddings
        lowercase__:  int         =  hidden_act
        lowercase__:  Optional[int]         =  layer_norm_eps





class     __a     (       __UpperCamelCase ):
 def __init__(  self							,					lowerCAmelCase__=256							,					lowerCAmelCase__="relu"							,					lowerCAmelCase__=2_048							,					lowerCAmelCase__=2							,					lowerCAmelCase__=8							,					lowerCAmelCase__=2							,					lowerCAmelCase__=3							,					lowerCAmelCase__=3							,					lowerCAmelCase__=256							,					lowerCAmelCase__=1E-6							,					**lowerCAmelCase__							,					)   ->							List[str]:




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





class     __a     (       __UpperCamelCase ):
 def __init__(  self							,					lowerCAmelCase__=768							,					lowerCAmelCase__=256							,					lowerCAmelCase__=12							,					lowerCAmelCase__=12							,					lowerCAmelCase__=3							,					lowerCAmelCase__=1_024							,					lowerCAmelCase__=16							,					lowerCAmelCase__="gelu"							,					lowerCAmelCase__=1E-06							,					lowerCAmelCase__=0.0							,					lowerCAmelCase__=1E-10							,					lowerCAmelCase__=True							,					lowerCAmelCase__=4.0							,					lowerCAmelCase__=True							,					lowerCAmelCase__=True							,					lowerCAmelCase__=14							,					lowerCAmelCase__=[2, 5, 8, 11]							,					lowerCAmelCase__=128							,					lowerCAmelCase__=None							,					**lowerCAmelCase__							,					)   ->							Dict:




        '''simple docstring'''
        super().__init__(**lowerCAmelCase__					)

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





class     __a     (       __UpperCamelCase ):
 __lowercase					:				str  	=					'sam'
 __lowercase					:				List[str]  	=					True
 def __init__(  self							,					lowerCAmelCase__=None							,					lowerCAmelCase__=None							,					lowerCAmelCase__=None							,					lowerCAmelCase__=0.0_2							,					**lowerCAmelCase__							,					)   ->							Any:




        '''simple docstring'''
        super().__init__(**lowerCAmelCase__					)
        lowercase__:  Optional[int]         =  vision_config if vision_config is not None else {}
        lowercase__:  str         =  prompt_encoder_config if prompt_encoder_config is not None else {}
        lowercase__:  Dict         =  mask_decoder_config if mask_decoder_config is not None else {}

        if isinstance(lowerCAmelCase__							,					lowerCAmelCase__					):
               lowercase__:  List[str]         =  vision_config.to_dict()
        if isinstance(lowerCAmelCase__							,					lowerCAmelCase__					):
               lowercase__:  Optional[int]         =  prompt_encoder_config.to_dict()
        if isinstance(lowerCAmelCase__							,					lowerCAmelCase__					):
               lowercase__:  Union[str, Any]         =  mask_decoder_config.to_dict()

        lowercase__:  Optional[Any]         =  SamVisionConfig(**lowerCAmelCase__					)
        lowercase__:  str         =  SamPromptEncoderConfig(**lowerCAmelCase__					)
        lowercase__:  Any         =  SamMaskDecoderConfig(**lowerCAmelCase__					)
        lowercase__:  Union[str, Any]         =  initializer_range
 def 						SCREAMING_SNAKE_CASE__  (  self					)   ->							Union[str, Any]:




        '''simple docstring'''
        lowercase__:  Optional[int]         =  copy.deepcopy(self.__dict__					)
        lowercase__:  Optional[int]         =  self.vision_config.to_dict()
        lowercase__:  Tuple         =  self.prompt_encoder_config.to_dict()
        lowercase__:  List[Any]         =  self.mask_decoder_config.to_dict()
        lowercase__:  Union[str, Any]         =  self.__class__.model_type
        return output






from typing import TYPE_CHECKING

from ...utils import _LazyModule


__lowerCAmelCase									=				{'''tokenization_phobert''': ['''PhobertTokenizer''']}


if TYPE_CHECKING:
 from .tokenization_phobert import PhobertTokenizer

else:
 import sys

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


