


'''simple docstring'''




from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


UpperCAmelCase_      :		int          =		logging.get_logger(__name__)

UpperCAmelCase_      :		Union[str, Any]          =		{
    "microsoft/resnet-50": "https://huggingface.co/microsoft/resnet-50/blob/main/config.json",
}







class 					a			(				snake_case__			,							snake_case__  ):
 '''simple docstring'''




 __lowerCAmelCase						: Union[str, Any]							  =		"""resnet"""
 __lowerCAmelCase						: List[Any]							  =		["""basic""", """bottleneck"""]




 def __init__(    self		,      lowerCamelCase_=3		,      lowerCamelCase_=6_4		,      lowerCamelCase_=[2_5_6, 5_1_2, 1_0_2_4, 2_0_4_8]		,      lowerCamelCase_=[3, 4, 6, 3]		,      lowerCamelCase_="bottleneck"		,      lowerCamelCase_="relu"		,      lowerCamelCase_=False		,      lowerCamelCase_=None		,      lowerCamelCase_=None		,      **lowerCamelCase_		,      )      ->    List[str]:
    super().__init__(**lowerCamelCase_      )
    if layer_type not in self.layer_types:
       raise ValueError(F'''layer_type={layer_type} is not one of {",".join(self.layer_types      )}'''      )
    _a					:  Any						=  num_channels
    _a					:  Optional[Any]						=  embedding_size
    _a					:  Any						=  hidden_sizes
    _a					:  Optional[Any]						=  depths
    _a					:  Tuple						=  layer_type
    _a					:  List[Any]						=  hidden_act
    _a					:  Union[str, Any]						=  downsample_in_first_stage
    _a					:  Any						=  ['stem'] + [F'''stage{idx}''' for idx in range(1		,      len(lowerCamelCase_      ) + 1      )]
    _a		,						_a					:  Union[str, Any]						=  get_aligned_output_features_output_indices(
        out_features=lowerCamelCase_		,      out_indices=lowerCamelCase_		,      stage_names=self.stage_names      )







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




 __lowerCAmelCase						: Any							  =		version.parse("""1.11"""  )




 @property
 def   __UpperCamelCase   (    self      )      ->    Mapping[str, Mapping[int, str]]:
    return OrderedDict(
        [
            ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
        ]      )




 @property
 def   __UpperCamelCase   (    self      )      ->    float:
    return 1e-3






'''simple docstring'''




from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding







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




 __lowerCAmelCase						: Optional[int]							  =		"""ClapFeatureExtractor"""
 __lowerCAmelCase						: str							  =		("""RobertaTokenizer""", """RobertaTokenizerFast""")




 def __init__(    self		,      lowerCamelCase_		,      lowerCamelCase_      )      ->    Union[str, Any]:
    super().__init__(lowerCamelCase_		,      lowerCamelCase_      )




 def __call__(    self		,      lowerCamelCase_=None		,      lowerCamelCase_=None		,      lowerCamelCase_=None		,      **lowerCamelCase_      )      ->    List[Any]:
    _a					:  Any						=  kwargs.pop('sampling_rate'		,      lowerCamelCase_      )

    if text is None and audios is None:
       raise ValueError('You have to specify either text or audios. Both cannot be none.'      )

    if text is not None:
       _a					:  Union[str, Any]						=  self.tokenizer(lowerCamelCase_		,      return_tensors=lowerCamelCase_		,      **lowerCamelCase_      )

    if audios is not None:
       _a					:  List[str]						=  self.feature_extractor(
           lowerCamelCase_		,      sampling_rate=lowerCamelCase_		,      return_tensors=lowerCamelCase_		,      **lowerCamelCase_      )

    if text is not None and audios is not None:
       _a					:  List[Any]						=  audio_features.input_features
       return encoding
    elif text is not None:
       return encoding
    else:
       return BatchEncoding(data=dict(**lowerCamelCase_      )		,      tensor_type=lowerCamelCase_      )




 def   __UpperCamelCase   (    self		,      *lowerCamelCase_		,      **lowerCamelCase_      )      ->    Tuple:
    return self.tokenizer.batch_decode(*lowerCamelCase_		,      **lowerCamelCase_      )




 def   __UpperCamelCase   (    self		,      *lowerCamelCase_		,      **lowerCamelCase_      )      ->    List[str]:
    return self.tokenizer.decode(*lowerCamelCase_		,      **lowerCamelCase_      )




 @property
 def   __UpperCamelCase   (    self      )      ->    Tuple:
    _a					:  Dict						=  self.tokenizer.model_input_names
    _a					:  Tuple						=  self.feature_extractor.model_input_names
    return list(dict.fromkeys(tokenizer_input_names + feature_extractor_input_names      )      )


