





"""simple docstring"""





import copy

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


_lowerCamelCase       =	logging.get_logger(__name__)





class 			snake_case		(   __UpperCAmelCase   ):
      lowerCamelCase__						= '''speech-encoder-decoder'''
      lowerCamelCase__						= True

      def __init__(			self   :str						,							**_lowerCamelCase   :Optional[int]						):
       super().__init__(**_lowerCamelCase						)
       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}'''						)

       __SCREAMING_SNAKE_CASE :			Union[str, Any]												=       kwargs.pop('''encoder'''						)
       __SCREAMING_SNAKE_CASE :			Dict												=       encoder_config.pop('''model_type'''						)
       __SCREAMING_SNAKE_CASE :			Optional[int]												=       kwargs.pop('''decoder'''						)
       __SCREAMING_SNAKE_CASE :			Union[str, Any]												=       decoder_config.pop('''model_type'''						)

       __SCREAMING_SNAKE_CASE :			List[Any]												=       AutoConfig.for_model(_lowerCamelCase						,							**_lowerCamelCase						)
       __SCREAMING_SNAKE_CASE :			Union[str, Any]												=       AutoConfig.for_model(_lowerCamelCase						,							**_lowerCamelCase						)
       __SCREAMING_SNAKE_CASE :			List[str]												=       True

      @classmethod
      def 						SCREAMING_SNAKE_CASE_			(			cls   :int						,							_lowerCamelCase   :PretrainedConfig						,							_lowerCamelCase   :PretrainedConfig						,							**_lowerCamelCase   :List[str]						):
       logger.info('''Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config'''						)
       __SCREAMING_SNAKE_CASE :			Tuple												=       True
       __SCREAMING_SNAKE_CASE :			List[str]												=       True

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



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








"""simple docstring"""





from typing import TYPE_CHECKING

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


_lowerCamelCase       =	{
    '''configuration_mobilenet_v1''': [
        '''MOBILENET_V1_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''MobileNetV1Config''',
        '''MobileNetV1OnnxConfig''',
    ],
}

try:
    if not is_vision_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _lowerCamelCase       =	['''MobileNetV1FeatureExtractor''']
    _lowerCamelCase       =	['''MobileNetV1ImageProcessor''']

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _lowerCamelCase       =	[
        '''MOBILENET_V1_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''MobileNetV1ForImageClassification''',
        '''MobileNetV1Model''',
        '''MobileNetV1PreTrainedModel''',
        '''load_tf_weights_in_mobilenet_v1''',
    ]


if TYPE_CHECKING:
    from .configuration_mobilenet_va import (
        MOBILENET_V1_PRETRAINED_CONFIG_ARCHIVE_MAP,
        MobileNetVaConfig,
        MobileNetVaOnnxConfig,
    )

    try:
        if not is_vision_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .feature_extraction_mobilenet_va import MobileNetVaFeatureExtractor
        from .image_processing_mobilenet_va import MobileNetVaImageProcessor

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_mobilenet_va import (
            MOBILENET_V1_PRETRAINED_MODEL_ARCHIVE_LIST,
            MobileNetVaForImageClassification,
            MobileNetVaModel,
            MobileNetVaPreTrainedModel,
            load_tf_weights_in_mobilenet_va,
        )


else:
    import sys

    _lowerCamelCase       =	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

