






"""simple docstring"""


from typing import Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_openai import OpenAIGPTTokenizer


_UpperCamelCase				:    Tuple     =						logging.get_logger(__name__)

_UpperCamelCase				:    int     =						{'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

_UpperCamelCase				:    Dict     =						{
    'vocab_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/vocab.json'},
    'merges_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/merges.txt'},
    'tokenizer_file': {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/tokenizer.json'},
}

_UpperCamelCase				:    str     =						{
    'openai-gpt': 512,
}






class 						snake_case  (  UpperCAmelCase       ):
    __magic_name__         =     VOCAB_FILES_NAMES
    __magic_name__         =     PRETRAINED_VOCAB_FILES_MAP
    __magic_name__         =     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    __magic_name__         =     ['''input_ids''', '''attention_mask''']
    __magic_name__         =     OpenAIGPTTokenizer





    def __init__(							self	:					str				,		A	:					Optional[Any]=None				,		A	:					Dict=None				,		A	:					Dict=None				,		A	:					Union[str, Any]="<unk>"				,		**A	:					Dict			):


      '''simple docstring'''




      super().__init__(A				,		A				,		tokenizer_file=A				,		unk_token=A				,		**A			)





    @property
    def 				lowerCamelCase__      (							self	:					List[Any]			):


      '''simple docstring'''




      return True





    def 				lowerCamelCase__      (							self	:					Union[str, Any]				,		A	:					str				,		A	:					Optional[str] = None			):


      '''simple docstring'''




      a     :			Dict				=   self._tokenizer.model.save(A				,		name=A			)
      return tuple(A			)












"""simple docstring"""


import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig


_UpperCamelCase				:    Optional[int]     =						logging.get_logger(__name__)






class 						snake_case  (  UpperCAmelCase       ):
    __magic_name__         =     '''speech-encoder-decoder'''
    __magic_name__         =     True





    def __init__(							self	:					Optional[Any]				,		**A	:					List[Any]			):


      '''simple docstring'''




      super().__init__(**A			)
      if "encoder" not in kwargs or "decoder" not in kwargs:
        raise ValueError(
            F'''A configuraton of type {self.model_type} cannot be instantiated because not both `encoder` and'''
            F''' `decoder` sub-configurations are passed, but only {kwargs}'''			)

      a     :			Optional[int]				=   kwargs.pop('encoder'			)
      a     :			Any				=   encoder_config.pop('model_type'			)
      a     :			Optional[Any]				=   kwargs.pop('decoder'			)
      a     :			str				=   decoder_config.pop('model_type'			)

      a     :			Tuple				=   AutoConfig.for_model(A				,		**A			)
      a     :			Dict				=   AutoConfig.for_model(A				,		**A			)
      a     :			Optional[Any]				=   True





    @classmethod
    def 				lowerCamelCase__      (							cls	:					List[Any]				,		A	:					PretrainedConfig				,		A	:					PretrainedConfig				,		**A	:					str			):


      '''simple docstring'''




      logger.info('Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config'			)
      a     :			Any				=   True
      a     :			List[str]				=   True

      return cls(encoder=encoder_config.to_dict()				,		decoder=decoder_config.to_dict()				,		**A			)





    def 				lowerCamelCase__      (							self	:					Optional[int]			):


      '''simple docstring'''




      a     :			List[Any]				=   copy.deepcopy(self.__dict__			)
      a     :			int				=   self.encoder.to_dict()
      a     :			Optional[int]				=   self.decoder.to_dict()
      a     :			Any				=   self.__class__.model_type
      return output




