






import copy

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


a 			=							logging.get_logger(__name__)

a 			=							{
    '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 							__snake_case(       __a   ):



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

    """simple docstring"""






    super().__init__(**lowerCAmelCase_						)
    lowercase__    :						Optional[Any]       =			hidden_size
    lowercase__    :						Any       =			image_size
    lowercase__    :						Union[str, Any]       =			patch_size
    lowercase__    :						Optional[Any]       =			image_size // patch_size
    lowercase__    :						str       =			mask_input_channels
    lowercase__    :						str       =			num_point_embeddings
    lowercase__    :						Dict       =			hidden_act
    lowercase__    :						int       =			layer_norm_eps
class 							__snake_case(       __a   ):



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

    """simple docstring"""






    super().__init__(**lowerCAmelCase_						)
    lowercase__    :						str       =			hidden_size
    lowercase__    :						Optional[int]       =			hidden_act
    lowercase__    :						List[Any]       =			mlp_dim
    lowercase__    :						Tuple       =			num_hidden_layers
    lowercase__    :						Optional[int]       =			num_attention_heads
    lowercase__    :						List[str]       =			attention_downsample_rate
    lowercase__    :						int       =			num_multimask_outputs
    lowercase__    :						Union[str, Any]       =			iou_head_depth
    lowercase__    :						Dict       =			iou_head_hidden_dim
    lowercase__    :						Any       =			layer_norm_eps
class 							__snake_case(       __a   ):



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

    """simple docstring"""






    super().__init__(**lowerCAmelCase_						)

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



 def __init__(						self : Tuple			,		UpperCAmelCase__ : Optional[Any]=None			,		UpperCAmelCase__ : Any=None			,		UpperCAmelCase__ : Any=None			,		UpperCAmelCase__ : Dict=0.02			,		**UpperCAmelCase__ : str			,		):

    """simple docstring"""






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

    if isinstance(lowerCAmelCase_			,		lowerCAmelCase_						):
       lowercase__    :						Any       =			vision_config.to_dict()
    if isinstance(lowerCAmelCase_			,		lowerCAmelCase_						):
       lowercase__    :						Any       =			prompt_encoder_config.to_dict()
    if isinstance(lowerCAmelCase_			,		lowerCAmelCase_						):
       lowercase__    :						Dict       =			mask_decoder_config.to_dict()

    lowercase__    :						int       =			SamVisionConfig(**lowerCAmelCase_						)
    lowercase__    :						Optional[Any]       =			SamPromptEncoderConfig(**lowerCAmelCase_						)
    lowercase__    :						int       =			SamMaskDecoderConfig(**lowerCAmelCase_						)
    lowercase__    :						Union[str, Any]       =			initializer_range







 def     UpperCAmelCase     (						self : Tuple						):

    """simple docstring"""






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







'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available


lowercase											=      {}

try:
  if not is_sentencepiece_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase											=      ['''BarthezTokenizer''']

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase											=      ['''BarthezTokenizerFast''']


if TYPE_CHECKING:
  try:
    if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_barthez import BarthezTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_barthez_fast import BarthezTokenizerFast

else:
  import sys

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


