





"""simple docstring"""






from __future__ import annotations

import unittest

import numpy as np

from transformers import BlipTextConfig
from transformers.testing_utils import require_tf, slow
from transformers.utils import is_tf_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask


if is_tf_available():
    import tensorflow as tf

    from transformers import TFBlipTextModel
    from transformers.models.blip.modeling_tf_blip import TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST



class 	lowerCAmelCase					:






       def __init__(   self    ,  a__    ,  a__=12    ,  a__=7    ,  a__=True    ,  a__=True    ,  a__=True    ,  a__=99    ,  a__=32    ,  a__=32    ,  a__=2    ,  a__=4    ,  a__=37    ,  a__=0.1    ,  a__=0.1    ,  a__=5_12    ,  a__=0.02    ,  a__=0    ,  a__=None    ,  ):
              _UpperCAmelCase     =     parent
              _UpperCAmelCase     =     batch_size
              _UpperCAmelCase     =     seq_length
              _UpperCAmelCase     =     is_training
              _UpperCAmelCase     =     use_input_mask
              _UpperCAmelCase     =     use_labels
              _UpperCAmelCase     =     vocab_size
              _UpperCAmelCase     =     hidden_size
              _UpperCAmelCase     =     projection_dim
              _UpperCAmelCase     =     num_hidden_layers
              _UpperCAmelCase     =     num_attention_heads
              _UpperCAmelCase     =     intermediate_size
              _UpperCAmelCase     =     dropout
              _UpperCAmelCase     =     attention_dropout
              _UpperCAmelCase     =     max_position_embeddings
              _UpperCAmelCase     =     initializer_range
              _UpperCAmelCase     =     scope
              _UpperCAmelCase     =     bos_token_id






       def 							__A (   self     ):
              _UpperCAmelCase     =     ids_tensor([self.batch_size, self.seq_length]    ,  self.vocab_size     )

              _UpperCAmelCase     =     None
              if self.use_input_mask:
                     _UpperCAmelCase     =     random_attention_mask([self.batch_size, self.seq_length]     )

              if input_mask is not None:
                     _UpperCAmelCase     =     input_mask.numpy()
                     _UpperCAmelCase    ,							_UpperCAmelCase     =     input_mask.shape
                     _UpperCAmelCase     =     np.random.randint(1    ,  seq_length - 1    ,  size=(batch_size,)     )
                     for batch_idx, start_index in enumerate(a__     ):
                            _UpperCAmelCase     =     1
                            _UpperCAmelCase     =     0

              _UpperCAmelCase     =     self.get_config()

              return config, input_ids, tf.convert_to_tensor(a__     )






       def 							__A (   self     ):
              return BlipTextConfig(
                  vocab_size=self.vocab_size    ,  hidden_size=self.hidden_size    ,  projection_dim=self.projection_dim    ,  num_hidden_layers=self.num_hidden_layers    ,  num_attention_heads=self.num_attention_heads    ,  intermediate_size=self.intermediate_size    ,  dropout=self.dropout    ,  attention_dropout=self.attention_dropout    ,  max_position_embeddings=self.max_position_embeddings    ,  initializer_range=self.initializer_range    ,  bos_token_id=self.bos_token_id    ,  )






       def 							__A (   self    ,  a__    ,  a__    ,  a__     ):
              _UpperCAmelCase     =     TFBlipTextModel(config=a__     )
              _UpperCAmelCase     =     model(a__    ,  attention_mask=a__    ,  training=a__     )
              _UpperCAmelCase     =     model(a__    ,  training=a__     )
              self.parent.assertEqual(result.last_hidden_state.shape    ,  (self.batch_size, self.seq_length, self.hidden_size)     )
              self.parent.assertEqual(result.pooler_output.shape    ,  (self.batch_size, self.hidden_size)     )






       def 							__A (   self     ):
              _UpperCAmelCase     =     self.prepare_config_and_inputs()
              _UpperCAmelCase    ,							_UpperCAmelCase    ,							_UpperCAmelCase     =     config_and_inputs
              _UpperCAmelCase     =     {'input_ids': input_ids, 'attention_mask': input_mask}
              return config, inputs_dict



@require_tf
class 	lowerCAmelCase					(      snake_case			,	unittest.TestCase							):
       lowerCAmelCase__						 =  (TFBlipTextModel,) if is_tf_available() else ()
       lowerCAmelCase__						 =  False
       lowerCAmelCase__						 =  False
       lowerCAmelCase__						 =  False






       def 							__A (   self     ):
              _UpperCAmelCase     =     BlipTextModelTester(self     )
              _UpperCAmelCase     =     ConfigTester(self    ,  config_class=a__    ,  hidden_size=37     )






       def 							__A (   self     ):
              self.config_tester.run_common_tests()






       def 							__A (   self     ):
              _UpperCAmelCase     =     self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_model(*a__     )






       def 							__A (   self     ):
              pass






       def 							__A (   self     ):
              pass






       @unittest.skip(reason='Blip does not use inputs_embeds'     )
       def 							__A (   self     ):
              pass






       @unittest.skip(reason='BlipTextModel has no base class and is not available in MODEL_MAPPING'     )
       def 							__A (   self     ):
              pass






       @unittest.skip(reason='BlipTextModel has no base class and is not available in MODEL_MAPPING'     )
       def 							__A (   self     ):
              pass






       @slow
       def 							__A (   self     ):
              for model_name in TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                     _UpperCAmelCase     =     TFBlipTextModel.from_pretrained(a__     )
                     self.assertIsNotNone(a__     )






       def 							__A (   self    ,  a__=True     ):
              super().test_pt_tf_model_equivalence(allow_missing_keys=a__     )













"""simple docstring"""






import sys

lowerCAmelCase_			=							(
    '''73167176531330624919225119674426574742355349194934'''
    '''96983520312774506326239578318016984801869478851843'''
    '''85861560789112949495459501737958331952853208805511'''
    '''12540698747158523863050715693290963295227443043557'''
    '''66896648950445244523161731856403098711121722383113'''
    '''62229893423380308135336276614282806444486645238749'''
    '''30358907296290491560440772390713810515859307960866'''
    '''70172427121883998797908792274921901699720888093776'''
    '''65727333001053367881220235421809751254540594752243'''
    '''52584907711670556013604839586446706324415722155397'''
    '''53697817977846174064955149290862569321978468622482'''
    '''83972241375657056057490261407972968652414535100474'''
    '''82166370484403199890008895243450658541227588666881'''
    '''16427171479924442928230863465674813919123162824586'''
    '''17866458359124566529476545682848912883142607690042'''
    '''24219022671055626321111109370544217506941658960408'''
    '''07198403850962455444362981230987879927244284909188'''
    '''84580156166097919133875499200524063689912560717606'''
    '''05886116467109405077541002256983155200055935729725'''
    '''71636269561882670428252483600823257530420752963450'''
)

def       __lowerCamelCase    (       SCREAMING_SNAKE_CASE							)		->       int:






       """simple docstring"""




       _UpperCAmelCase     =     1
       for digit in s:
              product *= int(SCREAMING_SNAKE_CASE							)
       return product

def       __lowerCamelCase    (       SCREAMING_SNAKE_CASE = N							)		->       int:






       """simple docstring"""




       _UpperCAmelCase     =     -sys.maxsize - 1
       _UpperCAmelCase     =     n[:13]
       _UpperCAmelCase     =     13
       while cur_index < len(SCREAMING_SNAKE_CASE							) - 13:
              if int(n[cur_index]							) >= int(substr[0]							):
                     _UpperCAmelCase     =     substr[1:] + n[cur_index]
                     cur_index += 1
              else:
                     _UpperCAmelCase     =     max(SCREAMING_SNAKE_CASE,str_eval(SCREAMING_SNAKE_CASE							)							)
                     _UpperCAmelCase     =     n[cur_index : cur_index + 13]
                     cur_index += 13
       return largest_product


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






