
"""simple docstring"""







import copy

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


lowercase_						    =					logging.get_logger(__name__)

lowercase_						    =					{
    "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_	(lowerCamelCase_						):
 """simple docstring"""




 def __init__( self       : Dict     ,   a_       : List[str]=2_56     ,   a_       : int=10_24     ,   a_       : List[Any]=16     ,   a_       : int=16     ,   a_       : Tuple=4     ,   a_       : Tuple="gelu"     ,   a_       : int=1E-6     ,   **a_       : Union[str, Any]     ,   )->					Optional[Any]:



      """simple docstring"""

      super().__init__(**a_ )
      UpperCAmelCase_						:    Dict    					=  hidden_size
      UpperCAmelCase_						:    str    					=  image_size
      UpperCAmelCase_						:    Optional[Any]    					=  patch_size
      UpperCAmelCase_						:    Tuple    					=  image_size // patch_size
      UpperCAmelCase_						:    Tuple    					=  mask_input_channels
      UpperCAmelCase_						:    str    					=  num_point_embeddings
      UpperCAmelCase_						:    List[str]    					=  hidden_act
      UpperCAmelCase_						:    Tuple    					=  layer_norm_eps



class 		UpperCAmelCase_	(lowerCamelCase_						):
 """simple docstring"""




 def __init__( self       : Any     ,   a_       : Tuple=2_56     ,   a_       : Any="relu"     ,   a_       : Optional[int]=20_48     ,   a_       : str=2     ,   a_       : int=8     ,   a_       : Optional[Any]=2     ,   a_       : Dict=3     ,   a_       : int=3     ,   a_       : Optional[Any]=2_56     ,   a_       : Any=1E-6     ,   **a_       : List[str]     ,   )->					List[str]:



      """simple docstring"""

      super().__init__(**a_ )
      UpperCAmelCase_						:    Any    					=  hidden_size
      UpperCAmelCase_						:    List[str]    					=  hidden_act
      UpperCAmelCase_						:    Optional[Any]    					=  mlp_dim
      UpperCAmelCase_						:    Optional[Any]    					=  num_hidden_layers
      UpperCAmelCase_						:    List[str]    					=  num_attention_heads
      UpperCAmelCase_						:    int    					=  attention_downsample_rate
      UpperCAmelCase_						:    List[str]    					=  num_multimask_outputs
      UpperCAmelCase_						:    Optional[Any]    					=  iou_head_depth
      UpperCAmelCase_						:    Tuple    					=  iou_head_hidden_dim
      UpperCAmelCase_						:    List[Any]    					=  layer_norm_eps



class 		UpperCAmelCase_	(lowerCamelCase_						):
 """simple docstring"""




 def __init__( self       : str     ,   a_       : int=7_68     ,   a_       : Optional[Any]=2_56     ,   a_       : Optional[Any]=12     ,   a_       : Union[str, Any]=12     ,   a_       : Any=3     ,   a_       : Tuple=10_24     ,   a_       : Optional[Any]=16     ,   a_       : int="gelu"     ,   a_       : int=1E-06     ,   a_       : Union[str, Any]=0.0     ,   a_       : Tuple=1E-10     ,   a_       : List[Any]=True     ,   a_       : Tuple=4.0     ,   a_       : str=True     ,   a_       : str=True     ,   a_       : Any=14     ,   a_       : Tuple=[2, 5, 8, 11]     ,   a_       : Optional[Any]=1_28     ,   a_       : List[str]=None     ,   **a_       : Any     ,   )->					Optional[int]:



      """simple docstring"""

      super().__init__(**a_ )

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



class 		UpperCAmelCase_	(lowerCamelCase_						):
 """simple docstring"""




 UpperCamelCase_						:     str				   =    """sam"""
 UpperCamelCase_						:     List[Any]				   =    True




 def __init__( self       : Any     ,   a_       : Optional[Any]=None     ,   a_       : Tuple=None     ,   a_       : Optional[int]=None     ,   a_       : Tuple=0.02     ,   **a_       : Union[str, Any]     ,   )->					Dict:



      """simple docstring"""

      super().__init__(**a_ )
      UpperCAmelCase_						:    Optional[int]    					=  vision_config if vision_config is not None else {}
      UpperCAmelCase_						:    str    					=  prompt_encoder_config if prompt_encoder_config is not None else {}
      UpperCAmelCase_						:    Optional[int]    					=  mask_decoder_config if mask_decoder_config is not None else {}

      if isinstance(a_     ,   a_ ):
           UpperCAmelCase_						:    Optional[int]    					=  vision_config.to_dict()
      if isinstance(a_     ,   a_ ):
           UpperCAmelCase_						:    List[str]    					=  prompt_encoder_config.to_dict()
      if isinstance(a_     ,   a_ ):
           UpperCAmelCase_						:    int    					=  mask_decoder_config.to_dict()

      UpperCAmelCase_						:    Union[str, Any]    					=  SamVisionConfig(**a_ )
      UpperCAmelCase_						:    Optional[int]    					=  SamPromptEncoderConfig(**a_ )
      UpperCAmelCase_						:    Dict    					=  SamMaskDecoderConfig(**a_ )
      UpperCAmelCase_						:    Optional[Any]    					=  initializer_range






 def   a      ( self       : Union[str, Any] )->					Optional[int]:



      """simple docstring"""

      UpperCAmelCase_						:    List[str]    					=  copy.deepcopy(self.__dict__ )
      UpperCAmelCase_						:    Tuple    					=  self.vision_config.to_dict()
      UpperCAmelCase_						:    List[str]    					=  self.prompt_encoder_config.to_dict()
      UpperCAmelCase_						:    List[str]    					=  self.mask_decoder_config.to_dict()
      UpperCAmelCase_						:    List[Any]    					=  self.__class__.model_type
      return output



"""simple docstring"""







import warnings

from .generation import FlaxGenerationMixin



class 		UpperCAmelCase_	(lowerCamelCase_						):
 """simple docstring"""




 warnings.warn(
     """Importing `FlaxGenerationMixin` from `src/transformers/generation_flax_utils.py` is deprecated and will """
     """be removed in Transformers v5. Import as `from transformers import FlaxGenerationMixin` instead."""  , lowerCamelCase_  , )

