





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


__UpperCAmelCase	:       Any    	=							logging.get_logger(__name__)

__UpperCAmelCase	:       Union[str, Any]    	=							{
    "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    __snake_case	(							__lowerCamelCase      ):





       '''simple docstring'''







       lowerCAmelCase__						=					"""realm"""




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

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

         # Reader config
         __snake_case:						int			  =						span_hidden_size
         __snake_case:						int			  =						max_span_width
         __snake_case:						Union[str, Any]			  =						reader_layer_norm_eps
         __snake_case:						Optional[Any]			  =						reader_beam_size
         __snake_case:						str			  =						reader_seq_len

         # Retrieval config
         __snake_case:						str			  =						num_block_records
         __snake_case:						Dict			  =						searcher_beam_size













from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
      if not (is_transformers_available() and is_torch_available()):
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      from ...utils.dummy_torch_and_transformers_objects import (
          ImageTextPipelineOutput,
          UniDiffuserPipeline,
      )
else:
      from .modeling_text_decoder import UniDiffuserTextDecoder
      from .modeling_uvit import UniDiffuserModel, UTransformeraDModel
      from .pipeline_unidiffuser import ImageTextPipelineOutput, UniDiffuserPipeline






