


import enum
import inspect
import warnings
from functools import wraps
from typing import Callable, Optional

from .logging import get_logger


snake_case_  :     Union[str, Any]							  =							set()
snake_case_  :     Dict							  =							get_logger(__name__)







def   lowerCamelCase(				a__ = None):

    def decorator(a__):
        global _emitted_deprecation_warnings

        if inspect.isclass(a__):
            _SCREAMING_SNAKE_CASE     					=deprecated_class_or_function.__init__
            _SCREAMING_SNAKE_CASE     					=deprecated_class_or_function.__name__
        else:
            _SCREAMING_SNAKE_CASE     					=deprecated_class_or_function
            _SCREAMING_SNAKE_CASE     					=deprecated_function.__name__
            # Support deprecating __init__ class method: class name instead
            _SCREAMING_SNAKE_CASE     					=name if name != '''__init__''' else deprecated_function.__qualname__.split('''.''')[-2]

        _SCREAMING_SNAKE_CASE     					=(
            f"{name} is deprecated and will be removed in the next major version of datasets." + f" {help_message}"
            if help_message
            else ''''''
        )

        @wraps(a__)
        def wrapper(*a__		,**a__):
            _SCREAMING_SNAKE_CASE     					=hash(a__)
            if func_hash not in _emitted_deprecation_warnings:
                warnings.warn(a__		,category=a__		,stacklevel=2)
                _emitted_deprecation_warnings.add(a__)
            return deprecated_function(*a__		,**a__)

        _SCREAMING_SNAKE_CASE     					='''deprecated'''

        if inspect.isclass(a__):
            _SCREAMING_SNAKE_CASE     					=wrapper
            return deprecated_class_or_function
        else:
            return wrapper

    return decorator

class   A__							(						enum.EnumMeta					):




      def __getattribute__(    cls   : List[str]			,      _a   : Dict					)							->       str:


          """simple docstring"""





          _SCREAMING_SNAKE_CASE     					=super().__getattribute__(_a					)
          if isinstance(_a			,      enum.Enum					) and obj._on_access:
              obj._on_access()
          return obj




      def __getitem__(    cls   : Dict			,      _a   : Dict					)							->       Any:


          """simple docstring"""





          _SCREAMING_SNAKE_CASE     					=super().__getitem__(_a					)
          if member._on_access:
              member._on_access()
          return member




      def __call__(    cls   : Optional[Any]			,      _a   : List[Any]			,      _a   : List[str]=None			,      *, _a   : List[str]=None			,      _a   : Tuple=None			,      _a   : Dict=None			,      _a   : str=1					)							->       Any:


          """simple docstring"""





          _SCREAMING_SNAKE_CASE     					=super().__call__(_a			,      _a			,      module=_a			,      qualname=_a			,      type=_a			,      start=_a					)
          if isinstance(_a			,      enum.Enum					) and obj._on_access:
              obj._on_access()
          return obj

class   A__							(						enum.Enum				,       metaclass=UpperCamelCase__					):




      def __new__(    cls   : Union[str, Any]			,      _a   : str					)							->       List[Any]:


          """simple docstring"""





          _SCREAMING_SNAKE_CASE     					=object.__new__(cls					)
          _SCREAMING_SNAKE_CASE     					=value
          _SCREAMING_SNAKE_CASE     					=member.deprecate
          return member




      @property
      def 							__UpperCamelCase			(    self   : List[Any]					)							->       int:


          """simple docstring"""





          return ""




      def 							__UpperCamelCase			(    self   : Union[str, Any]					)							->       str:


          """simple docstring"""





          _SCREAMING_SNAKE_CASE     					=f" {self.help_message}" if self.help_message else ''''''
          warnings.warn(
              f"'{self.__objclass__.__name__}' is deprecated and will be removed in the next major version of datasets."
              + help_message			,      _a			,      stacklevel=3			,      )



from collections import OrderedDict
from typing import Mapping

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


snake_case_  :     Tuple							  =							logging.get_logger(__name__)

snake_case_  :     int							  =							{
    '''uclanlp/plbart-base''': '''https://huggingface.co/uclanlp/plbart-base/resolve/main/config.json''',
    # See all PLBART models at https://huggingface.co/models?filter=plbart
}

class   A__							(						UpperCamelCase__					):
						UpperCAmelCase     =  "plbart"
						UpperCAmelCase     =  ["past_key_values"]
						UpperCAmelCase     =  {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}




						def __init__(    self   : Union[str, Any]			,      _a   : List[str]=5_0005			,      _a   : List[str]=1024			,      _a   : int=6			,      _a   : Union[str, Any]=3072			,      _a   : List[str]=12			,      _a   : int=6			,      _a   : Optional[int]=3072			,      _a   : Any=12			,      _a   : Any=0.0			,      _a   : Optional[Any]=0.0			,      _a   : List[Any]=True			,      _a   : Any=True			,      _a   : Any="gelu"			,      _a   : int=768			,      _a   : int=0.1			,      _a   : int=0.1			,      _a   : List[str]=0.0			,      _a   : Optional[int]=0.02			,      _a   : Dict=0.0			,      _a   : List[str]=True			,      _a   : List[Any]=1			,      _a   : Tuple=0			,      _a   : Tuple=2			,      _a   : Optional[int]=2			,      **_a   : Optional[int]			,      )							->       Optional[int]:


										"""simple docstring"""





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

class   A__							(						UpperCamelCase__					):




						@property
						def 							__UpperCamelCase			(    self   : int					)							->       Mapping[str, Mapping[int, str]]:


										"""simple docstring"""





										return OrderedDict(
										    [
										        ('''input_ids''', {0: '''batch''', 1: '''sequence'''}),
										        ('''attention_mask''', {0: '''batch''', 1: '''sequence'''}),
										    ]					)




						@property
						def 							__UpperCamelCase			(    self   : List[str]					)							->       Mapping[str, Mapping[int, str]]:


										"""simple docstring"""





										if self.use_past:
														return OrderedDict(
														    [
														        ('''last_hidden_state''', {0: '''batch''', 1: '''sequence'''}),
														        ('''past_keys''', {0: '''batch''', 2: '''sequence'''}),
														        ('''encoder_last_hidden_state''', {0: '''batch''', 1: '''sequence'''}),
														    ]					)
										else:
														return OrderedDict(
														    [
														        ('''last_hidden_state''', {0: '''batch''', 1: '''sequence'''}),
														        ('''encoder_last_hidden_state''', {0: '''batch''', 1: '''sequence'''}),
														    ]					)