
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 					lowerCamelCase		(  A_  ):
     UpperCAmelCase__    :							str									=		"realm"





     def __init__(self				:   Optional[int]    ,   _A				:   Optional[Any]=3_0_5_2_2    ,   _A				:   Tuple=7_6_8    ,   _A				:   List[str]=1_2_8    ,   _A				:   Optional[Any]=1_2    ,   _A				:   Dict=1_2    ,   _A				:   Tuple=8    ,   _A				:   Dict=3_0_7_2    ,   _A				:   Union[str, Any]="gelu_new"    ,   _A				:   Any=0.1    ,   _A				:   int=0.1    ,   _A				:   Union[str, Any]=5_1_2    ,   _A				:   List[str]=2    ,   _A				:   Any=0.02    ,   _A				:   int=1E-12    ,   _A				:   Tuple=2_5_6    ,   _A				:   Optional[Any]=1_0    ,   _A				:   Any=1E-3    ,   _A				:   int=5    ,   _A				:   int=3_2_0    ,   _A				:   Dict=1_3_3_5_3_7_1_8    ,   _A				:   Any=5_0_0_0    ,   _A				:   Union[str, Any]=1    ,   _A				:   Dict=0    ,   _A				:   int=2    ,   **_A				:   Union[str, Any]    ,   )						->						Optional[Any]:
         super().__init__(pad_token_id=_A    ,   bos_token_id=_A    ,   eos_token_id=_A    ,   **_A       )

         # Common config
         snake_case								= vocab_size
         snake_case								= max_position_embeddings
         snake_case								= hidden_size
         snake_case								= retriever_proj_size
         snake_case								= num_hidden_layers
         snake_case								= num_attention_heads
         snake_case								= num_candidates
         snake_case								= intermediate_size
         snake_case								= hidden_act
         snake_case								= hidden_dropout_prob
         snake_case								= attention_probs_dropout_prob
         snake_case								= initializer_range
         snake_case								= type_vocab_size
         snake_case								= layer_norm_eps

         # Reader config
         snake_case								= span_hidden_size
         snake_case								= max_span_width
         snake_case								= reader_layer_norm_eps
         snake_case								= reader_beam_size
         snake_case								= reader_seq_len

         # Retrieval config
         snake_case								= num_block_records
         snake_case								= searcher_beam_size



import warnings
from collections import OrderedDict
from typing import Mapping

from packaging import version

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


_A   =			logging.get_logger(__name__)

_A   =			{
    "nvidia/segformer-b0-finetuned-ade-512-512": (
        "https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512/resolve/main/config.json"
    ),
    # See all SegFormer models at https://huggingface.co/models?filter=segformer
}







class 					lowerCamelCase		(  A_  ):
     UpperCAmelCase__    :							List[Any]									=		"segformer"





     def __init__(self				:   List[Any]    ,   _A				:   int=3    ,   _A				:   List[Any]=4    ,   _A				:   Any=[2, 2, 2, 2]    ,   _A				:   Dict=[8, 4, 2, 1]    ,   _A				:   List[Any]=[3_2, 6_4, 1_6_0, 2_5_6]    ,   _A				:   Tuple=[7, 3, 3, 3]    ,   _A				:   Optional[int]=[4, 2, 2, 2]    ,   _A				:   Dict=[1, 2, 5, 8]    ,   _A				:   int=[4, 4, 4, 4]    ,   _A				:   Dict="gelu"    ,   _A				:   Tuple=0.0    ,   _A				:   Optional[Any]=0.0    ,   _A				:   List[Any]=0.1    ,   _A				:   Union[str, Any]=0.02    ,   _A				:   Dict=0.1    ,   _A				:   List[Any]=1E-6    ,   _A				:   List[str]=2_5_6    ,   _A				:   Optional[Any]=2_5_5    ,   **_A				:   str    ,   )						->						Tuple:
         super().__init__(**_A       )

         if "reshape_last_stage" in kwargs and kwargs["reshape_last_stage"] is False:
             warnings.warn(
                 "Reshape_last_stage is set to False in this config. This argument is deprecated and will soon be"
                 " removed, as the behaviour will default to that of reshape_last_stage = True."    ,   _A    ,   )

         snake_case								= num_channels
         snake_case								= num_encoder_blocks
         snake_case								= depths
         snake_case								= sr_ratios
         snake_case								= hidden_sizes
         snake_case								= patch_sizes
         snake_case								= strides
         snake_case								= mlp_ratios
         snake_case								= num_attention_heads
         snake_case								= hidden_act
         snake_case								= hidden_dropout_prob
         snake_case								= attention_probs_dropout_prob
         snake_case								= classifier_dropout_prob
         snake_case								= initializer_range
         snake_case								= drop_path_rate
         snake_case								= layer_norm_eps
         snake_case								= decoder_hidden_size
         snake_case								= kwargs.get("reshape_last_stage"    ,   _A       )
         snake_case								= semantic_loss_ignore_index







class 					lowerCamelCase		(  A_  ):
     UpperCAmelCase__    :							Optional[Any]									=		version.parse("1.11"  )





     @property
     def 		UpperCAmelCase(self				:   Tuple       )						->						Mapping[str, Mapping[int, str]]:
         return OrderedDict(
             [
                 ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
             ]       )





     @property
     def 		UpperCAmelCase(self				:   Tuple       )						->						float:
         return 1E-4





     @property
     def 		UpperCAmelCase(self				:   List[str]       )						->						int:
         return 1_2

