




import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin


class 							__SCREAMING_SNAKE_CASE				(						lowerCamelCase    ):
					_lowerCamelCase						    =					"""AutoFeatureExtractor"""
					_lowerCamelCase						    =					"""Speech2Text2Tokenizer"""

					def __init__(							self					,			__lowercase					,			__lowercase   ):







						'''simple docstring'''




						super().__init__(__lowercase					,			__lowercase   )
						lowerCamelCase_				:						Optional[int]				  =				self.feature_extractor
						lowerCamelCase_				:						List[Any]				  =				False

					def __call__(							self					,			*__lowercase					,			**__lowercase   ):







						'''simple docstring'''




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

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

						if text is None:
							return inputs
						elif audio is None:
							return encodings
						else:
							lowerCamelCase_				:						Optional[int]				  =				encodings['input_ids']
							return inputs

					def       lowercase_				(							self					,			*__lowercase					,			**__lowercase   ):







						'''simple docstring'''




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

					def       lowercase_				(							self					,			*__lowercase					,			**__lowercase   ):







						'''simple docstring'''




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





					@contextmanager
					def       lowercase_				(							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.'   )
						lowerCamelCase_				:						Tuple				  =				True
						lowerCamelCase_				:						Optional[Any]				  =				self.tokenizer
						yield
						lowerCamelCase_				:						str				  =				self.feature_extractor
						lowerCamelCase_				:						Optional[int]				  =				False








'''simple docstring'''


from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
import PIL
from PIL import Image

from ...utils import BaseOutput, is_torch_available, is_transformers_available
@dataclass
# Copied from diffusers.pipelines.stable_diffusion.__init__.StableDiffusionPipelineOutput with Stable->Alt
class  _SCREAMING_SNAKE_CASE				(		SCREAMING_SNAKE_CASE						):


			'''simple docstring'''





			__a				:				Union[List[PIL.Image.Image], np.ndarray]
			__a				:				Optional[List[bool]]


if is_transformers_available() and is_torch_available():
					from .modeling_roberta_series import RobertaSeriesModelWithTransformation
					from .pipeline_alt_diffusion import AltDiffusionPipeline
					from .pipeline_alt_diffusion_imgaimg import AltDiffusionImgaImgPipeline
