





"""simple docstring"""


import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin






class 							lowercase__			(   __SCREAMING_SNAKE_CASE	):

			"""simple docstring"""
			__lowerCAmelCase     :				Optional[Any]										=  """Speech2TextFeatureExtractor"""
			__lowerCAmelCase     :				int										=  """Speech2TextTokenizer"""







			def __init__(      self						,   _A						,   _A    ):






									'''simple docstring'''







									super().__init__(_A						,   _A    )
									UpperCamelCase				:		int				   =			self.feature_extractor
									UpperCamelCase				:		Any				   =			False







			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				:		Optional[Any]				   =			kwargs.pop("""raw_speech"""    )
									else:
															UpperCamelCase				:		List[Any]				   =			kwargs.pop("""audio"""						,   _A    )
									UpperCamelCase				:		str				   =			kwargs.pop("""sampling_rate"""						,   _A    )
									UpperCamelCase				:		Union[str, Any]				   =			kwargs.pop("""text"""						,   _A    )
									if len(_A    ) > 0:
															UpperCamelCase				:		List[Any]				   =			args[0]
															UpperCamelCase				:		Optional[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:
															UpperCamelCase				:		Dict				   =			self.feature_extractor(_A						,   *_A						,   sampling_rate=_A						,   **_A    )
									if text is not None:
															UpperCamelCase				:		str				   =			self.tokenizer(_A						,   **_A    )

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







			def   _a      (      self						,   *_A						,   **_A    ):






									'''simple docstring'''







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







			def   _a      (      self						,   *_A						,   **_A    ):






									'''simple docstring'''







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







			@contextmanager
			def   _a      (      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				:		str				   =			True
									UpperCamelCase				:		Dict				   =			self.tokenizer
									yield
									UpperCamelCase				:		Optional[Any]				   =			self.feature_extractor
									UpperCamelCase				:		Optional[Any]				   =			False










"""simple docstring"""


import logging
from dataclasses import dataclass, field
from typing import Optional

from seqaseq_trainer import arg_to_scheduler

from transformers import TrainingArguments


__magic_name__       :					Dict						=			logging.getLogger(__name__)






@dataclass
class 							lowercase__			(   __SCREAMING_SNAKE_CASE	):

			"""simple docstring"""
			__lowerCAmelCase     :				Optional[float]										=  field(
			    default=0.0					,     metadata={"""help""": """The label smoothing epsilon to apply (if not zero)."""}	)
			__lowerCAmelCase     :				bool										=  field(default=__SCREAMING_SNAKE_CASE					,     metadata={"""help""": """Whether to SortishSamler or not."""}	)
			__lowerCAmelCase     :				bool										=  field(
			    default=__SCREAMING_SNAKE_CASE					,     metadata={"""help""": """Whether to use generate to calculate generative metrics (ROUGE, BLEU)."""}	)
			__lowerCAmelCase     :				bool										=  field(default=__SCREAMING_SNAKE_CASE					,     metadata={"""help""": """whether to use adafactor"""}	)
			__lowerCAmelCase     :				Optional[float]										=  field(
			    default=__SCREAMING_SNAKE_CASE					,     metadata={"""help""": """Encoder layer dropout probability. Goes into model.config."""}	)
			__lowerCAmelCase     :				Optional[float]										=  field(
			    default=__SCREAMING_SNAKE_CASE					,     metadata={"""help""": """Decoder layer dropout probability. Goes into model.config."""}	)
			__lowerCAmelCase     :				Optional[float]										=  field(default=__SCREAMING_SNAKE_CASE					,     metadata={"""help""": """Dropout probability. Goes into model.config."""}	)
			__lowerCAmelCase     :				Optional[float]										=  field(
			    default=__SCREAMING_SNAKE_CASE					,     metadata={"""help""": """Attention dropout probability. Goes into model.config."""}	)
			__lowerCAmelCase     :				Optional[str]										=  field(
			    default="""linear"""					,     metadata={"""help""": f'''Which lr scheduler to use. Selected in {sorted(arg_to_scheduler.keys()	)}'''}					,     )



