


import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin




class  a     (     _SCREAMING_SNAKE_CASE       ):
 _lowerCAmelCase 					=	'''MCTCTFeatureExtractor'''
 _lowerCAmelCase 					=	'''AutoTokenizer'''
 def __init__( self      ,				__magic_name__      ,				__magic_name__						)					->							str:
      super().__init__(A__      ,				A__						)
      _a			      =							self.feature_extractor
      _a			      =							False
 def __call__( self      ,				*__magic_name__      ,				**__magic_name__						)					->							List[str]:
      # For backward compatibility
      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.'						)
           _a			      =							kwargs.pop('raw_speech'						)
      else:
           _a			      =							kwargs.pop('audio'      ,				A__						)
      _a			      =							kwargs.pop('sampling_rate'      ,				A__						)
      _a			      =							kwargs.pop('text'      ,				A__						)
      if len(A__						) > 0:
           _a			      =							args[0]
           _a			      =							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:
           _a			      =							self.feature_extractor(A__      ,				*A__      ,				sampling_rate=A__      ,				**A__						)
      if text is not None:
           _a			      =							self.tokenizer(A__      ,				**A__						)

      if text is None:
           return inputs
      elif audio is None:
           return encodings
      else:
           _a			      =							encodings["""input_ids"""]
           return inputs
 def 							__UpperCAmelCase		( self      ,				*__magic_name__      ,				**__magic_name__						)					->							Optional[int]:
      return self.tokenizer.batch_decode(*A__      ,				**A__						)
 def 							__UpperCAmelCase		( self      ,				*__magic_name__      ,				**__magic_name__						)					->							List[str]:
      # For backward compatibility
      if self._in_target_context_manager:
           return self.current_processor.pad(*A__      ,				**A__						)

      _a			      =							kwargs.pop('input_features'      ,				A__						)
      _a			      =							kwargs.pop('labels'      ,				A__						)
      if len(A__						) > 0:
           _a			      =							args[0]
           _a			      =							args[1:]

      if input_features is not None:
           _a			      =							self.feature_extractor.pad(A__      ,				*A__      ,				**A__						)
      if labels is not None:
           _a			      =							self.tokenizer.pad(A__      ,				**A__						)

      if labels is None:
           return input_features
      elif input_features is None:
           return labels
      else:
           _a			      =							labels["""input_ids"""]
           return input_features
 def 							__UpperCAmelCase		( self      ,				*__magic_name__      ,				**__magic_name__						)					->							int:
      return self.tokenizer.decode(*A__      ,				**A__						)




 @contextmanager
 def 							__UpperCAmelCase		( self						)					->							Tuple:
      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.'						)
      _a			      =							True
      _a			      =							self.tokenizer
      yield
      _a			      =							self.feature_extractor
      _a			      =							False





'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


a_					:    int          =    {"configuration_vit": ["VIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ViTConfig", "ViTOnnxConfig"]}

try:
 if not is_vision_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_					:    List[Any]          =    ["ViTFeatureExtractor"]
 a_					:    Optional[int]          =    ["ViTImageProcessor"]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_					:    Optional[int]          =    [
     "VIT_PRETRAINED_MODEL_ARCHIVE_LIST",
     "ViTForImageClassification",
     "ViTForMaskedImageModeling",
     "ViTModel",
     "ViTPreTrainedModel",
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_					:    Any          =    [
     "TFViTForImageClassification",
     "TFViTModel",
     "TFViTPreTrainedModel",
 ]

try:
 if not is_flax_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_					:    Dict          =    [
     "FlaxViTForImageClassification",
     "FlaxViTModel",
     "FlaxViTPreTrainedModel",
 ]

if TYPE_CHECKING:
 from .configuration_vit import VIT_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTConfig, ViTOnnxConfig

 try:
  if not is_vision_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .feature_extraction_vit import ViTFeatureExtractor
  from .image_processing_vit import ViTImageProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_vit import (
      VIT_PRETRAINED_MODEL_ARCHIVE_LIST,
      ViTForImageClassification,
      ViTForMaskedImageModeling,
      ViTModel,
      ViTPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_vit import TFViTForImageClassification, TFViTModel, TFViTPreTrainedModel

 try:
  if not is_flax_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_flax_vit import FlaxViTForImageClassification, FlaxViTModel, FlaxViTPreTrainedModel


else:
 import sys

 a_					:    List[str]          =    _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)

