



'''simple docstring'''





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


__a          =		logging.get_logger(__name__)

__a          =		{
    "google/realm-cc-news-pretrained-embedder": (
        "https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/config.json"
    ),
    "google/realm-cc-news-pretrained-encoder": (
        "https://huggingface.co/google/realm-cc-news-pretrained-encoder/resolve/main/config.json"
    ),
    "google/realm-cc-news-pretrained-scorer": (
        "https://huggingface.co/google/realm-cc-news-pretrained-scorer/resolve/main/config.json"
    ),
    "google/realm-cc-news-pretrained-openqa": (
        "https://huggingface.co/google/realm-cc-news-pretrained-openqa/aresolve/main/config.json"
    ),
    "google/realm-orqa-nq-openqa": "https://huggingface.co/google/realm-orqa-nq-openqa/resolve/main/config.json",
    "google/realm-orqa-nq-reader": "https://huggingface.co/google/realm-orqa-nq-reader/resolve/main/config.json",
    "google/realm-orqa-wq-openqa": "https://huggingface.co/google/realm-orqa-wq-openqa/resolve/main/config.json",
    "google/realm-orqa-wq-reader": "https://huggingface.co/google/realm-orqa-wq-reader/resolve/main/config.json",
    # See all REALM models at https://huggingface.co/models?filter=realm
}







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







    lowercase					=		"realm"




    def __init__(    self					:     Optional[int] ,     snake_case_					:     int=30_522 ,     snake_case_					:     Union[str, Any]=768 ,     snake_case_					:     Optional[int]=128 ,     snake_case_					:     int=12 ,     snake_case_					:     int=12 ,     snake_case_					:     int=8 ,     snake_case_					:     int=3_072 ,     snake_case_					:     List[str]="gelu_new" ,     snake_case_					:     List[Any]=0.1 ,     snake_case_					:     int=0.1 ,     snake_case_					:     Tuple=512 ,     snake_case_					:     Dict=2 ,     snake_case_					:     Optional[Any]=0.02 ,     snake_case_					:     Any=1E-1_2 ,     snake_case_					:     int=256 ,     snake_case_					:     Tuple=10 ,     snake_case_					:     Tuple=1E-3 ,     snake_case_					:     Optional[Any]=5 ,     snake_case_					:     Dict=320 ,     snake_case_					:     Optional[Any]=13_353_718 ,     snake_case_					:     int=5_000 ,     snake_case_					:     Tuple=1 ,     snake_case_					:     str=0 ,     snake_case_					:     Dict=2 ,     **snake_case_					:     Optional[int] ,     ):
          super().__init__(pad_token_id=__lowerCamelCase ,     bos_token_id=__lowerCamelCase ,     eos_token_id=__lowerCamelCase ,     **__lowerCamelCase						)

          # Common config
          snake_case__  :    Optional[Any]    						=      vocab_size
          snake_case__  :    List[Any]    						=      max_position_embeddings
          snake_case__  :    Union[str, Any]    						=      hidden_size
          snake_case__  :    Any    						=      retriever_proj_size
          snake_case__  :    Any    						=      num_hidden_layers
          snake_case__  :    Tuple    						=      num_attention_heads
          snake_case__  :    Dict    						=      num_candidates
          snake_case__  :    List[str]    						=      intermediate_size
          snake_case__  :    Union[str, Any]    						=      hidden_act
          snake_case__  :    Any    						=      hidden_dropout_prob
          snake_case__  :    int    						=      attention_probs_dropout_prob
          snake_case__  :    Any    						=      initializer_range
          snake_case__  :    Optional[int]    						=      type_vocab_size
          snake_case__  :    str    						=      layer_norm_eps

          # Reader config
          snake_case__  :    Union[str, Any]    						=      span_hidden_size
          snake_case__  :    List[str]    						=      max_span_width
          snake_case__  :    Tuple    						=      reader_layer_norm_eps
          snake_case__  :    Optional[Any]    						=      reader_beam_size
          snake_case__  :    Dict    						=      reader_seq_len

          # Retrieval config
          snake_case__  :    str    						=      num_block_records
          snake_case__  :    Optional[Any]    						=      searcher_beam_size







"""simple docstring"""



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


a_ =			logging.get_logger(__name__)

a_ =			{
    """shi-labs/nat-mini-in1k-224""": """https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json""",
    # See all Nat models at https://huggingface.co/models?filter=nat
}






class 		__snake_case					(		SCREAMING_SNAKE_CASE__							,							SCREAMING_SNAKE_CASE__     ):





 """simple docstring"""


 _lowerCamelCase        =     """nat"""

 _lowerCamelCase        =     {
     """num_attention_heads""": """num_heads""",
     """num_hidden_layers""": """num_layers""",
 }

 def __init__(    self					,						__lowerCamelCase=4					,						__lowerCamelCase=3					,						__lowerCamelCase=64					,						__lowerCamelCase=[3, 4, 6, 5]					,						__lowerCamelCase=[2, 4, 8, 16]					,						__lowerCamelCase=7					,						__lowerCamelCase=3.0					,						__lowerCamelCase=True					,						__lowerCamelCase=0.0					,						__lowerCamelCase=0.0					,						__lowerCamelCase=0.1					,						__lowerCamelCase="gelu"					,						__lowerCamelCase=0.0_2					,						__lowerCamelCase=1e-5					,						__lowerCamelCase=0.0					,						__lowerCamelCase=None					,						__lowerCamelCase=None					,						**__lowerCamelCase					,						):



     '''simple docstring'''




     super().__init__(**__lowerCamelCase  )

     __A    :						Union[str, Any]						 =     patch_size
     __A    :						Optional[Any]						 =     num_channels
     __A    :						Tuple						 =     embed_dim
     __A    :						Dict						 =     depths
     __A    :						str						 =     len(__lowerCamelCase  )
     __A    :						Optional[Any]						 =     num_heads
     __A    :						str						 =     kernel_size
     __A    :						Any						 =     mlp_ratio
     __A    :						Optional[int]						 =     qkv_bias
     __A    :						str						 =     hidden_dropout_prob
     __A    :						Any						 =     attention_probs_dropout_prob
     __A    :						int						 =     drop_path_rate
     __A    :						int						 =     hidden_act
     __A    :						Any						 =     layer_norm_eps
     __A    :						Tuple						 =     initializer_range
     # we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
     # this indicates the channel dimension after the last stage of the model
     __A    :						int						 =     int(embed_dim * 2 ** (len(__lowerCamelCase  ) - 1)  )
     __A    :						Union[str, Any]						 =     layer_scale_init_value
     __A    :						List[str]						 =     ['''stem'''] + [F"""stage{idx}""" for idx in range(1					,						len(__lowerCamelCase  ) + 1  )]
     __A ,       __A    :						Any						 =     get_aligned_output_features_output_indices(
         out_features=__lowerCamelCase					,						out_indices=__lowerCamelCase					,						stage_names=self.stage_names  )




