





import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin
from .feature_extraction_wavaveca import WavaVecaFeatureExtractor
from .tokenization_wavaveca import WavaVecaCTCTokenizer



class       A__     ( __snake_case    ):
      _UpperCAmelCase			:Any							=     'Wav2Vec2FeatureExtractor'
      _UpperCAmelCase			:List[str]							=     'AutoTokenizer'





      def __init__(				self ,							A_ ,							A_     ):
       '''simple docstring'''




       super().__init__(A_ ,							A_     )
       UpperCamelCase			:      Union[str, Any] 			=     self.feature_extractor
       UpperCamelCase			:      Optional[int] 			=     False





      @classmethod
      def  __UpperCamelCase(				cls ,							A_ ,							**A_     ):
       '''simple docstring'''




       try:
        return super().from_pretrained(A_ ,							**A_     )
       except OSError:
        warnings.warn(
            F"""Loading a tokenizer inside {cls.__name__} from a config that does not"""
            " include a `tokenizer_class` attribute is deprecated and will be "
            "removed in v5. Please add `'tokenizer_class': 'Wav2Vec2CTCTokenizer'`"
            " attribute to either your `config.json` or `tokenizer_config.json` "
            "file to suppress this warning: " ,							A_ ,							)

        UpperCamelCase			:      Dict 			=     WavaVecaFeatureExtractor.from_pretrained(A_ ,							**A_     )
        UpperCamelCase			:      Any 			=     WavaVecaCTCTokenizer.from_pretrained(A_ ,							**A_     )

        return cls(feature_extractor=A_ ,							tokenizer=A_     )





      def __call__(				self ,							*A_ ,							**A_     ):
       '''simple docstring'''




       if self._in_target_context_manager:
        return self.current_processor(*A_ ,							**A_     )

       if "raw_speech" in kwargs:
        warnings.warn("Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."     )
        UpperCamelCase			:      int 			=     kwargs.pop("raw_speech"     )
       else:
        UpperCamelCase			:      Any 			=     kwargs.pop("audio" ,							A_     )
       UpperCamelCase			:      str 			=     kwargs.pop("sampling_rate" ,							A_     )
       UpperCamelCase			:      Dict 			=     kwargs.pop("text" ,							A_     )
       if len(A_     ) > 0:
        UpperCamelCase			:      str 			=     args[0]
        UpperCamelCase			:      str 			=     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			:      str 			=     self.feature_extractor(A_ ,							*A_ ,							sampling_rate=A_ ,							**A_     )
       if text is not None:
        UpperCamelCase			:      Optional[int] 			=     self.tokenizer(A_ ,							**A_     )

       if text is None:
        return inputs
       elif audio is None:
        return encodings
       else:
        UpperCamelCase			:      Union[str, Any] 			=     encodings["input_ids"]
        return inputs





      def  __UpperCamelCase(				self ,							*A_ ,							**A_     ):
       '''simple docstring'''




       if self._in_target_context_manager:
        return self.current_processor.pad(*A_ ,							**A_     )

       UpperCamelCase			:      int 			=     kwargs.pop("input_features" ,							A_     )
       UpperCamelCase			:      Optional[int] 			=     kwargs.pop("labels" ,							A_     )
       if len(A_     ) > 0:
        UpperCamelCase			:      Optional[int] 			=     args[0]
        UpperCamelCase			:      Tuple 			=     args[1:]

       if input_features is not None:
        UpperCamelCase			:      Any 			=     self.feature_extractor.pad(A_ ,							*A_ ,							**A_     )
       if labels is not None:
        UpperCamelCase			:      Dict 			=     self.tokenizer.pad(A_ ,							**A_     )

       if labels is None:
        return input_features
       elif input_features is None:
        return labels
       else:
        UpperCamelCase			:      Optional[int] 			=     labels["input_ids"]
        return input_features





      def  __UpperCamelCase(				self ,							*A_ ,							**A_     ):
       '''simple docstring'''




       return self.tokenizer.batch_decode(*A_ ,							**A_     )





      def  __UpperCamelCase(				self ,							*A_ ,							**A_     ):
       '''simple docstring'''




       return self.tokenizer.decode(*A_ ,							**A_     )





      @contextmanager
      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       warnings.warn(
           "`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your "
           "labels by using the argument `text` of the regular `__call__` method (either in the same call as "
           "your audio inputs, or in a separate call."     )
       UpperCamelCase			:      Optional[Any] 			=     True
       UpperCamelCase			:      Any 			=     self.tokenizer
       yield
       UpperCamelCase			:      Dict 			=     self.feature_extractor
       UpperCamelCase			:      Dict 			=     False







from ..utils import DummyObject, requires_backends



class       A__     ( metaclass=__snake_case    ):
      _UpperCAmelCase			:Tuple							=     ['note_seq']





      def __init__(				self ,							*A_ ,							**A_     ):
       '''simple docstring'''




       requires_backends(self ,							["note_seq"]     )





      @classmethod
      def  __UpperCamelCase(				cls ,							*A_ ,							**A_     ):
       '''simple docstring'''




       requires_backends(cls ,							["note_seq"]     )





      @classmethod
      def  __UpperCamelCase(				cls ,							*A_ ,							**A_     ):
       '''simple docstring'''




       requires_backends(cls ,							["note_seq"]     )
