


"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__snake_case												=							{"configuration_yoso": ["YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP", "YosoConfig"]}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __snake_case												=							[
       "YOSO_PRETRAINED_MODEL_ARCHIVE_LIST",
       "YosoForMaskedLM",
       "YosoForMultipleChoice",
       "YosoForQuestionAnswering",
       "YosoForSequenceClassification",
       "YosoForTokenClassification",
       "YosoLayer",
       "YosoModel",
       "YosoPreTrainedModel",
   ]


if TYPE_CHECKING:
   from .configuration_yoso import YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP, YosoConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_yoso import (
          YOSO_PRETRAINED_MODEL_ARCHIVE_LIST,
          YosoForMaskedLM,
          YosoForMultipleChoice,
          YosoForQuestionAnswering,
          YosoForSequenceClassification,
          YosoForTokenClassification,
          YosoLayer,
          YosoModel,
          YosoPreTrainedModel,
      )


else:
   import sys

   __snake_case												=							_LazyModule(__name__, globals()['''__file__'''], _import_structure)
"""simple docstring"""


import copy

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


lowerCAmelCase_:       List[str]			     =       logging.get_logger(__name__)






class  a__     ( _a						):
   snake_case_				=   "speech-encoder-decoder"
   snake_case_				=   True


   def __init__(  self,					**_UpperCAmelCase	):
        '''simple docstring'''



        super().__init__(**_UpperCAmelCase	)
        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}'''	)

        lowercase__								=				kwargs.pop("encoder"	)
        lowercase__								=				encoder_config.pop("model_type"	)
        lowercase__								=				kwargs.pop("decoder"	)
        lowercase__								=				decoder_config.pop("model_type"	)

        lowercase__								=				AutoConfig.for_model(_UpperCAmelCase,					**_UpperCAmelCase	)
        lowercase__								=				AutoConfig.for_model(_UpperCAmelCase,					**_UpperCAmelCase	)
        lowercase__								=				True


   @classmethod
   def 						snake_case__						(  cls,					_UpperCAmelCase,					_UpperCAmelCase,					**_UpperCAmelCase	):
        '''simple docstring'''



        logger.info("Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config"	)
        lowercase__								=				True
        lowercase__								=				True

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


   def 						snake_case__						(  self	):
        '''simple docstring'''



        lowercase__								=				copy.deepcopy(self.__dict__	)
        lowercase__								=				self.encoder.to_dict()
        lowercase__								=				self.decoder.to_dict()
        lowercase__								=				self.__class__.model_type
        return output




