






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(					lowercase_      ):



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

				"""simple docstring"""






				super().__init__(**UpperCAmelCase__	)
				lowercase__						:	List[Any]         = hidden_size
				lowercase__						:	Any         = image_size
				lowercase__						:	int         = patch_size
				lowercase__						:	int         = image_size // patch_size
				lowercase__						:	Any         = mask_input_channels
				lowercase__						:	List[str]         = num_point_embeddings
				lowercase__						:	int         = hidden_act
				lowercase__						:	str         = layer_norm_eps
class        __snake_case(					lowercase_      ):



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

				"""simple docstring"""






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



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

				"""simple docstring"""






				super().__init__(**UpperCAmelCase__	)

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



	def __init__(	self   :   str ,		UpperCAmelCase__   :   Tuple=None ,		UpperCAmelCase__   :   Any=None ,		UpperCAmelCase__   :   Tuple=None ,		UpperCAmelCase__   :   int=0.02 ,		**UpperCAmelCase__   :   int ,		):

				"""simple docstring"""






				super().__init__(**UpperCAmelCase__	)
				lowercase__						:	List[str]         = vision_config if vision_config is not None else {}
				lowercase__						:	str         = prompt_encoder_config if prompt_encoder_config is not None else {}
				lowercase__						:	List[str]         = mask_decoder_config if mask_decoder_config is not None else {}

				if isinstance(UpperCAmelCase__ ,		UpperCAmelCase__	):
							lowercase__						:	Optional[Any]         = vision_config.to_dict()
				if isinstance(UpperCAmelCase__ ,		UpperCAmelCase__	):
							lowercase__						:	str         = prompt_encoder_config.to_dict()
				if isinstance(UpperCAmelCase__ ,		UpperCAmelCase__	):
							lowercase__						:	Optional[Any]         = mask_decoder_config.to_dict()

				lowercase__						:	Optional[Any]         = SamVisionConfig(**UpperCAmelCase__	)
				lowercase__						:	Optional[int]         = SamPromptEncoderConfig(**UpperCAmelCase__	)
				lowercase__						:	Any         = SamMaskDecoderConfig(**UpperCAmelCase__	)
				lowercase__						:	List[Any]         = initializer_range







	def 						UpperCAmelCase    (	self   :   List[Any]	):

				"""simple docstring"""






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










from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


a    =       logging.get_logger(__name__)

a    =       {
    'nghuyong/ernie-1.0-base-zh': 'https://huggingface.co/nghuyong/ernie-1.0-base-zh/resolve/main/config.json',
    'nghuyong/ernie-2.0-base-en': 'https://huggingface.co/nghuyong/ernie-2.0-base-en/resolve/main/config.json',
    'nghuyong/ernie-2.0-large-en': 'https://huggingface.co/nghuyong/ernie-2.0-large-en/resolve/main/config.json',
    'nghuyong/ernie-3.0-base-zh': 'https://huggingface.co/nghuyong/ernie-3.0-base-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-medium-zh': 'https://huggingface.co/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-mini-zh': 'https://huggingface.co/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-micro-zh': 'https://huggingface.co/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-nano-zh': 'https://huggingface.co/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json',
    'nghuyong/ernie-gram-zh': 'https://huggingface.co/nghuyong/ernie-gram-zh/resolve/main/config.json',
    'nghuyong/ernie-health-zh': 'https://huggingface.co/nghuyong/ernie-health-zh/resolve/main/config.json',
}
class        __snake_case(					__UpperCamelCase      ):
 lowercase :       Dict		      =		'''ernie'''



 def __init__(	self   :   Tuple ,		UpperCAmelCase__   :   int=30_522 ,		UpperCAmelCase__   :   List[str]=768 ,		UpperCAmelCase__   :   Tuple=12 ,		UpperCAmelCase__   :   Optional[int]=12 ,		UpperCAmelCase__   :   Any=3_072 ,		UpperCAmelCase__   :   Tuple="gelu" ,		UpperCAmelCase__   :   Union[str, Any]=0.1 ,		UpperCAmelCase__   :   str=0.1 ,		UpperCAmelCase__   :   List[str]=512 ,		UpperCAmelCase__   :   str=2 ,		UpperCAmelCase__   :   Optional[int]=3 ,		UpperCAmelCase__   :   Dict=False ,		UpperCAmelCase__   :   Any=0.02 ,		UpperCAmelCase__   :   Any=1e-12 ,		UpperCAmelCase__   :   str=0 ,		UpperCAmelCase__   :   Any="absolute" ,		UpperCAmelCase__   :   List[str]=True ,		UpperCAmelCase__   :   Tuple=None ,		**UpperCAmelCase__   :   Dict ,		):

    """simple docstring"""






    super().__init__(pad_token_id=UpperCAmelCase__ ,		**UpperCAmelCase__	)

    lowercase__						:	List[str]         = vocab_size
    lowercase__						:	Optional[int]         = hidden_size
    lowercase__						:	Union[str, Any]         = num_hidden_layers
    lowercase__						:	Any         = num_attention_heads
    lowercase__						:	Optional[int]         = hidden_act
    lowercase__						:	str         = intermediate_size
    lowercase__						:	Tuple         = hidden_dropout_prob
    lowercase__						:	Tuple         = attention_probs_dropout_prob
    lowercase__						:	str         = max_position_embeddings
    lowercase__						:	List[Any]         = type_vocab_size
    lowercase__						:	Any         = task_type_vocab_size
    lowercase__						:	Optional[Any]         = use_task_id
    lowercase__						:	Optional[Any]         = initializer_range
    lowercase__						:	Union[str, Any]         = layer_norm_eps
    lowercase__						:	Dict         = position_embedding_type
    lowercase__						:	Union[str, Any]         = use_cache
    lowercase__						:	int         = classifier_dropout
class        __snake_case(					__UpperCamelCase      ):



 @property
 def 						UpperCAmelCase    (	self   :   List[Any]	):

    """simple docstring"""






    if self.task == "multiple-choice":
       lowercase__						:	Dict         = {0: """batch""", 1: """choice""", 2: """sequence"""}
    else:
       lowercase__						:	Dict         = {0: """batch""", 1: """sequence"""}
    return OrderedDict(
        [
            ("""input_ids""", dynamic_axis),
            ("""attention_mask""", dynamic_axis),
            ("""token_type_ids""", dynamic_axis),
            ("""task_type_ids""", dynamic_axis),
        ]	)


