from collections import OrderedDict
from typing import Mapping

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


UpperCAmelCase_						=logging.get_logger(__name__)

UpperCAmelCase_						={
    """google/bigbird-roberta-base""": """https://huggingface.co/google/bigbird-roberta-base/resolve/main/config.json""",
    """google/bigbird-roberta-large""": """https://huggingface.co/google/bigbird-roberta-large/resolve/main/config.json""",
    """google/bigbird-base-trivia-itc""": """https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/config.json""",
    # See all BigBird models at https://huggingface.co/models?filter=big_bird
}


class 							__UpperCamelCase			( __UpperCAmelCase  ):





				'''simple docstring'''



				__a							: Dict										="""big_bird"""



				def __init__( self       , UpperCAmelCase_=5_03_58       , UpperCAmelCase_=7_68       , UpperCAmelCase_=12       , UpperCAmelCase_=12       , UpperCAmelCase_=30_72       , UpperCAmelCase_="gelu_new"       , UpperCAmelCase_=0.1       , UpperCAmelCase_=0.1       , UpperCAmelCase_=40_96       , UpperCAmelCase_=2       , UpperCAmelCase_=0.02       , UpperCAmelCase_=1E-1_2       , UpperCAmelCase_=True       , UpperCAmelCase_=0       , UpperCAmelCase_=1       , UpperCAmelCase_=2       , UpperCAmelCase_=66       , UpperCAmelCase_="block_sparse"       , UpperCAmelCase_=True       , UpperCAmelCase_=False       , UpperCAmelCase_=64       , UpperCAmelCase_=3       , UpperCAmelCase_=None       , **UpperCAmelCase_       , ):
											super().__init__(
											    pad_token_id=_SCREAMING_SNAKE_CASE       , bos_token_id=_SCREAMING_SNAKE_CASE       , eos_token_id=_SCREAMING_SNAKE_CASE       , sep_token_id=_SCREAMING_SNAKE_CASE       , **_SCREAMING_SNAKE_CASE       , )

											lowerCAmelCase   =		vocab_size
											lowerCAmelCase   =		max_position_embeddings
											lowerCAmelCase   =		hidden_size
											lowerCAmelCase   =		num_hidden_layers
											lowerCAmelCase   =		num_attention_heads
											lowerCAmelCase   =		intermediate_size
											lowerCAmelCase   =		hidden_act
											lowerCAmelCase   =		hidden_dropout_prob
											lowerCAmelCase   =		attention_probs_dropout_prob
											lowerCAmelCase   =		initializer_range
											lowerCAmelCase   =		type_vocab_size
											lowerCAmelCase   =		layer_norm_eps
											lowerCAmelCase   =		use_cache

											lowerCAmelCase   =		rescale_embeddings
											lowerCAmelCase   =		attention_type
											lowerCAmelCase   =		use_bias
											lowerCAmelCase   =		block_size
											lowerCAmelCase   =		num_random_blocks
											lowerCAmelCase   =		classifier_dropout




class 							__UpperCamelCase			( __UpperCAmelCase  ):





				'''simple docstring'''



				@property
				def       __snake_case		( self						):






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









from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


UpperCAmelCase_						=logging.get_logger(__name__)


class 							__UpperCamelCase			( __UpperCAmelCase     ,					__UpperCAmelCase  ):





				'''simple docstring'''



				__a							: Optional[Any]										="""maskformer-swin"""

				__a							: Optional[int]										={
				    """num_attention_heads""": """num_heads""",
				    """num_hidden_layers""": """num_layers""",
				}



				def __init__( self       , UpperCAmelCase_=2_24       , UpperCAmelCase_=4       , UpperCAmelCase_=3       , UpperCAmelCase_=96       , UpperCAmelCase_=[2, 2, 6, 2]       , UpperCAmelCase_=[3, 6, 12, 24]       , UpperCAmelCase_=7       , UpperCAmelCase_=4.0       , UpperCAmelCase_=True       , UpperCAmelCase_=0.0       , UpperCAmelCase_=0.0       , UpperCAmelCase_=0.1       , UpperCAmelCase_="gelu"       , UpperCAmelCase_=False       , UpperCAmelCase_=0.02       , UpperCAmelCase_=1E-5       , UpperCAmelCase_=None       , UpperCAmelCase_=None       , **UpperCAmelCase_       , ):
											super().__init__(**UpperCAmelCase_						)

											lowerCAmelCase   =		image_size
											lowerCAmelCase   =		patch_size
											lowerCAmelCase   =		num_channels
											lowerCAmelCase   =		embed_dim
											lowerCAmelCase   =		depths
											lowerCAmelCase   =		len(UpperCAmelCase_						)
											lowerCAmelCase   =		num_heads
											lowerCAmelCase   =		window_size
											lowerCAmelCase   =		mlp_ratio
											lowerCAmelCase   =		qkv_bias
											lowerCAmelCase   =		hidden_dropout_prob
											lowerCAmelCase   =		attention_probs_dropout_prob
											lowerCAmelCase   =		drop_path_rate
											lowerCAmelCase   =		hidden_act
											lowerCAmelCase   =		use_absolute_embeddings
											lowerCAmelCase   =		layer_norm_eps
											lowerCAmelCase   =		initializer_range
											# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
											# this indicates the channel dimension after the last stage of the model
											lowerCAmelCase   =		int(embed_dim * 2 ** (len(UpperCAmelCase_						) - 1)						)
											lowerCAmelCase   =		['''stem'''] + [F"""stage{idx}""" for idx in range(1       , len(UpperCAmelCase_						) + 1						)]
											lowerCAmelCase   ,     lowerCAmelCase   =		get_aligned_output_features_output_indices(
											    out_features=UpperCAmelCase_       , out_indices=UpperCAmelCase_       , stage_names=self.stage_names						)



