
'''simple docstring'''





import copy

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


SCREAMING_SNAKE_CASE							:Tuple											=       logging.get_logger(__name__)





class 							UpperCAmelCase   (						__SCREAMING_SNAKE_CASE						):




	'''simple docstring'''





	snake_case_      					=  "speech-encoder-decoder"
	snake_case_      					=  True






	def __init__( self      :				Optional[int]							,**A      :				Tuple				):
					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         =				kwargs.pop("encoder"				)
					__A         =				encoder_config.pop("model_type"				)
					__A         =				kwargs.pop("decoder"				)
					__A         =				decoder_config.pop("model_type"				)

					__A         =				AutoConfig.for_model(A							,**A				)
					__A         =				AutoConfig.for_model(A							,**A				)
					__A         =				True






	@classmethod
	def        UpperCamelCase_						( cls      :				Union[str, Any]							,A      :				PretrainedConfig							,A      :				PretrainedConfig							,**A      :				Optional[Any]				):
					logger.info("Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config"				)
					__A         =				True
					__A         =				True

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







	def        UpperCamelCase_						( self      :				Tuple				):
					__A         =				copy.deepcopy(self.__dict__				)
					__A         =				self.encoder.to_dict()
					__A         =				self.decoder.to_dict()
					__A         =				self.__class__.model_type
					return output


import torch

from transformers import PreTrainedModel

from .custom_configuration import CustomConfig, NoSuperInitConfig





class 							UpperCAmelCase   (						__SCREAMING_SNAKE_CASE						):




	'''simple docstring'''





	snake_case_      					=  CustomConfig






	def __init__( self      :				Optional[int]							,A      :				List[str]				):
					super().__init__(A				)
					__A         =				torch.nn.Linear(config.hidden_size							,config.hidden_size				)






	def        UpperCamelCase_						( self      :				Union[str, Any]							,A      :				Optional[int]				):
					return self.linear(A				)







	def        UpperCamelCase_						( self      :				Optional[int]							,A      :				int				):
					pass





class 							UpperCAmelCase   (						__SCREAMING_SNAKE_CASE						):




	'''simple docstring'''





	snake_case_      					=  NoSuperInitConfig






	def __init__( self      :				Optional[int]							,A      :				Union[str, Any]				):
					super().__init__(A				)
					__A         =				torch.nn.Linear(config.attribute							,config.attribute				)






	def        UpperCamelCase_						( self      :				str							,A      :				Any				):
					return self.linear(A				)







	def        UpperCamelCase_						( self      :				Tuple							,A      :				int				):
					pass
