




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


_lowerCamelCase     :		Optional[Any]								=       logging.get_logger(__name__)

_lowerCamelCase     :		Tuple								=       {
    """google/pegasus-large""": """https://huggingface.co/google/pegasus-large/resolve/main/config.json""",
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}


class     UpperCamelCase_   (			UpperCAmelCase__					):

    '''simple docstring'''






    UpperCAmelCase__							  =				'''pegasus'''
    UpperCAmelCase__							  =				['''past_key_values''']
    UpperCAmelCase__							  =				{'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}


    def __init__(      self				:     Tuple ,			UpperCAmelCase__				:     List[Any]=50_265 ,			UpperCAmelCase__				:     Optional[int]=1_024 ,			UpperCAmelCase__				:     List[Any]=12 ,			UpperCAmelCase__				:     List[str]=4_096 ,			UpperCAmelCase__				:     List[str]=16 ,			UpperCAmelCase__				:     Dict=12 ,			UpperCAmelCase__				:     Any=4_096 ,			UpperCAmelCase__				:     Dict=16 ,			UpperCAmelCase__				:     Optional[int]=0.0 ,			UpperCAmelCase__				:     Optional[int]=0.0 ,			UpperCAmelCase__				:     Union[str, Any]=True ,			UpperCAmelCase__				:     int=True ,			UpperCAmelCase__				:     int="gelu" ,			UpperCAmelCase__				:     Optional[Any]=1_024 ,			UpperCAmelCase__				:     Optional[int]=0.1 ,			UpperCAmelCase__				:     Tuple=0.0 ,			UpperCAmelCase__				:     List[Any]=0.0 ,			UpperCAmelCase__				:     List[Any]=0.02 ,			UpperCAmelCase__				:     int=0 ,			UpperCAmelCase__				:     Dict=False ,			UpperCAmelCase__				:     str=0 ,			UpperCAmelCase__				:     Dict=1 ,			UpperCAmelCase__				:     Optional[int]=1 ,			**UpperCAmelCase__				:     Dict ,			)						->Optional[int]:





           '''simple docstring'''

           A__							=   vocab_size
           A__							=   max_position_embeddings
           A__							=   d_model
           A__							=   encoder_ffn_dim
           A__							=   encoder_layers
           A__							=   encoder_attention_heads
           A__							=   decoder_ffn_dim
           A__							=   decoder_layers
           A__							=   decoder_attention_heads
           A__							=   dropout
           A__							=   attention_dropout
           A__							=   activation_dropout
           A__							=   activation_function
           A__							=   init_std
           A__							=   encoder_layerdrop
           A__							=   decoder_layerdrop
           A__							=   use_cache
           A__							=   encoder_layers
           A__							=   scale_embedding  # scale factor will be sqrt(d_model) if True
           super().__init__(
               pad_token_id=UpperCAmelCase__ ,			eos_token_id=UpperCAmelCase__ ,			is_encoder_decoder=UpperCAmelCase__ ,			decoder_start_token_id=UpperCAmelCase__ ,			forced_eos_token_id=UpperCAmelCase__ ,			**UpperCAmelCase__ ,			)


    @property
    def 	SCREAMING_SNAKE_CASE							(      self				:     Union[str, Any])						->int:





           '''simple docstring'''

           return self.encoder_attention_heads





    @property
    def 	SCREAMING_SNAKE_CASE							(      self				:     str)						->int:





           '''simple docstring'''

           return self.d_model








from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_torch_available,
)


_lowerCamelCase     :		Optional[Any]								=       {
    """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TrOCRConfig"""],
    """processing_trocr""": ["""TrOCRProcessor"""],
}


try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCamelCase     :		Any								=       [
      """TROCR_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TrOCRForCausalLM""",
      """TrOCRPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_trocr import TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP, TrOCRConfig
  from .processing_trocr import TrOCRProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_trocr import TROCR_PRETRAINED_MODEL_ARCHIVE_LIST, TrOCRForCausalLM, TrOCRPreTrainedModel

else:
  import sys

  _lowerCamelCase     :		List[str]								=       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


