





import copy

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


UpperCamelCase__   : List[Any]					  = logging.get_logger(__name__)







class   _UpperCamelCase  (       A_  ):







					'''simple docstring'''

					lowerCamelCase     :     Optional[Any]			    =       'encoder-decoder'
					lowerCamelCase     :     Dict			    =       True





					def __init__(						self    :  Any ,					**__lowercase    :  str		):






						'''simple docstring'''







						super().__init__(**__lowercase		)
						assert (
						    "encoder" in kwargs and "decoder" in kwargs
						), "Config has to be initialized with encoder and decoder config"
						UpperCAmelCase_								=     kwargs.pop("""encoder"""		)
						UpperCAmelCase_								=     encoder_config.pop("""model_type"""		)
						UpperCAmelCase_								=     kwargs.pop("""decoder"""		)
						UpperCAmelCase_								=     decoder_config.pop("""model_type"""		)

						from ..auto.configuration_auto import AutoConfig

						UpperCAmelCase_								=     AutoConfig.for_model(__lowercase ,					**__lowercase		)
						UpperCAmelCase_								=     AutoConfig.for_model(__lowercase ,					**__lowercase		)
						UpperCAmelCase_								=     True





					@classmethod
					def        SCREAMING_SNAKE_CASE							(						cls    :  str ,					__lowercase    :  PretrainedConfig ,					__lowercase    :  PretrainedConfig ,					**__lowercase    :  List[Any]		):






						'''simple docstring'''







						logger.info("""Set `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config"""		)
						UpperCAmelCase_								=     True
						UpperCAmelCase_								=     True

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





					def        SCREAMING_SNAKE_CASE							(						self    :  Optional[Any]		):






						'''simple docstring'''







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









from __future__ import annotations




def    A_(			A   ):
	if not nums:
		raise ValueError("""List is empty"""   )
	return sum(A   ) / len(A   )


if __name__ == "__main__":
				import doctest

				doctest.testmod()


