






'''simple docstring'''







import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin

class _lowercase     (    _lowercase		):
							a    				=	"""Speech2TextFeatureExtractor"""
							a    				=	"""Speech2TextTokenizer"""




							def __init__(							self:    str      ,							UpperCamelCase__:    Optional[Any]      ,							UpperCamelCase__:    Tuple					):
														super().__init__(UpperCamelCase__      ,							UpperCamelCase__					)
														lowerCamelCase__ :     int	  =	self.feature_extractor
														lowerCamelCase__ :     str	  =	False




							def __call__(							self:    Tuple      ,							*UpperCamelCase__:    Optional[int]      ,							**UpperCamelCase__:    Any					):
														# For backward compatibility
														if self._in_target_context_manager:
																					return self.current_processor(*UpperCamelCase__      ,							**UpperCamelCase__					)

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

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




							def 		lowerCamelCase_    (							self:    Tuple      ,							*UpperCamelCase__:    Dict      ,							**UpperCamelCase__:    List[Any]					):
														return self.tokenizer.batch_decode(*UpperCamelCase__      ,							**UpperCamelCase__					)




							def 		lowerCamelCase_    (							self:    int      ,							*UpperCamelCase__:    Optional[int]      ,							**UpperCamelCase__:    Optional[int]					):
														return self.tokenizer.decode(*UpperCamelCase__      ,							**UpperCamelCase__					)




							@contextmanager
							def 		lowerCamelCase_    (							self:    int					):
														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__ :     str	  =	True
														lowerCamelCase__ :     Any	  =	self.tokenizer
														yield
														lowerCamelCase__ :     Tuple	  =	self.feature_extractor
														lowerCamelCase__ :     Any	  =	False













'''simple docstring'''







from torch import nn





def 			SCREAMING_SNAKE_CASE_	(UpperCamelCase				)				->	Dict:
							if act_fn in ["swish", "silu"]:
														return nn.SiLU()
							elif act_fn == "mish":
														return nn.Mish()
							elif act_fn == "gelu":
														return nn.GELU()
							else:
														raise ValueError(f'''Unsupported activation function: {act_fn}'''				)

