




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


snake_case_					:					Any       						=			{'configuration_pegasus': ['PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusConfig']}

try:
    if not is_sentencepiece_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    snake_case_					:					Optional[Any]       						=			['PegasusTokenizer']

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    snake_case_					:					str       						=			['PegasusTokenizerFast']

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    snake_case_					:					Tuple       						=			[
        'PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST',
        'PegasusForCausalLM',
        'PegasusForConditionalGeneration',
        'PegasusModel',
        'PegasusPreTrainedModel',
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    snake_case_					:					Optional[int]       						=			[
        'TFPegasusForConditionalGeneration',
        'TFPegasusModel',
        'TFPegasusPreTrainedModel',
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    snake_case_					:					List[str]       						=			[
        'FlaxPegasusForConditionalGeneration',
        'FlaxPegasusModel',
        'FlaxPegasusPreTrainedModel',
    ]


if TYPE_CHECKING:
    from .configuration_pegasus import PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusConfig

    try:
        if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_pegasus import PegasusTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_pegasus_fast import PegasusTokenizerFast

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_pegasus import (
            PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST,
            PegasusForCausalLM,
            PegasusForConditionalGeneration,
            PegasusModel,
            PegasusPreTrainedModel,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_pegasus import TFPegasusForConditionalGeneration, TFPegasusModel, TFPegasusPreTrainedModel

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_pegasus import (
            FlaxPegasusForConditionalGeneration,
            FlaxPegasusModel,
            FlaxPegasusPreTrainedModel,
        )

else:
    import sys

    snake_case_					:					Any       						=			_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)








from collections import OrderedDict
from typing import Mapping

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


UpperCAmelCase__						:	List[str]	     = logging.get_logger(__name__)

UpperCAmelCase__						:	str	     = {
    'flaubert/flaubert_small_cased': 'https://huggingface.co/flaubert/flaubert_small_cased/resolve/main/config.json',
    'flaubert/flaubert_base_uncased': 'https://huggingface.co/flaubert/flaubert_base_uncased/resolve/main/config.json',
    'flaubert/flaubert_base_cased': 'https://huggingface.co/flaubert/flaubert_base_cased/resolve/main/config.json',
    'flaubert/flaubert_large_cased': 'https://huggingface.co/flaubert/flaubert_large_cased/resolve/main/config.json',
}






class UpperCAmelCase  (		SCREAMING_SNAKE_CASE__  ):





   '''simple docstring'''
   __UpperCamelCase						:       Tuple												=       '''flaubert'''
   __UpperCamelCase						:       str												=       {
       '''hidden_size''': '''emb_dim''',
       '''num_attention_heads''': '''n_heads''',
       '''num_hidden_layers''': '''n_layers''',
       '''n_words''': '''vocab_size''',  # For backward compatibility
   }


   def __init__(   self	:				Union[str, Any]     ,     lowerCAmelCase_	:				Union[str, Any]=False     ,     lowerCAmelCase_	:				List[str]=0.0     ,     lowerCAmelCase_	:				Dict=3_0_1_4_5     ,     lowerCAmelCase_	:				Tuple=2_0_4_8     ,     lowerCAmelCase_	:				List[Any]=1_2     ,     lowerCAmelCase_	:				str=1_6     ,     lowerCAmelCase_	:				Union[str, Any]=0.1     ,     lowerCAmelCase_	:				List[str]=0.1     ,     lowerCAmelCase_	:				str=True     ,     lowerCAmelCase_	:				Optional[int]=False     ,     lowerCAmelCase_	:				Any=False     ,     lowerCAmelCase_	:				int=False     ,     lowerCAmelCase_	:				int=1     ,     lowerCAmelCase_	:				List[str]=True     ,     lowerCAmelCase_	:				Dict=5_1_2     ,     lowerCAmelCase_	:				Any=2_0_4_8**-0.5     ,     lowerCAmelCase_	:				List[str]=1e-12     ,     lowerCAmelCase_	:				Any=0.02     ,     lowerCAmelCase_	:				Optional[Any]=0     ,     lowerCAmelCase_	:				Union[str, Any]=1     ,     lowerCAmelCase_	:				List[Any]=2     ,     lowerCAmelCase_	:				Dict=3     ,     lowerCAmelCase_	:				Optional[Any]=5     ,     lowerCAmelCase_	:				Any=True     ,     lowerCAmelCase_	:				Union[str, Any]="first"     ,     lowerCAmelCase_	:				List[Any]=True     ,     lowerCAmelCase_	:				Tuple=None     ,     lowerCAmelCase_	:				Optional[int]=True     ,     lowerCAmelCase_	:				int=0.1     ,     lowerCAmelCase_	:				Optional[int]=5     ,     lowerCAmelCase_	:				Union[str, Any]=5     ,     lowerCAmelCase_	:				List[Any]=0     ,     lowerCAmelCase_	:				Dict=0     ,     lowerCAmelCase_	:				Union[str, Any]=2     ,     lowerCAmelCase_	:				Optional[int]=0     ,     **lowerCAmelCase_	:				Any     ,     ):

      """simple docstring"""
      _A:    List[str]						     =			pre_norm
      _A:    List[Any]						     =			layerdrop
      _A:    Dict						     =			vocab_size
      _A:    List[Any]						     =			emb_dim
      _A:    Optional[Any]						     =			n_layers
      _A:    Union[str, Any]						     =			n_heads
      _A:    Optional[Any]						     =			dropout
      _A:    Optional[Any]						     =			attention_dropout
      _A:    Dict						     =			gelu_activation
      _A:    Tuple						     =			sinusoidal_embeddings
      _A:    Tuple						     =			causal
      _A:    List[Any]						     =			asm
      _A:    Dict						     =			n_langs
      _A:    Optional[int]						     =			use_lang_emb
      _A:    Any						     =			layer_norm_eps
      _A:    str						     =			bos_index
      _A:    Optional[int]						     =			eos_index
      _A:    int						     =			pad_index
      _A:    Tuple						     =			unk_index
      _A:    int						     =			mask_index
      _A:    int						     =			is_encoder
      _A:    Union[str, Any]						     =			max_position_embeddings
      _A:    List[str]						     =			embed_init_std
      _A:    List[str]						     =			init_std
      _A:    Tuple						     =			summary_type
      _A:    List[str]						     =			summary_use_proj
      _A:    Union[str, Any]						     =			summary_activation
      _A:    Union[str, Any]						     =			summary_proj_to_labels
      _A:    int						     =			summary_first_dropout
      _A:    Optional[Any]						     =			start_n_top
      _A:    Optional[Any]						     =			end_n_top
      _A:    Dict						     =			mask_token_id
      _A:    str						     =			lang_id

      if "n_words" in kwargs:
         _A:    int						     =			kwargs['''n_words''']

      super().__init__(pad_token_id=lowerCAmelCase_     ,     bos_token_id=lowerCAmelCase_     ,     **lowerCAmelCase_	)






class UpperCAmelCase  (		SCREAMING_SNAKE_CASE__  ):





   '''simple docstring'''


   @property
   def 					__magic_name__							(   self	:				Tuple	):

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



