






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


snake_case_   :	Tuple							      =logging.get_logger(__name__)

snake_case_   :	int							      ={
    '''google/pegasus-x-base''': '''https://huggingface.co/google/pegasus-x-base/resolve/main/config.json''',
    '''google/pegasus-x-large''': '''https://huggingface.co/google/pegasus-x-large/resolve/main/config.json''',
    # See all PEGASUS-X models at https://huggingface.co/models?filter=pegasus-x
}





class        a__      (	lowerCAmelCase__		):
		UpperCAmelCase_							:       Optional[int] 					= 'pegasus_x'
		UpperCAmelCase_							:       Optional[Any] 					= ['past_key_values']
		UpperCAmelCase_							:       Tuple 					= {'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}






		def __init__(      self							, lowercase__=96103							, lowercase__=16384							, lowercase__=16							, lowercase__=4096							, lowercase__=16							, lowercase__=16							, lowercase__=4096							, lowercase__=16							, lowercase__=0.0							, lowercase__=0.0							, lowercase__=True							, lowercase__=True							, lowercase__="gelu"							, lowercase__=1024							, lowercase__=0.1							, lowercase__=0.0							, lowercase__=0.0							, lowercase__=0.02							, lowercase__=0							, lowercase__=True							, lowercase__=0							, lowercase__=1							, lowercase__=1							, lowercase__=32							, lowercase__=512							, lowercase__=True							, **lowercase__							, )				->				Tuple:
				__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

				__A    =							num_global_tokens
				__A    =							block_size
				__A    =							stagger_local_blocks

				super().__init__(
				    pad_token_id=lowercase__							, eos_token_id=lowercase__							, is_encoder_decoder=lowercase__							, decoder_start_token_id=lowercase__							, forced_eos_token_id=lowercase__							, **lowercase__							, )






		@property
		def 					_lowerCamelCase					(      self						)				->				int:
				return self.encoder_attention_heads






		@property
		def 					_lowerCamelCase					(      self						)				->				int:
				return self.d_model









"""simple docstring"""





from typing import TYPE_CHECKING

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


UpperCamelCase					=     {
    """configuration_led""": ["""LED_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LEDConfig"""],
    """tokenization_led""": ["""LEDTokenizer"""],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCamelCase					=     ["""LEDTokenizerFast"""]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCamelCase					=     [
      """LED_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """LEDForConditionalGeneration""",
      """LEDForQuestionAnswering""",
      """LEDForSequenceClassification""",
      """LEDModel""",
      """LEDPreTrainedModel""",
  ]


try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCamelCase					=     ["""TFLEDForConditionalGeneration""", """TFLEDModel""", """TFLEDPreTrainedModel"""]


if TYPE_CHECKING:
  from .configuration_led import LED_PRETRAINED_CONFIG_ARCHIVE_MAP, LEDConfig
  from .tokenization_led import LEDTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_led_fast import LEDTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_led import (
        LED_PRETRAINED_MODEL_ARCHIVE_LIST,
        LEDForConditionalGeneration,
        LEDForQuestionAnswering,
        LEDForSequenceClassification,
        LEDModel,
        LEDPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_led import TFLEDForConditionalGeneration, TFLEDModel, TFLEDPreTrainedModel

else:
  import sys

  UpperCamelCase					=     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






