





'''simple docstring'''


import math
import unittest

from transformers import BioGptConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
 import torch

 from transformers import (
     BioGptForCausalLM,
     BioGptForSequenceClassification,
     BioGptForTokenClassification,
     BioGptModel,
     BioGptTokenizer,
 )
 from transformers.models.biogpt.modeling_biogpt import BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST
class 				a_       :





     def __init__(			self		: str     ,				lowercase		: Union[str, Any]     ,				lowercase		: Dict=13     ,				lowercase		: Union[str, Any]=7     ,				lowercase		: Union[str, Any]=True     ,				lowercase		: Any=True     ,				lowercase		: Union[str, Any]=False     ,				lowercase		: Dict=True     ,				lowercase		: Optional[Any]=99     ,				lowercase		: List[str]=32     ,				lowercase		: List[str]=5     ,				lowercase		: List[str]=4     ,				lowercase		: List[Any]=37     ,				lowercase		: Tuple="gelu"     ,				lowercase		: Optional[Any]=0.1     ,				lowercase		: List[str]=0.1     ,				lowercase		: Optional[Any]=512     ,				lowercase		: int=16     ,				lowercase		: Optional[Any]=2     ,				lowercase		: Dict=0.02     ,				lowercase		: Tuple=3     ,				lowercase		: List[Any]=4     ,				lowercase		: Optional[Any]=None     ,				):





        """simple docstring"""




        lowercase_      :Optional[Any]         =			parent
        lowercase_      :Union[str, Any]         =			batch_size
        lowercase_      :List[Any]         =			seq_length
        lowercase_      :List[Any]         =			is_training
        lowercase_      :Optional[Any]         =			use_input_mask
        lowercase_      :List[Any]         =			use_token_type_ids
        lowercase_      :int         =			use_labels
        lowercase_      :Optional[Any]         =			vocab_size
        lowercase_      :int         =			hidden_size
        lowercase_      :List[str]         =			num_hidden_layers
        lowercase_      :Any         =			num_attention_heads
        lowercase_      :Dict         =			intermediate_size
        lowercase_      :Tuple         =			hidden_act
        lowercase_      :Dict         =			hidden_dropout_prob
        lowercase_      :Optional[int]         =			attention_probs_dropout_prob
        lowercase_      :Optional[int]         =			max_position_embeddings
        lowercase_      :Dict         =			type_vocab_size
        lowercase_      :List[Any]         =			type_sequence_label_size
        lowercase_      :Optional[Any]         =			initializer_range
        lowercase_      :Optional[int]         =			num_labels
        lowercase_      :Optional[Any]         =			num_choices
        lowercase_      :Optional[Any]         =			scope





     def 							lowercase__				(			self		: Tuple						):





        """simple docstring"""




        lowercase_      :List[Any]         =			ids_tensor([self.batch_size, self.seq_length]     ,				self.vocab_size						)

        lowercase_      :Optional[Any]         =			None
        if self.use_input_mask:
           lowercase_      :Union[str, Any]         =			random_attention_mask([self.batch_size, self.seq_length]						)

        lowercase_      :Dict         =			None
        if self.use_token_type_ids:
           lowercase_      :Any         =			ids_tensor([self.batch_size, self.seq_length]     ,				self.type_vocab_size						)

        lowercase_      :Tuple         =			None
        lowercase_      :List[Any]         =			None
        lowercase_      :Dict         =			None
        if self.use_labels:
           lowercase_      :Tuple         =			ids_tensor([self.batch_size]     ,				self.type_sequence_label_size						)
           lowercase_      :Optional[int]         =			ids_tensor([self.batch_size, self.seq_length]     ,				self.num_labels						)
           lowercase_      :List[str]         =			ids_tensor([self.batch_size]     ,				self.num_choices						)

        lowercase_      :Dict         =			self.get_config()

        return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels





     def 							lowercase__				(			self		: Tuple						):





        """simple docstring"""




        return BioGptConfig(
            vocab_size=self.vocab_size     ,				hidden_size=self.hidden_size     ,				num_hidden_layers=self.num_hidden_layers     ,				num_attention_heads=self.num_attention_heads     ,				intermediate_size=self.intermediate_size     ,				hidden_act=self.hidden_act     ,				hidden_dropout_prob=self.hidden_dropout_prob     ,				attention_probs_dropout_prob=self.attention_probs_dropout_prob     ,				max_position_embeddings=self.max_position_embeddings     ,				type_vocab_size=self.type_vocab_size     ,				is_decoder=lowercase     ,				initializer_range=self.initializer_range     ,				)





     def 							lowercase__				(			self		: Tuple     ,				lowercase		: Tuple     ,				lowercase		: str     ,				lowercase		: str     ,				lowercase		: str     ,				lowercase		: Optional[Any]     ,				lowercase		: Dict     ,				lowercase		: Union[str, Any]						):





        """simple docstring"""




        lowercase_      :Union[str, Any]         =			BioGptModel(config=lowercase						)
        model.to(lowercase						)
        model.eval()
        lowercase_      :int         =			model(lowercase     ,				attention_mask=lowercase						)
        lowercase_      :str         =			model(lowercase						)
        self.parent.assertEqual(result.last_hidden_state.shape     ,				(self.batch_size, self.seq_length, self.hidden_size)						)





     def 							lowercase__				(			self		: Any     ,				lowercase		: List[Any]     ,				lowercase		: List[str]     ,				lowercase		: Dict     ,				lowercase		: int     ,				lowercase		: Union[str, Any]     ,				lowercase		: List[str]     ,				lowercase		: int     ,				lowercase		: Any     ,				lowercase		: Any     ,				):





        """simple docstring"""




        lowercase_      :List[Any]         =			BioGptForCausalLM(config=lowercase						)
        model.to(lowercase						)
        model.eval()
        lowercase_      :Tuple         =			model(lowercase     ,				attention_mask=lowercase     ,				token_type_ids=lowercase     ,				labels=lowercase						)
        self.parent.assertEqual(result.logits.shape     ,				(self.batch_size, self.seq_length, self.vocab_size)						)





     def 							lowercase__				(			self		: Any     ,				lowercase		: List[Any]     ,				lowercase		: int     ,				lowercase		: Dict     ,				lowercase		: Optional[Any]     ,				lowercase		: List[str]     ,				*lowercase		: Optional[int]						):





        """simple docstring"""




        lowercase_      :List[Any]         =			BioGptModel(config=lowercase						)
        model.to(lowercase						)
        model.eval()

        # create attention mask
        lowercase_      :int         =			torch.ones(input_ids.shape     ,				dtype=torch.long     ,				device=lowercase						)
        lowercase_      :Optional[int]         =			self.seq_length // 2
        lowercase_      :Union[str, Any]         =			0

        # first forward pass
        lowercase_      ,							lowercase_      :int         =			model(lowercase     ,				attention_mask=lowercase						).to_tuple()

        # create hypothetical next token and extent to next_input_ids
        lowercase_      :Any         =			ids_tensor((self.batch_size, 1)     ,				config.vocab_size						)

        # change a random masked slice from input_ids
        lowercase_      :Dict         =			ids_tensor((1,)     ,				lowercase						).item() + 1
        lowercase_      :Union[str, Any]         =			ids_tensor((self.batch_size, 1)     ,				config.vocab_size						).squeeze(-1						)
        lowercase_      :Tuple         =			random_other_next_tokens

        # append to next input_ids and attn_mask
        lowercase_      :Optional[int]         =			torch.cat([input_ids, next_tokens]     ,				dim=-1						)
        lowercase_      :Dict         =			torch.cat(
            [attn_mask, torch.ones((attn_mask.shape[0], 1)     ,				dtype=torch.long     ,				device=lowercase						)]     ,				dim=1     ,				)

        # get two different outputs
        lowercase_      :List[str]         =			model(lowercase     ,				attention_mask=lowercase						)["last_hidden_state"]
        lowercase_      :Optional[Any]         =			model(lowercase     ,				past_key_values=lowercase     ,				attention_mask=lowercase						)["last_hidden_state"]

        # select random slice
        lowercase_      :List[Any]         =			ids_tensor((1,)     ,				output_from_past.shape[-1]						).item()
        lowercase_      :str         =			output_from_no_past[:, -1, random_slice_idx].detach()
        lowercase_      :Dict         =			output_from_past[:, 0, random_slice_idx].detach()

        # test that outputs are equal for slice
        self.parent.assertTrue(torch.allclose(lowercase     ,				lowercase     ,				atol=1e-3						)						)





     def 							lowercase__				(			self		: List[str]     ,				lowercase		: Optional[int]     ,				lowercase		: Union[str, Any]     ,				lowercase		: int     ,				lowercase		: str     ,				lowercase		: List[Any]     ,				*lowercase		: Any						):





        """simple docstring"""




        lowercase_      :Union[str, Any]         =			BioGptModel(config=lowercase						).to(lowercase						).eval()

        lowercase_      :List[str]         =			torch.ones(input_ids.shape     ,				dtype=torch.long     ,				device=lowercase						)

        # first forward pass
        lowercase_      :List[Any]         =			model(lowercase     ,				attention_mask=lowercase     ,				use_cache=lowercase						)

        lowercase_      ,							lowercase_      :Any         =			outputs.to_tuple()

        # create hypothetical multiple next token and extent to next_input_ids
        lowercase_      :List[str]         =			ids_tensor((self.batch_size, 3)     ,				config.vocab_size						)
        lowercase_      :List[Any]         =			ids_tensor((self.batch_size, 3)     ,				2						)

        # append to next input_ids and
        lowercase_      :str         =			torch.cat([input_ids, next_tokens]     ,				dim=-1						)
        lowercase_      :Tuple         =			torch.cat([attention_mask, next_attn_mask]     ,				dim=-1						)

        lowercase_      :Dict         =			model(lowercase     ,				attention_mask=lowercase						)["last_hidden_state"]
        lowercase_      :Optional[int]         =			model(lowercase     ,				attention_mask=lowercase     ,				past_key_values=lowercase						)[
            "last_hidden_state"
        ]

        # select random slice
        lowercase_      :int         =			ids_tensor((1,)     ,				output_from_past.shape[-1]						).item()
        lowercase_      :Union[str, Any]         =			output_from_no_past[:, -3:, random_slice_idx].detach()
        lowercase_      :List[Any]         =			output_from_past[:, :, random_slice_idx].detach()

        self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]						)

        # test that outputs are equal for slice
        self.parent.assertTrue(torch.allclose(lowercase     ,				lowercase     ,				atol=1e-3						)						)





     def 							lowercase__				(			self		: List[str]     ,				lowercase		: Tuple     ,				lowercase		: Tuple     ,				lowercase		: Union[str, Any]     ,				lowercase		: Dict     ,				lowercase		: Tuple     ,				*lowercase		: List[Any]     ,				lowercase		: Optional[int]=False						):





        """simple docstring"""




        lowercase_      :int         =			BioGptForCausalLM(lowercase						)
        model.to(lowercase						)
        if gradient_checkpointing:
           model.gradient_checkpointing_enable()

        lowercase_      :Any         =			model(lowercase     ,				labels=lowercase						)
        self.parent.assertEqual(result.loss.shape     ,				()						)
        self.parent.assertEqual(result.logits.shape     ,				(self.batch_size, self.seq_length, self.vocab_size)						)
        result.loss.backward()





     def 							lowercase__				(			self		: List[Any]     ,				lowercase		: Tuple     ,				*lowercase		: Optional[int]						):





        """simple docstring"""




        lowercase_      :Dict         =			BioGptModel(lowercase						)
        lowercase_      :Optional[Any]         =			model.config.initializer_range / math.sqrt(2 * model.config.num_hidden_layers						)
        for key in model.state_dict().keys():
           if "c_proj" in key and "weight" in key:
              self.parent.assertLessEqual(abs(torch.std(model.state_dict()[key]						) - model_std						)     ,				0.0_01						)
              self.parent.assertLessEqual(abs(torch.mean(model.state_dict()[key]						) - 0.0						)     ,				0.01						)





     def 							lowercase__				(			self		: Any     ,				lowercase		: List[Any]     ,				lowercase		: int     ,				lowercase		: Tuple     ,				lowercase		: List[str]     ,				lowercase		: List[Any]     ,				*lowercase		: Tuple						):





        """simple docstring"""




        lowercase_      :str         =			self.num_labels
        lowercase_      :Any         =			BioGptForTokenClassification(lowercase						)
        model.to(lowercase						)
        model.eval()
        lowercase_      :str         =			model(lowercase     ,				attention_mask=lowercase     ,				token_type_ids=lowercase						)
        self.parent.assertEqual(result.logits.shape     ,				(self.batch_size, self.seq_length, self.num_labels)						)







     def 							lowercase__				(			self		: Optional[int]						):





        """simple docstring"""




        lowercase_      :str         =			self.prepare_config_and_inputs()
        (
            (
            lowercase_
        )      ,							(
            lowercase_
        )      ,							(
            lowercase_
        )      ,							(
            lowercase_
        )      ,							(
            lowercase_
        )      ,							(
            lowercase_
        )      ,							(
            lowercase_
        )      ,							
        )      :Dict         =			config_and_inputs
        lowercase_      :str         =			{"input_ids": input_ids, "attention_mask": input_mask}
        return config, inputs_dict







@require_torch
class 				a_       (    _lowerCAmelCase     ,						_lowerCAmelCase     ,						_lowerCAmelCase     ,						unittest.TestCase							):
     __A								=      (
         (BioGptModel, BioGptForCausalLM, BioGptForSequenceClassification, BioGptForTokenClassification)
         if is_torch_available()
         else ()
     )
     __A								=      (BioGptForCausalLM,) if is_torch_available() else ()
     __A								=      (
         {
             "feature-extraction": BioGptModel,
             "text-classification": BioGptForSequenceClassification,
             "text-generation": BioGptForCausalLM,
             "token-classification": BioGptForTokenClassification,
             "zero-shot": BioGptForSequenceClassification,
         }
         if is_torch_available()
         else {}
     )
     __A								=      False





     def 							lowercase__				(			self		: List[str]						):





        """simple docstring"""




        lowercase_      :Tuple         =			BioGptModelTester(self						)
        lowercase_      :Tuple         =			ConfigTester(self     ,				config_class=lowercase     ,				hidden_size=37						)





     def 							lowercase__				(			self		: int						):





        """simple docstring"""




        self.config_tester.run_common_tests()





     def 							lowercase__				(			self		: Tuple						):





        """simple docstring"""




        lowercase_      :List[Any]         =			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_model(*lowercase						)





     def 							lowercase__				(			self		: List[str]						):





        """simple docstring"""




        lowercase_      :Tuple         =			self.model_tester.prepare_config_and_inputs()
        for type in ["absolute", "relative_key", "relative_key_query"]:
           lowercase_      :List[str]         =			type
           self.model_tester.create_and_check_model(*lowercase						)





     def 							lowercase__				(			self		: Dict						):





        """simple docstring"""




        lowercase_      :Tuple         =			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_biogpt_model_attention_mask_past(*lowercase						)





     def 							lowercase__				(			self		: Tuple						):





        """simple docstring"""




        lowercase_      :List[Any]         =			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_forward_and_backwards(*lowercase     ,				gradient_checkpointing=lowercase						)





     def 							lowercase__				(			self		: str						):





        """simple docstring"""




        lowercase_      :Any         =			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_biogpt_model_past_large_inputs(*lowercase						)





     def 							lowercase__				(			self		: Any						):





        """simple docstring"""




        lowercase_      :List[str]         =			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_biogpt_weight_initialization(*lowercase						)





     def 							lowercase__				(			self		: Tuple						):





        """simple docstring"""




        lowercase_      :Any         =			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_biogpt_for_token_classification(*lowercase						)





     @slow
     def 							lowercase__				(			self		: Optional[Any]						):





        """simple docstring"""




        lowercase_      :str         =			BioGptForCausalLM.from_pretrained("microsoft/biogpt"						)
        model.to(lowercase						)
        lowercase_      :Dict         =			BioGptTokenizer.from_pretrained("microsoft/biogpt"						)

        lowercase_      :Optional[Any]         =			"left"

        # Define PAD Token = EOS Token = 50256
        lowercase_      :Tuple         =			tokenizer.eos_token
        lowercase_      :Optional[Any]         =			model.config.eos_token_id

        # use different length sentences to test batching
        lowercase_      :List[Any]         =			[
            "Hello, my dog is a little",
            "Today, I",
        ]

        lowercase_      :Tuple         =			tokenizer(lowercase     ,				return_tensors="pt"     ,				padding=lowercase						)
        lowercase_      :str         =			inputs["input_ids"].to(lowercase						)

        lowercase_      :Optional[Any]         =			model.generate(
            input_ids=lowercase     ,				attention_mask=inputs["attention_mask"].to(lowercase						)     ,				)

        lowercase_      :Optional[int]         =			tokenizer(sentences[0]     ,				return_tensors="pt"						).input_ids.to(lowercase						)
        lowercase_      :List[Any]         =			model.generate(input_ids=lowercase						)

        lowercase_      :Union[str, Any]         =			inputs_non_padded.shape[-1] - inputs["attention_mask"][-1].long().sum().cpu().item()
        lowercase_      :int         =			tokenizer(sentences[1]     ,				return_tensors="pt"						).input_ids.to(lowercase						)
        lowercase_      :Union[str, Any]         =			model.generate(input_ids=lowercase     ,				max_length=model.config.max_length - num_paddings						)

        lowercase_      :List[str]         =			tokenizer.batch_decode(lowercase     ,				skip_special_tokens=lowercase						)
        lowercase_      :Optional[Any]         =			tokenizer.decode(output_non_padded[0]     ,				skip_special_tokens=lowercase						)
        lowercase_      :List[Any]         =			tokenizer.decode(output_padded[0]     ,				skip_special_tokens=lowercase						)

        lowercase_      :List[str]         =			[
            "Hello, my dog is a little bit bigger than a little bit.",
            "Today, I have a good idea of how to use the information",
        ]
        self.assertListEqual(lowercase     ,				lowercase						)
        self.assertListEqual(lowercase     ,				[non_padded_sentence, padded_sentence]						)





     @slow
     def 							lowercase__				(			self		: Dict						):





        """simple docstring"""




        for model_name in BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
           lowercase_      :List[str]         =			BioGptModel.from_pretrained(lowercase						)
           self.assertIsNotNone(lowercase						)





     def 							lowercase__				(			self		: Optional[int]						):





        """simple docstring"""




        lowercase_      ,							lowercase_      :Tuple         =			self.model_tester.prepare_config_and_inputs_for_common()
        lowercase_      :Dict         =			3
        lowercase_      :Dict         =			input_dict["input_ids"]
        lowercase_      :Union[str, Any]         =			input_ids.ne(1						).to(lowercase						)
        lowercase_      :List[Any]         =			ids_tensor([self.model_tester.batch_size]     ,				self.model_tester.type_sequence_label_size						)
        lowercase_      :str         =			BioGptForSequenceClassification(lowercase						)
        model.to(lowercase						)
        model.eval()
        lowercase_      :Any         =			model(lowercase     ,				attention_mask=lowercase     ,				labels=lowercase						)
        self.assertEqual(result.logits.shape     ,				(self.model_tester.batch_size, self.model_tester.num_labels)						)







     def 							lowercase__				(			self		: Tuple						):





        """simple docstring"""




        lowercase_      ,							lowercase_      :Union[str, Any]         =			self.model_tester.prepare_config_and_inputs_for_common()
        lowercase_      :Union[str, Any]         =			3
        lowercase_      :Optional[int]         =			"multi_label_classification"
        lowercase_      :Optional[int]         =			input_dict["input_ids"]
        lowercase_      :List[str]         =			input_ids.ne(1						).to(lowercase						)
        lowercase_      :str         =			ids_tensor(
            [self.model_tester.batch_size, config.num_labels]     ,				self.model_tester.type_sequence_label_size						).to(torch.float						)
        lowercase_      :int         =			BioGptForSequenceClassification(lowercase						)
        model.to(lowercase						)
        model.eval()
        lowercase_      :List[Any]         =			model(lowercase     ,				attention_mask=lowercase     ,				labels=lowercase						)
        self.assertEqual(result.logits.shape     ,				(self.model_tester.batch_size, self.model_tester.num_labels)						)







@require_torch
class 				a_       (    unittest.TestCase							):





     @slow
     def 							lowercase__				(			self		: Optional[int]						):





        """simple docstring"""




        lowercase_      :str         =			BioGptForCausalLM.from_pretrained("microsoft/biogpt"						)
        lowercase_      :Optional[int]         =			torch.tensor([[2, 4_805, 9, 656, 21]]						)
        lowercase_      :Dict         =			model(lowercase						)[0]

        lowercase_      :int         =			42_384

        lowercase_      :Tuple         =			torch.Size((1, 5, vocab_size)						)
        self.assertEqual(output.shape     ,				lowercase						)

        lowercase_      :Union[str, Any]         =			torch.tensor(
            [[[-9.52_36, -9.89_18, 10.45_57], [-11.04_69, -9.64_23, 8.10_22], [-8.86_64, -7.88_26, 5.53_25]]]						)

        self.assertTrue(torch.allclose(output[:, :3, :3]     ,				lowercase     ,				atol=1e-4						)						)







     @slow
     def 							lowercase__				(			self		: Dict						):





        """simple docstring"""




        lowercase_      :str         =			BioGptTokenizer.from_pretrained("microsoft/biogpt"						)
        lowercase_      :List[Any]         =			BioGptForCausalLM.from_pretrained("microsoft/biogpt"						)
        model.to(lowercase						)

        torch.manual_seed(0						)
        lowercase_      :int         =			tokenizer("COVID-19 is"     ,				return_tensors="pt"						).to(lowercase						)
        lowercase_      :int         =			model.generate(
            **lowercase     ,				min_length=100     ,				max_length=1_024     ,				num_beams=5     ,				early_stopping=lowercase     ,				)
        lowercase_      :str         =			tokenizer.decode(output_ids[0]     ,				skip_special_tokens=lowercase						)

        lowercase_      :Union[str, Any]         =			(
            "COVID-19 is a global pandemic caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2), the"
            " causative agent of coronavirus disease 2019 (COVID-19), which has spread to more than 200 countries and"
            " territories, including the United States (US), Canada, Australia, New Zealand, the United Kingdom (UK),"
            " and the United States of America (USA), as of March 11, 2020, with more than 800,000 confirmed cases and"
            " more than 800,000 deaths."
        )
        self.assertEqual(lowercase     ,				lowercase						)









'''simple docstring'''


import sys

lowerCAmelCase :					List[Any] 							=(
    '''73167176531330624919225119674426574742355349194934'''
    '''96983520312774506326239578318016984801869478851843'''
    '''85861560789112949495459501737958331952853208805511'''
    '''12540698747158523863050715693290963295227443043557'''
    '''66896648950445244523161731856403098711121722383113'''
    '''62229893423380308135336276614282806444486645238749'''
    '''30358907296290491560440772390713810515859307960866'''
    '''70172427121883998797908792274921901699720888093776'''
    '''65727333001053367881220235421809751254540594752243'''
    '''52584907711670556013604839586446706324415722155397'''
    '''53697817977846174064955149290862569321978468622482'''
    '''83972241375657056057490261407972968652414535100474'''
    '''82166370484403199890008895243450658541227588666881'''
    '''16427171479924442928230863465674813919123162824586'''
    '''17866458359124566529476545682848912883142607690042'''
    '''24219022671055626321111109370544217506941658960408'''
    '''07198403850962455444362981230987879927244284909188'''
    '''84580156166097919133875499200524063689912560717606'''
    '''05886116467109405077541002256983155200055935729725'''
    '''71636269561882670428252483600823257530420752963450'''
)
def 							UpperCAmelCase_  (						__lowerCamelCase : str			):
   lowercase_      :List[str]         =			1
   for digit in s:
      product *= int(__lowerCamelCase			)
   return product
def 							UpperCAmelCase_  (						__lowerCamelCase : str = N			):
   lowercase_      :Any         =			-sys.maxsize - 1
   lowercase_      :int         =			n[:13]
   lowercase_      :Optional[int]         =			13
   while cur_index < len(__lowerCamelCase			) - 13:
      if int(n[cur_index]			) >= int(substr[0]			):
         lowercase_      :str         =			substr[1:] + n[cur_index]
         cur_index += 1
      else:
         lowercase_      :List[str]         =			max(__lowerCamelCase     ,str_eval(__lowerCamelCase			)			)
         lowercase_      :Any         =			n[cur_index : cur_index + 13]
         cur_index += 13
   return largest_product


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


