





"""simple docstring"""






from typing import Dict

from .base import GenericTensor, Pipeline




class 					__lowercase      (      _UpperCamelCase				):







					'''simple docstring'''




					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase=None						,      _UpperCAmelCase=None						,      _UpperCAmelCase=None						,      **_UpperCAmelCase  ):
									if tokenize_kwargs is None:
													__a			:    Dict      							=	{}

									if truncation is not None:
													if "truncation" in tokenize_kwargs:
																	raise ValueError(
																	    '''truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)'''  )
													__a			:    Tuple      							=	truncation

									__a			:    List[Any]      							=	tokenize_kwargs

									__a			:    List[str]      							=	{}
									if return_tensors is not None:
													__a			:    Optional[Any]      							=	return_tensors

									return preprocess_params, {}, postprocess_params







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase						,      **_UpperCAmelCase  ):
									__a			:    Optional[Any]      							=	self.framework
									__a			:    Optional[Any]      							=	self.tokenizer(_UpperCAmelCase						,      return_tensors=_UpperCAmelCase						,      **_UpperCAmelCase  )
									return model_inputs







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase  ):
									__a			:    int      							=	self.model(**_UpperCAmelCase  )
									return model_outputs







					def 			_lowerCamelCase		(    self						,      _UpperCAmelCase						,      _UpperCAmelCase=False  ):
									# [0] is the first available tensor, logits or last_hidden_state.
									if return_tensors:
													return model_outputs[0]
									if self.framework == "pt":
													return model_outputs[0].tolist()
									elif self.framework == "tf":
													return model_outputs[0].numpy().tolist()







					def __call__(    self						,      *_UpperCAmelCase						,      **_UpperCAmelCase  ):
									return super().__call__(*_UpperCAmelCase						,      **_UpperCAmelCase  )



'''simple docstring'''





from ..utils import DummyObject, requires_backends




class 				UpperCAmelCase			(			metaclass=_snake_case						):
 UpperCAmelCase				=					["speech"]


 def __init__(      self							:	List[Any]			,       *__lowerCamelCase							:	List[Any]			,       **__lowerCamelCase							:	List[str] ):
    requires_backends(self			,       ['''speech'''] )




class 				UpperCAmelCase			(			metaclass=_snake_case						):
 UpperCAmelCase				=					["speech"]


 def __init__(      self							:	int			,       *__lowerCamelCase							:	List[Any]			,       **__lowerCamelCase							:	List[str] ):
    requires_backends(self			,       ['''speech'''] )



