






import copy

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


UpperCAmelCase_					:		Any           = logging.get_logger(__name__)

UpperCAmelCase_					:		List[str]           = {
    '''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			(     lowercase__ ):





	def __init__(						self							:   Dict					,    __lowerCamelCase							:   str=256					,    __lowerCamelCase							:   Optional[Any]=1_024					,    __lowerCamelCase							:   List[Any]=16					,    __lowerCamelCase							:   Tuple=16					,    __lowerCamelCase							:   Optional[Any]=4					,    __lowerCamelCase							:   Optional[int]="gelu"					,    __lowerCamelCase							:   int=1E-6					,    **__lowerCamelCase							:   Any					,    ):
		super().__init__(**__lowerCamelCase      )
		UpperCamelCase	:List[str]		=      hidden_size
		UpperCamelCase	:Tuple		=      image_size
		UpperCamelCase	:str		=      patch_size
		UpperCamelCase	:int		=      image_size // patch_size
		UpperCamelCase	:List[Any]		=      mask_input_channels
		UpperCamelCase	:Any		=      num_point_embeddings
		UpperCamelCase	:int		=      hidden_act
		UpperCamelCase	:Dict		=      layer_norm_eps

class        _SCREAMING_SNAKE_CASE			(     lowercase__ ):





	def __init__(						self							:   Tuple					,    __lowerCamelCase							:   Tuple=256					,    __lowerCamelCase							:   str="relu"					,    __lowerCamelCase							:   Union[str, Any]=2_048					,    __lowerCamelCase							:   str=2					,    __lowerCamelCase							:   Optional[Any]=8					,    __lowerCamelCase							:   Optional[int]=2					,    __lowerCamelCase							:   Any=3					,    __lowerCamelCase							:   str=3					,    __lowerCamelCase							:   Optional[int]=256					,    __lowerCamelCase							:   Optional[int]=1E-6					,    **__lowerCamelCase							:   List[str]					,    ):
		super().__init__(**__lowerCamelCase      )
		UpperCamelCase	:Any		=      hidden_size
		UpperCamelCase	:List[str]		=      hidden_act
		UpperCamelCase	:Any		=      mlp_dim
		UpperCamelCase	:Optional[int]		=      num_hidden_layers
		UpperCamelCase	:Union[str, Any]		=      num_attention_heads
		UpperCamelCase	:Union[str, Any]		=      attention_downsample_rate
		UpperCamelCase	:List[Any]		=      num_multimask_outputs
		UpperCamelCase	:List[Any]		=      iou_head_depth
		UpperCamelCase	:Dict		=      iou_head_hidden_dim
		UpperCamelCase	:Optional[Any]		=      layer_norm_eps

class        _SCREAMING_SNAKE_CASE			(     lowercase__ ):





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

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

class        _SCREAMING_SNAKE_CASE			(     lowercase__ ):
	snake_case__				:	int	      =    """sam"""
	snake_case__				:	Optional[int]	      =    True





	def __init__(						self							:   int					,    __lowerCamelCase							:   Tuple=None					,    __lowerCamelCase							:   Dict=None					,    __lowerCamelCase							:   Tuple=None					,    __lowerCamelCase							:   Dict=0.02					,    **__lowerCamelCase							:   Optional[Any]					,    ):
		super().__init__(**__lowerCamelCase      )
		UpperCamelCase	:List[Any]		=      vision_config if vision_config is not None else {}
		UpperCamelCase	:List[Any]		=      prompt_encoder_config if prompt_encoder_config is not None else {}
		UpperCamelCase	:str		=      mask_decoder_config if mask_decoder_config is not None else {}

		if isinstance(__lowerCamelCase					,    __lowerCamelCase      ):
			UpperCamelCase	:int		=      vision_config.to_dict()
		if isinstance(__lowerCamelCase					,    __lowerCamelCase      ):
			UpperCamelCase	:Any		=      prompt_encoder_config.to_dict()
		if isinstance(__lowerCamelCase					,    __lowerCamelCase      ):
			UpperCamelCase	:Union[str, Any]		=      mask_decoder_config.to_dict()

		UpperCamelCase	:Any		=      SamVisionConfig(**__lowerCamelCase      )
		UpperCamelCase	:Tuple		=      SamPromptEncoderConfig(**__lowerCamelCase      )
		UpperCamelCase	:str		=      SamMaskDecoderConfig(**__lowerCamelCase      )
		UpperCamelCase	:Optional[int]		=      initializer_range





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






from __future__ import annotations

import random







class 		__UpperCAmelCase:





     """simple docstring"""



     __UpperCAmelCase						:			Optional[int]							=     6

     def __init__(   self			:							int     )      ->      Optional[Any]:






         """simple docstring"""
         a__  			=							list(range(1    ,					Dice.NUM_SIDES + 1     )     )






     def 					__SCREAMING_SNAKE_CASE		(   self			:							Union[str, Any]     )      ->      List[str]:






         """simple docstring"""
         return random.choice(self.sides     )






def 							__lowerCAmelCase			(UpperCAmelCase_ ,     UpperCAmelCase_ = 2		):
    a__  			=							[Dice() for i in range(UpperCAmelCase_		)]
    a__  			=							[0] * (len(UpperCAmelCase_		) * Dice.NUM_SIDES + 1)
    for _ in range(UpperCAmelCase_		):
        count_of_sum[sum(dice.roll() for dice in dices		)] += 1
    a__  			=							[round((count * 100) / num_throws ,     2		) for count in count_of_sum]
    return probability[num_dice:]  # remove probability of sums that never appear


if __name__ == "__main__":
 import doctest

 doctest.testmod()






