





from typing import Dict

from .base import GenericTensor, Pipeline



class     _UpperCAmelCase   (   _UpperCamelCase   ):

		"""simple docstring"""


		def     lowercase		(    self			:		Union[str, Any] ,  lowerCAmelCase_			:		Any=None ,  lowerCAmelCase_			:		int=None ,  lowerCAmelCase_			:		Tuple=None ,  **lowerCAmelCase_			:		Optional[Any]					)							->						Optional[Any]:
					if tokenize_kwargs is None:
								__lowerCAmelCase							     =     {}

					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)'					)
								__lowerCAmelCase							     =     truncation

					__lowerCAmelCase							     =     tokenize_kwargs

					__lowerCAmelCase							     =     {}
					if return_tensors is not None:
								__lowerCAmelCase							     =     return_tensors

					return preprocess_params, {}, postprocess_params






		def     lowercase		(    self			:		List[Any] ,  lowerCAmelCase_			:		Optional[Any] ,  **lowerCAmelCase_			:		str					)							->						Dict[str, GenericTensor]:
					__lowerCAmelCase							     =     self.framework
					__lowerCAmelCase							     =     self.tokenizer(lowerCAmelCase_ ,  return_tensors=lowerCAmelCase_ ,  **lowerCAmelCase_					)
					return model_inputs






		def     lowercase		(    self			:		int ,  lowerCAmelCase_			:		Optional[int]					)							->						int:
					__lowerCAmelCase							     =     self.model(**lowerCAmelCase_					)
					return model_outputs






		def     lowercase		(    self			:		Any ,  lowerCAmelCase_			:		Tuple ,  lowerCAmelCase_			:		int=False					)							->						Tuple:
					# [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			:		Dict ,  *lowerCAmelCase_			:		Dict ,  **lowerCAmelCase_			:		List[str]					)							->						str:
					return super().__call__(*lowerCAmelCase_ ,  **lowerCAmelCase_					)








from functools import lru_cache

@lru_cache
def   a_   (			lowerCAmelCase_				:      int     ):
   if num < 0:
      raise ValueError('Number should not be negative.'     )

   return 1 if num in (0, 1) else num * factorial(num - 1     )


if __name__ == "__main__":
     import doctest

     doctest.testmod()

