
import enum
import warnings

from ..tokenization_utils import TruncationStrategy
from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging
from .base import PIPELINE_INIT_ARGS, Pipeline


if is_tf_available():
							import tensorflow as tf

							from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING

if is_torch_available():
							from ..models.auto.modeling_auto import MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING

_lowercase			:  Tuple   							=	logging.get_logger(__name__)






class 			lowerCAmelCase__       (  enum.Enum					):
					lowerCAmelCase_					       =					0
					lowerCAmelCase_					       =					1







@add_end_docstrings(lowerCamelCase_					)
class 			lowerCAmelCase__       (  lowerCamelCase_					):
					lowerCAmelCase_					       =					'''generated'''






					def __init__(       self    ,							*__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											super().__init__(*__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		)

											self.check_model_type(
											    TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING
											    if self.framework == '''tf'''
											    else MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING		)






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=None    ,							**__SCREAMING_SNAKE_CASE    ,							):


											"""simple docstring"""





											lowercase_     :					Union[str, Any]													=	{}
											if truncation is not None:
																	lowercase_     :					Any													=	truncation

											lowercase_     :					int													=	generate_kwargs

											lowercase_     :					List[Any]													=	{}
											if return_tensors is not None and return_type is None:
																	lowercase_     :					Optional[int]													=	ReturnType.TENSORS if return_tensors else ReturnType.TEXT
											if return_type is not None:
																	lowercase_     :					Tuple													=	return_type

											if clean_up_tokenization_spaces is not None:
																	lowercase_     :					List[str]													=	clean_up_tokenization_spaces

											if stop_sequence is not None:
																	lowercase_     :					Any													=	self.tokenizer.encode(__SCREAMING_SNAKE_CASE    ,							add_special_tokens=__SCREAMING_SNAKE_CASE		)
																	if len(__SCREAMING_SNAKE_CASE		) > 1:
																							warnings.warn(
																							    '''Stopping on a multiple token sequence is not yet supported on transformers. The first token of'''
																							    ''' the stop sequence will be used as the stop sequence string in the interim.'''		)
																	lowercase_     :					str													=	stop_sequence_ids[0]

											return preprocess_params, forward_params, postprocess_params






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											return True






					def      _snake_case   (       self    ,							*__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											lowercase_     :					str													=	self.model.config.prefix if self.model.config.prefix is not None else ''''''
											if isinstance(args[0]    ,							__SCREAMING_SNAKE_CASE		):
																	if self.tokenizer.pad_token_id is None:
																							raise ValueError('''Please make sure that the tokenizer has a pad_token_id when using a batch input'''		)
																	lowercase_     :					Tuple													=	([prefix + arg for arg in args[0]],)
																	lowercase_     :					List[Any]													=	True

											elif isinstance(args[0]    ,							__SCREAMING_SNAKE_CASE		):
																	lowercase_     :					int													=	(prefix + args[0],)
																	lowercase_     :					List[Any]													=	False
											else:
																	raise ValueError(
																	    F''' `args[0]`: {args[0]} have the wrong format. The should be either of type `str` or type `list`'''		)
											lowercase_     :					Union[str, Any]													=	self.tokenizer(*__SCREAMING_SNAKE_CASE    ,							padding=__SCREAMING_SNAKE_CASE    ,							truncation=__SCREAMING_SNAKE_CASE    ,							return_tensors=self.framework		)
											# This is produced by tokenizers but is an invalid generate kwargs
											if "token_type_ids" in inputs:
																	del inputs["token_type_ids"]
											return inputs






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


											"""simple docstring"""





											lowercase_     :					str													=	super().__call__(*__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		)
											if (
											    isinstance(args[0]    ,							__SCREAMING_SNAKE_CASE		)
											    and all(isinstance(__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE		) for el in args[0]		)
											    and all(len(__SCREAMING_SNAKE_CASE		) == 1 for res in result		)
											):
																	return [res[0] for res in result]
											return result






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE=TruncationStrategy.DO_NOT_TRUNCATE    ,							**__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											lowercase_     :					List[str]													=	self._parse_and_tokenize(__SCREAMING_SNAKE_CASE    ,							truncation=__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		)
											return inputs






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if self.framework == "pt":
																	lowercase_     :					str													=	model_inputs['''input_ids'''].shape
											elif self.framework == "tf":
																	lowercase_     :					List[Any]													=	tf.shape(model_inputs['''input_ids''']		).numpy()

											lowercase_     :					Optional[int]													=	generate_kwargs.get('''min_length'''    ,							self.model.config.min_length		)
											lowercase_     :					str													=	generate_kwargs.get('''max_length'''    ,							self.model.config.max_length		)
											self.check_inputs(__SCREAMING_SNAKE_CASE    ,							generate_kwargs['''min_length''']    ,							generate_kwargs['''max_length''']		)
											lowercase_     :					int													=	self.model.generate(**__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		)
											lowercase_     :					str													=	output_ids.shape[0]
											if self.framework == "pt":
																	lowercase_     :					Optional[Any]													=	output_ids.reshape(__SCREAMING_SNAKE_CASE    ,							out_b // in_b    ,							*output_ids.shape[1:]		)
											elif self.framework == "tf":
																	lowercase_     :					List[str]													=	tf.reshape(__SCREAMING_SNAKE_CASE    ,							(in_b, out_b // in_b, *output_ids.shape[1:])		)
											return {"output_ids": output_ids}






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE=ReturnType.TEXT    ,							__SCREAMING_SNAKE_CASE=False		):


											"""simple docstring"""





											lowercase_     :					Union[str, Any]													=	[]
											for output_ids in model_outputs["output_ids"][0]:
																	if return_type == ReturnType.TENSORS:
																							lowercase_     :					Dict													=	{F'''{self.return_name}_token_ids''': output_ids}
																	elif return_type == ReturnType.TEXT:
																							lowercase_     :					Optional[int]													=	{
																							    F'''{self.return_name}_text''': self.tokenizer.decode(
																							        __SCREAMING_SNAKE_CASE    ,							skip_special_tokens=__SCREAMING_SNAKE_CASE    ,							clean_up_tokenization_spaces=__SCREAMING_SNAKE_CASE    ,							)
																							}
																	records.append(__SCREAMING_SNAKE_CASE		)
											return records







@add_end_docstrings(lowerCamelCase_					)
class 			lowerCAmelCase__       (  lowerCamelCase_					):
					lowerCAmelCase_					       =					'''summary'''






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


											"""simple docstring"""





											return super().__call__(*__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		)






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if max_length < min_length:
																	logger.warning(F'''Your min_length={min_length} must be inferior than your max_length={max_length}.'''		)

											if input_length < max_length:
																	logger.warning(
																	    F'''Your max_length is set to {max_length}, but your input_length is only {input_length}. Since this is '''
																	    '''a summarization task, where outputs shorter than the input are typically wanted, you might '''
																	    F'''consider decreasing max_length manually, e.g. summarizer(\'...\', max_length={input_length//2})'''		)







@add_end_docstrings(lowerCamelCase_					)
class 			lowerCAmelCase__       (  lowerCamelCase_					):
					lowerCAmelCase_					       =					'''translation'''






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if input_length > 0.9 * max_length:
																	logger.warning(
																	    F'''Your input_length: {input_length} is bigger than 0.9 * max_length: {max_length}. You might consider '''
																	    '''increasing your max_length manually, e.g. translator(\'...\', max_length=400)'''		)
											return True






					def      _snake_case   (       self    ,							*__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE=TruncationStrategy.DO_NOT_TRUNCATE    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=None		):


											"""simple docstring"""





											if getattr(self.tokenizer    ,							'''_build_translation_inputs'''    ,							__SCREAMING_SNAKE_CASE		):
																	return self.tokenizer._build_translation_inputs(
																	    *__SCREAMING_SNAKE_CASE    ,							return_tensors=self.framework    ,							truncation=__SCREAMING_SNAKE_CASE    ,							src_lang=__SCREAMING_SNAKE_CASE    ,							tgt_lang=__SCREAMING_SNAKE_CASE		)
											else:
																	return super()._parse_and_tokenize(*__SCREAMING_SNAKE_CASE    ,							truncation=__SCREAMING_SNAKE_CASE		)






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=None    ,							**__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											lowercase_     :					str													=	super()._sanitize_parameters(**__SCREAMING_SNAKE_CASE		)
											if src_lang is not None:
																	lowercase_     :					Optional[Any]													=	src_lang
											if tgt_lang is not None:
																	lowercase_     :					Optional[int]													=	tgt_lang
											if src_lang is None and tgt_lang is None:
																	# Backward compatibility, direct arguments use is preferred.
																	lowercase_     :					Any													=	kwargs.get('''task'''    ,							self.task		)
																	lowercase_     :					Tuple													=	task.split('''_'''		)
																	if task and len(__SCREAMING_SNAKE_CASE		) == 4:
																							# translation, XX, to YY
																							lowercase_     :					int													=	items[1]
																							lowercase_     :					str													=	items[3]
											return preprocess_params, forward_params, postprocess_params






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


											"""simple docstring"""





											return super().__call__(*__SCREAMING_SNAKE_CASE    ,							**__SCREAMING_SNAKE_CASE		)





'''simple docstring'''







import sys

_lowercase			:  Union[str, Any]   							=	(
    "73167176531330624919225119674426574742355349194934"
    "96983520312774506326239578318016984801869478851843"
    "85861560789112949495459501737958331952853208805511"
    "12540698747158523863050715693290963295227443043557"
    "66896648950445244523161731856403098711121722383113"
    "62229893423380308135336276614282806444486645238749"
    "30358907296290491560440772390713810515859307960866"
    "70172427121883998797908792274921901699720888093776"
    "65727333001053367881220235421809751254540594752243"
    "52584907711670556013604839586446706324415722155397"
    "53697817977846174064955149290862569321978468622482"
    "83972241375657056057490261407972968652414535100474"
    "82166370484403199890008895243450658541227588666881"
    "16427171479924442928230863465674813919123162824586"
    "17866458359124566529476545682848912883142607690042"
    "24219022671055626321111109370544217506941658960408"
    "07198403850962455444362981230987879927244284909188"
    "84580156166097919133875499200524063689912560717606"
    "05886116467109405077541002256983155200055935729725"
    "71636269561882670428252483600823257530420752963450"
)
def  snake_case_		(    __SCREAMING_SNAKE_CASE :			str							):



						"""simple docstring"""





						lowercase_     :					Any													=	1
						for digit in s:
												product *= int(__SCREAMING_SNAKE_CASE							)
						return product
def  snake_case_		(    __SCREAMING_SNAKE_CASE :			str = N							):



						"""simple docstring"""





						lowercase_     :					Any													=	-sys.maxsize - 1
						lowercase_     :					List[Any]													=	n[:13]
						lowercase_     :					List[str]													=	13
						while cur_index < len(__SCREAMING_SNAKE_CASE							) - 13:
												if int(n[cur_index]							) >= int(substr[0]							):
																		lowercase_     :					Tuple													=	substr[1:] + n[cur_index]
																		cur_index += 1
												else:
																		lowercase_     :					str													=	max(__SCREAMING_SNAKE_CASE				,				str_eval(__SCREAMING_SNAKE_CASE							)							)
																		lowercase_     :					List[Any]													=	n[cur_index : cur_index + 13]
																		cur_index += 13
						return largest_product


if __name__ == "__main__":
							print(f"""{solution() = }""")



