'''simple docstring'''




# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
__SCREAMING_SNAKE_CASE :  Tuple  =						abspath(join(dirname(dirname(dirname(__file__))), """src"""))
sys.path.insert(1, git_repo_path)


# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action="""ignore""", category=FutureWarning)

def 			UpperCamelCase_							(      _UpperCAmelCase						:   Optional[Any]					)					->					Tuple:


       """simple docstring"""







       from transformers.testing_utils import pytest_addoption_shared

       pytest_addoption_shared(_UpperCAmelCase					)


def 			UpperCamelCase_							(      _UpperCAmelCase						:   int					)					->					Tuple:


       """simple docstring"""







       from transformers.testing_utils import pytest_terminal_summary_main

       _UpperCAmelCase  :						Dict							   =					terminalreporter.config.getoption("--make-reports"					)
       if make_reports:
              pytest_terminal_summary_main(_UpperCAmelCase    ,			id=_UpperCAmelCase					)


'''simple docstring'''




import copy

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


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

class 			lowerCamelCase_			(snake_case__					):
      '''simple docstring'''

      __UpperCamelCase:						List[Any]      			=		"speech-encoder-decoder"
      __UpperCamelCase:						Optional[int]      			=		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}""" )

             _UpperCAmelCase  :						Dict							   =					kwargs.pop("encoder" )
             _UpperCAmelCase  :						Any							   =					encoder_config.pop("model_type" )
             _UpperCAmelCase  :						str							   =					kwargs.pop("decoder" )
             _UpperCAmelCase  :						int							   =					decoder_config.pop("model_type" )

             _UpperCAmelCase  :						List[Any]							   =					AutoConfig.for_model(A		,      **A )
             _UpperCAmelCase  :						str							   =					AutoConfig.for_model(A		,      **A )
             _UpperCAmelCase  :						Optional[int]							   =					True




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

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





      def   _A			( self		:       Tuple ):
             _UpperCAmelCase  :						List[str]							   =					copy.deepcopy(self.__dict__ )
             _UpperCAmelCase  :						Any							   =					self.encoder.to_dict()
             _UpperCAmelCase  :						Union[str, Any]							   =					self.decoder.to_dict()
             _UpperCAmelCase  :						Union[str, Any]							   =					self.__class__.model_type
             return output

