

"""simple docstring"""



from ...configuration_utils import PretrainedConfig
from ...utils import logging


SCREAMING_SNAKE_CASE_       :						List[Any]					=    logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_       :						Union[str, Any]					=    {
    'ZinengTang/tvlt-base': 'https://huggingface.co/ZinengTang/tvlt-base/blob/main/config.json',
}



class        a    (							__snake_case					):



    """simple docstring"""



    UpperCAmelCase    			=       'tvlt'

    def __init__(  self:			List[Any]     ,    UpperCamelCase:			List[str]=2_24     ,    UpperCamelCase:			Union[str, Any]=20_48     ,    UpperCamelCase:			Any=1_28     ,    UpperCamelCase:			int=[16, 16]     ,    UpperCamelCase:			List[Any]=[16, 16]     ,    UpperCamelCase:			List[str]=3     ,    UpperCamelCase:			Optional[Any]=1     ,    UpperCamelCase:			Any=8     ,    UpperCamelCase:			List[Any]=7_68     ,    UpperCamelCase:			Optional[Any]=12     ,    UpperCamelCase:			List[str]=12     ,    UpperCamelCase:			List[str]=30_72     ,    UpperCamelCase:			Any="gelu"     ,    UpperCamelCase:			Optional[int]=0.0     ,    UpperCamelCase:			List[str]=0.0     ,    UpperCamelCase:			List[Any]=0.02     ,    UpperCamelCase:			int=1e-6     ,    UpperCamelCase:			Optional[int]=True     ,    UpperCamelCase:			str=False     ,    UpperCamelCase:			Union[str, Any]=16     ,    UpperCamelCase:			List[str]=5_12     ,    UpperCamelCase:			Union[str, Any]=8     ,    UpperCamelCase:			Tuple=20_48     ,    UpperCamelCase:			List[Any]=0.75     ,    UpperCamelCase:			str=0.15     ,    UpperCamelCase:			List[Any]="frame-level"     ,    UpperCamelCase:			str=True     ,    UpperCamelCase:			Optional[int]=True     ,    UpperCamelCase:			Optional[int]="classification"     ,    **UpperCamelCase:			List[str]     ,    ):






         """simple docstring"""


         super().__init__(**UpperCamelCase							)

         if audio_mask_type not in ("frame-level", "patch_level"):
              raise ValueError(
                  """audio_mask_type must be one of two acceptable strategies - {'frame_level', 'patch-level') """
                  f"""got {audio_mask_type}"""							)

         A__				      =	image_size
         A__				      =	spectrogram_length
         A__				      =	frequency_length
         A__				      =	image_patch_size
         A__				      =	audio_patch_size
         A__				      =	num_image_channels
         A__				      =	num_audio_channels
         A__				      =	num_frames

         A__				      =	hidden_size
         A__				      =	num_hidden_layers
         A__				      =	num_attention_heads
         A__				      =	intermediate_size
         A__				      =	hidden_act
         A__				      =	hidden_dropout_prob
         A__				      =	attention_probs_dropout_prob
         A__				      =	initializer_range
         A__				      =	layer_norm_eps
         A__				      =	qkv_bias
         A__				      =	use_mean_pooling

         A__				      =	decoder_num_attention_heads
         A__				      =	decoder_hidden_size
         A__				      =	decoder_num_hidden_layers
         A__				      =	decoder_intermediate_size
         A__				      =	pixel_mask_ratio
         A__				      =	audio_mask_ratio
         A__				      =	audio_mask_type

         A__				      =	task_matching
         A__				      =	task_mae
         A__				      =	loss_type









import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin







class 					__lowerCamelCase							(      __snake_case      ):
      lowerCamelCase_      : Dict  			=   'AutoFeatureExtractor'
      lowerCamelCase_      : Optional[int]  			=   'Speech2Text2Tokenizer'







      def __init__(	self				,    lowerCamelCase				,    lowerCamelCase  )		->			List[str]:
        super().__init__(lowerCamelCase				,    lowerCamelCase  )
        snake_case_					= self.feature_extractor
        snake_case_					= False







      def __call__(	self				,    *lowerCamelCase				,    **lowerCamelCase  )		->			Dict:
        # For backward compatibility
        if self._in_target_context_manager:
          return self.current_processor(*lowerCamelCase				,    **lowerCamelCase  )

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

        if text is None:
          return inputs
        elif audio is None:
          return encodings
        else:
          snake_case_					= encodings["""input_ids"""]
          return inputs







      def       lowerCAmelCase_       (	self				,    *lowerCamelCase				,    **lowerCamelCase  )		->			int:
        return self.tokenizer.batch_decode(*lowerCamelCase				,    **lowerCamelCase  )







      def       lowerCAmelCase_       (	self				,    *lowerCamelCase				,    **lowerCamelCase  )		->			Union[str, Any]:
        return self.tokenizer.decode(*lowerCamelCase				,    **lowerCamelCase  )







      @contextmanager
      def       lowerCAmelCase_       (	self  )		->			Any:
        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."""  )
        snake_case_					= True
        snake_case_					= self.tokenizer
        yield
        snake_case_					= self.feature_extractor
        snake_case_					= False