

'''simple docstring'''


from ...processing_utils import ProcessorMixin



class 					lowercase						(  a_ ):
							_lowerCamelCase		:      Optional[int]=   "WhisperFeatureExtractor"
							_lowerCamelCase		:      Any=   "WhisperTokenizer"


							def __init__(			self    ,			_snake_case    ,			_snake_case)							->				Optional[int]:
								super().__init__(_snake_case    ,			_snake_case)
								UpperCAmelCase_		:      int       	=					self.feature_extractor
								UpperCAmelCase_		:      Union[str, Any]       	=					False


							def 						_snake_case							(			self    ,			_snake_case=None    ,			_snake_case=None    ,			_snake_case=True)							->				Any:
								return self.tokenizer.get_decoder_prompt_ids(task=_snake_case    ,			language=_snake_case    ,			no_timestamps=_snake_case)


							def __call__(			self    ,			*_snake_case    ,			**_snake_case)							->				List[str]:
								# For backward compatibility
								if self._in_target_context_manager:
									return self.current_processor(*_snake_case    ,			**_snake_case)

								UpperCAmelCase_		:      Tuple       	=					kwargs.pop('audio'    ,			_snake_case)
								UpperCAmelCase_		:      List[Any]       	=					kwargs.pop('sampling_rate'    ,			_snake_case)
								UpperCAmelCase_		:      List[Any]       	=					kwargs.pop('text'    ,			_snake_case)
								if len(_snake_case) > 0:
									UpperCAmelCase_		:      Union[str, Any]       	=					args[0]
									UpperCAmelCase_		:      Optional[Any]       	=					args[1:]

								if audio is None and text is None:
									raise ValueError('You need to specify either an `audio` or `text` input to process.')

								if audio is not None:
									UpperCAmelCase_		:      Optional[Any]       	=					self.feature_extractor(_snake_case    ,			*_snake_case    ,			sampling_rate=_snake_case    ,			**_snake_case)
								if text is not None:
									UpperCAmelCase_		:      Optional[int]       	=					self.tokenizer(_snake_case    ,			**_snake_case)

								if text is None:
									return inputs

								elif audio is None:
									return encodings
								else:
									UpperCAmelCase_		:      List[Any]       	=					encodings['input_ids']
									return inputs


							def 						_snake_case							(			self    ,			*_snake_case    ,			**_snake_case)							->				Optional[Any]:
								return self.tokenizer.batch_decode(*_snake_case    ,			**_snake_case)


							def 						_snake_case							(			self    ,			*_snake_case    ,			**_snake_case)							->				str:
								return self.tokenizer.decode(*_snake_case    ,			**_snake_case)





							def 						_snake_case							(			self    ,			_snake_case    ,			_snake_case="np")							->				Optional[int]:
								return self.tokenizer.get_prompt_ids(_snake_case    ,			return_tensors=_snake_case)









'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCAmelCase__										= {
    "configuration_clap": [
        "CLAP_PRETRAINED_MODEL_ARCHIVE_LIST",
        "ClapAudioConfig",
        "ClapConfig",
        "ClapTextConfig",
    ],
    "processing_clap": ["ClapProcessor"],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__										= [
						    "CLAP_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "ClapModel",
						    "ClapPreTrainedModel",
						    "ClapTextModel",
						    "ClapTextModelWithProjection",
						    "ClapAudioModel",
						    "ClapAudioModelWithProjection",
						]
						lowerCAmelCase__										= ["ClapFeatureExtractor"]

if TYPE_CHECKING:
						from .configuration_clap import (
						    CLAP_PRETRAINED_MODEL_ARCHIVE_LIST,
						    ClapAudioConfig,
						    ClapConfig,
						    ClapTextConfig,
						)
						from .processing_clap import ClapProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_clap import ClapFeatureExtractor
												from .modeling_clap import (
												    CLAP_PRETRAINED_MODEL_ARCHIVE_LIST,
												    ClapAudioModel,
												    ClapAudioModelWithProjection,
												    ClapModel,
												    ClapPreTrainedModel,
												    ClapTextModel,
												    ClapTextModelWithProjection,
												)


else:
						import sys

						lowerCAmelCase__										= _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)






