

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


lowercase_       		=  logging.get_logger(__name__)

lowercase_       		=  {
    "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  A						(							_UpperCAmelCase ):







    """simple docstring"""





    lowerCamelCase			=							'realm'


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





        '''simple docstring'''







        super().__init__(pad_token_id=lowercase_,bos_token_id=lowercase_,eos_token_id=lowercase_,**lowercase_		)

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

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

        # Retrieval config
        A__          =   num_block_records
        A__          =   searcher_beam_size




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
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowercase_       		=  logging.get_logger(__name__)

lowercase_       		=  {
    "microsoft/resnet-50": "https://huggingface.co/microsoft/resnet-50/blob/main/config.json",
}


class  A						(							_UpperCAmelCase    ,							_UpperCAmelCase ):







    """simple docstring"""





    lowerCamelCase			=							'resnet'
    lowerCamelCase			=							['basic', 'bottleneck']


    def __init__(      self :       Optional[Any],lowercase_ :       int=3,lowercase_ :       List[str]=6_4,lowercase_ :       int=[2_5_6, 5_1_2, 1_0_2_4, 2_0_4_8],lowercase_ :       Tuple=[3, 4, 6, 3],lowercase_ :       Union[str, Any]="bottleneck",lowercase_ :       List[str]="relu",lowercase_ :       Tuple=False,lowercase_ :       List[str]=None,lowercase_ :       List[Any]=None,**lowercase_ :       str,)->    Optional[Any]:





        '''simple docstring'''







        super().__init__(**lowercase_		)
        if layer_type not in self.layer_types:
            raise ValueError(F'layer_type={layer_type} is not one of {",".join(self.layer_types		)}'		)
        A__          =   num_channels
        A__          =   embedding_size
        A__          =   hidden_sizes
        A__          =   depths
        A__          =   layer_type
        A__          =   hidden_act
        A__          =   downsample_in_first_stage
        A__          =   ['stem'] + [F'stage{idx}' for idx in range(1,len(lowercase_		) + 1		)]
        A__      ,						A__          =   get_aligned_output_features_output_indices(
            out_features=lowercase_,out_indices=lowercase_,stage_names=self.stage_names		)




class  A						(							_UpperCAmelCase ):







    """simple docstring"""





    lowerCamelCase			=							version.parse('1.11' )


    @property
    def 						snake_case__     (      self :       List[Any]		)->    Mapping[str, Mapping[int, str]]:





        '''simple docstring'''







        return OrderedDict(
            [
                ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
            ]		)


    @property
    def 						snake_case__     (      self :       Any		)->    float:





        '''simple docstring'''







        return 1E-3

