

'''simple docstring'''







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


__lowerCamelCase		       =    logging.get_logger(__name__)

__lowerCamelCase		       =    {
    """facebook/convnextv2-tiny-1k-224""": """https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json""",
}


class 					A__      (      __snake_case						,						__snake_case			):
    lowercase						=		'convnextv2'



    def __init__(					self		,				UpperCamelCase__=3		,				UpperCamelCase__=4		,				UpperCamelCase__=4		,				UpperCamelCase__=None		,				UpperCamelCase__=None		,				UpperCamelCase__="gelu"		,				UpperCamelCase__=0.02		,				UpperCamelCase__=1e-1_2		,				UpperCamelCase__=0.0		,				UpperCamelCase__=224		,				UpperCamelCase__=None		,				UpperCamelCase__=None		,				**UpperCamelCase__		,				)						->      str:





           '''simple docstring'''
           super().__init__(**A_       )

           A_						=      num_channels
           A_						=      patch_size
           A_						=      num_stages
           A_						=      [96, 192, 384, 768] if hidden_sizes is None else hidden_sizes
           A_						=      [3, 3, 9, 3] if depths is None else depths
           A_						=      hidden_act
           A_						=      initializer_range
           A_						=      layer_norm_eps
           A_						=      drop_path_rate
           A_						=      image_size
           A_						=      ["stem"] + [f'''stage{idx}''' for idx in range(1		,				len(self.depths       ) + 1       )]
           A_						=      get_aligned_output_features_output_indices(
               out_features=A_		,				out_indices=A_		,				stage_names=self.stage_names       )



'''simple docstring'''







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


class 					A__      (      _snake_case			):
    lowercase						=		"ClapFeatureExtractor"
    lowercase						=		("RobertaTokenizer", "RobertaTokenizerFast")



    def __init__(					self		,				UpperCamelCase__		,				UpperCamelCase__       )						->      Tuple:





           '''simple docstring'''
           super().__init__(UpperCamelCase__		,				UpperCamelCase__       )



    def __call__(					self		,				UpperCamelCase__=None		,				UpperCamelCase__=None		,				UpperCamelCase__=None		,				**UpperCamelCase__       )						->      Tuple:





           '''simple docstring'''
           A_						=      kwargs.pop("""sampling_rate"""		,				UpperCamelCase__       )

           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_						=      self.tokenizer(UpperCamelCase__		,				return_tensors=UpperCamelCase__		,				**UpperCamelCase__       )

           if audios is not None:
                  A_						=      self.feature_extractor(
                      UpperCamelCase__		,				sampling_rate=UpperCamelCase__		,				return_tensors=UpperCamelCase__		,				**UpperCamelCase__       )

           if text is not None and audios is not None:
                  A_						=      audio_features.input_features
                  return encoding
           elif text is not None:
                  return encoding
           else:
                  return BatchEncoding(data=dict(**UpperCamelCase__       )		,				tensor_type=UpperCamelCase__       )



    def 					snake_case_			(					self		,				*UpperCamelCase__		,				**UpperCamelCase__       )						->      Optional[int]:





           '''simple docstring'''
           return self.tokenizer.batch_decode(*UpperCamelCase__		,				**UpperCamelCase__       )



    def 					snake_case_			(					self		,				*UpperCamelCase__		,				**UpperCamelCase__       )						->      str:





           '''simple docstring'''
           return self.tokenizer.decode(*UpperCamelCase__		,				**UpperCamelCase__       )







    @property
    def 					snake_case_			(					self       )						->      int:





           '''simple docstring'''
           A_						=      self.tokenizer.model_input_names
           A_						=      self.feature_extractor.model_input_names
           return list(dict.fromkeys(tokenizer_input_names + feature_extractor_input_names       )       )
