
"""simple docstring"""


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




class  __lowerCamelCase  ( lowerCAmelCase			):
				a__:      int          =    'ClapFeatureExtractor'
				a__:      Union[str, Any]          =    ('RobertaTokenizer', 'RobertaTokenizerFast')




				def __init__(				self							,						UpperCAmelCase							,						UpperCAmelCase   ):
							super().__init__(UpperCAmelCase							,						UpperCAmelCase   )




				def __call__(				self							,						UpperCAmelCase=None							,						UpperCAmelCase=None							,						UpperCAmelCase=None							,						**UpperCAmelCase   ):
							lowerCamelCase_					=  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:
										lowerCamelCase_					=  self.tokenizer(UpperCAmelCase							,						return_tensors=UpperCAmelCase							,						**UpperCAmelCase   )

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

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




				def        UpperCAmelCase__						(				self							,						*UpperCAmelCase							,						**UpperCAmelCase   ):
							return self.tokenizer.batch_decode(*UpperCAmelCase							,						**UpperCAmelCase   )




				def        UpperCAmelCase__						(				self							,						*UpperCAmelCase							,						**UpperCAmelCase   ):
							return self.tokenizer.decode(*UpperCAmelCase							,						**UpperCAmelCase   )





				@property
				def        UpperCAmelCase__						(				self   ):
							lowerCamelCase_					=  self.tokenizer.model_input_names
							lowerCamelCase_					=  self.feature_extractor.model_input_names
							return list(dict.fromkeys(tokenizer_input_names + feature_extractor_input_names   )   )





"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A_    							=					{
    """configuration_nllb_moe""": [
        """NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """NllbMoeConfig""",
    ]
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						A_    							=					[
						    """NLLB_MOE_PRETRAINED_MODEL_ARCHIVE_LIST""",
						    """NllbMoeForConditionalGeneration""",
						    """NllbMoeModel""",
						    """NllbMoePreTrainedModel""",
						    """NllbMoeTop2Router""",
						    """NllbMoeSparseMLP""",
						]


if TYPE_CHECKING:
						from .configuration_nllb_moe import (
						    NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    NllbMoeConfig,
						)

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_nllb_moe import (
												    NLLB_MOE_PRETRAINED_MODEL_ARCHIVE_LIST,
												    NllbMoeForConditionalGeneration,
												    NllbMoeModel,
												    NllbMoePreTrainedModel,
												    NllbMoeSparseMLP,
												    NllbMoeTopaRouter,
												)


else:
						import sys

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



