
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union

import pyarrow as pa


if TYPE_CHECKING:
    from .features import FeatureType




@dataclass
class        UpperCAmelCase_			:


  '''simple docstring'''







  a__           =		42
  a__           =		None
  # Automatically constructed
  a__           =		"dict"
  a__           =		None
  a__           =		field(default="""Translation"""  ,       init=_A  ,       repr=_A     )
  def __call__( self			: Tuple    )			->	Optional[int]:







    """simple docstring"""






    return pa.struct({lang: pa.string() for lang in sorted(self.languages    )}    )





  def 							_lowercase							( self			: Union[str, Any]    )			->	Union["FeatureType", Dict[str, "FeatureType"]]:







    """simple docstring"""






    from .features import Value

    return {k: Value("""string"""    ) for k in sorted(self.languages    )}







@dataclass
class        UpperCAmelCase_			:


  '''simple docstring'''







  a__           =		None
  a__           =		None
  a__           =		None
  # Automatically constructed
  a__           =		"dict"
  a__           =		None
  a__           =		field(default="""TranslationVariableLanguages"""  ,       init=_A  ,       repr=_A     )
  def 							_lowercase							( self			: Optional[Any]    )			->	Tuple:







    """simple docstring"""






    __magic_name__				     =       sorted(set(self.languages    )    ) if self.languages else None
    __magic_name__				     =       len(self.languages    ) if self.languages else None
  def __call__( self			: Any    )			->	Optional[Any]:







    """simple docstring"""






    return pa.struct({"""language""": pa.list_(pa.string()    ), """translation""": pa.list_(pa.string()    )}    )
  def 							_lowercase							( self			: str			,							UpperCamelCase__			: List[Any]    )			->	Optional[Any]:







    """simple docstring"""






    __magic_name__				     =       set(self.languages    )
    if self.languages and set(UpperCamelCase__    ) - lang_set:
      raise ValueError(
          F'''Some languages in example ({', '.join(sorted(set(UpperCamelCase__    ) - lang_set    )    )}) are not in valid set ({', '.join(UpperCamelCase__    )}).'''    )

    # Convert dictionary into tuples, splitting out cases where there are
    # multiple translations for a single language.
    __magic_name__				     =       []
    for lang, text in translation_dict.items():
      if isinstance(UpperCamelCase__			,							UpperCamelCase__    ):
        translation_tuples.append((lang, text)    )
      else:
        translation_tuples.extend([(lang, el) for el in text]    )

        # Ensure translations are in ascending order by language code.
    __magic_name__     ,    __magic_name__				     =       zip(*sorted(UpperCamelCase__    )    )

    return {"language": languages, "translation": translations}





  def 							_lowercase							( self			: Union[str, Any]    )			->	Union["FeatureType", Dict[str, "FeatureType"]]:







    """simple docstring"""






    from .features import Sequence, Value

    return {
        "language": Sequence(Value("""string"""    )    ),
        "translation": Sequence(Value("""string"""    )    ),
    }



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


__lowerCAmelCase			:     Union[str, 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_			( _A     ):


  '''simple docstring'''







  a__           =		"""pegasus"""
  a__           =		["""past_key_values"""]
  a__           =		{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}
  def __init__( self			: Optional[int]			,							UpperCamelCase__			: Optional[int]=5_0265			,							UpperCamelCase__			: Optional[int]=1024			,							UpperCamelCase__			: Any=12			,							UpperCamelCase__			: Union[str, Any]=4096			,							UpperCamelCase__			: Any=16			,							UpperCamelCase__			: Union[str, Any]=12			,							UpperCamelCase__			: List[str]=4096			,							UpperCamelCase__			: Tuple=16			,							UpperCamelCase__			: Optional[int]=0.0			,							UpperCamelCase__			: List[Any]=0.0			,							UpperCamelCase__			: List[str]=True			,							UpperCamelCase__			: List[Any]=True			,							UpperCamelCase__			: List[Any]="gelu"			,							UpperCamelCase__			: List[Any]=1024			,							UpperCamelCase__			: Optional[Any]=0.1			,							UpperCamelCase__			: str=0.0			,							UpperCamelCase__			: Any=0.0			,							UpperCamelCase__			: Union[str, Any]=0.02			,							UpperCamelCase__			: Any=0			,							UpperCamelCase__			: int=False			,							UpperCamelCase__			: Any=0			,							UpperCamelCase__			: List[str]=1			,							UpperCamelCase__			: Tuple=1			,							**UpperCamelCase__			: Union[str, Any]			,							)			->	str:







    """simple docstring"""






    __magic_name__				     =       vocab_size
    __magic_name__				     =       max_position_embeddings
    __magic_name__				     =       d_model
    __magic_name__				     =       encoder_ffn_dim
    __magic_name__				     =       encoder_layers
    __magic_name__				     =       encoder_attention_heads
    __magic_name__				     =       decoder_ffn_dim
    __magic_name__				     =       decoder_layers
    __magic_name__				     =       decoder_attention_heads
    __magic_name__				     =       dropout
    __magic_name__				     =       attention_dropout
    __magic_name__				     =       activation_dropout
    __magic_name__				     =       activation_function
    __magic_name__				     =       init_std
    __magic_name__				     =       encoder_layerdrop
    __magic_name__				     =       decoder_layerdrop
    __magic_name__				     =       use_cache
    __magic_name__				     =       encoder_layers
    __magic_name__				     =       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 							_lowercase							( self			: List[Any]    )			->	int:







    """simple docstring"""






    return self.encoder_attention_heads





  @property
  def 							_lowercase							( self			: Dict    )			->	int:







    """simple docstring"""






    return self.d_model

