





import copy

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


_UpperCAmelCase       : str			     =       logging.get_logger(__name__)

class      lowerCAmelCase							(      __UpperCamelCase    ):
 UpperCAmelCase__									=	"""encoder-decoder"""
 UpperCAmelCase__									=	True
 def __init__(   self						:   int    ,  **UpperCAmelCase						:   Dict			)    ->			Union[str, Any]:
     super().__init__(**UpperCAmelCase			)
     assert (
         "encoder" in kwargs and "decoder" in kwargs
     ), "Config has to be initialized with encoder and decoder config"
     lowerCamelCase__					:   str      				=	kwargs.pop('encoder'			)
     lowerCamelCase__					:   Any      				=	encoder_config.pop('model_type'			)
     lowerCamelCase__					:   Optional[int]      				=	kwargs.pop('decoder'			)
     lowerCamelCase__					:   List[Any]      				=	decoder_config.pop('model_type'			)

     from ..auto.configuration_auto import AutoConfig

     lowerCamelCase__					:   Union[str, Any]      				=	AutoConfig.for_model(UpperCAmelCase    ,  **UpperCAmelCase			)
     lowerCamelCase__					:   List[str]      				=	AutoConfig.for_model(UpperCAmelCase    ,  **UpperCAmelCase			)
     lowerCamelCase__					:   Tuple      				=	True
 @classmethod
 def   A_			(   cls						:   str    ,  UpperCAmelCase						:   PretrainedConfig    ,  UpperCAmelCase						:   PretrainedConfig    ,  **UpperCAmelCase						:   Optional[Any]			)    ->			PretrainedConfig:
     logger.info('Set `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config'			)
     lowerCamelCase__					:   int      				=	True
     lowerCamelCase__					:   Union[str, Any]      				=	True

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







 def   A_			(   self						:   Optional[Any]			)    ->			List[str]:
     lowerCamelCase__					:   Any      				=	copy.deepcopy(self.__dict__			)
     lowerCamelCase__					:   Optional[int]      				=	self.encoder.to_dict()
     lowerCamelCase__					:   Optional[int]      				=	self.decoder.to_dict()
     lowerCamelCase__					:   str      				=	self.__class__.model_type
     return output












from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_UpperCAmelCase       : List[str]			     =       {
    """configuration_autoformer""": [
        """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """AutoformerConfig""",
    ],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase       : List[Any]			     =       [
        """AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """AutoformerForPrediction""",
        """AutoformerModel""",
        """AutoformerPreTrainedModel""",
    ]


if TYPE_CHECKING:
    from .configuration_autoformer import (
        AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
        AutoformerConfig,
    )

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_autoformer import (
            AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            AutoformerForPrediction,
            AutoformerModel,
            AutoformerPreTrainedModel,
        )

else:
    import sys

    _UpperCAmelCase       : Dict			     =       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





