from collections import OrderedDict
from typing import Any, Mapping, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...feature_extraction_utils import FeatureExtractionMixin
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...tokenization_utils_base import PreTrainedTokenizerBase
from ...utils import TensorType, logging


__magic_name__    		=logging.get_logger(__name__)

__magic_name__    		={
    '''deepmind/language-perceiver''': '''https://huggingface.co/deepmind/language-perceiver/resolve/main/config.json''',
    # See all Perceiver models at https://huggingface.co/models?filter=perceiver
}



class      _A (     a_				):
  SCREAMING_SNAKE_CASE_						:						Optional[Any]    ="perceiver"






  def __init__(self ,					SCREAMING_SNAKE_CASE_=256 ,					SCREAMING_SNAKE_CASE_=1280 ,					SCREAMING_SNAKE_CASE_=768 ,					SCREAMING_SNAKE_CASE_=1 ,					SCREAMING_SNAKE_CASE_=26 ,					SCREAMING_SNAKE_CASE_=8 ,					SCREAMING_SNAKE_CASE_=8 ,					SCREAMING_SNAKE_CASE_=None ,					SCREAMING_SNAKE_CASE_=None ,					SCREAMING_SNAKE_CASE_="kv" ,					SCREAMING_SNAKE_CASE_=1 ,					SCREAMING_SNAKE_CASE_=1 ,					SCREAMING_SNAKE_CASE_="gelu" ,					SCREAMING_SNAKE_CASE_=0.1 ,					SCREAMING_SNAKE_CASE_=0.02 ,					SCREAMING_SNAKE_CASE_=1E-12 ,					SCREAMING_SNAKE_CASE_=True ,					SCREAMING_SNAKE_CASE_=262 ,					SCREAMING_SNAKE_CASE_=2048 ,					SCREAMING_SNAKE_CASE_=56 ,					SCREAMING_SNAKE_CASE_=[368, 496] ,					SCREAMING_SNAKE_CASE_=16 ,					SCREAMING_SNAKE_CASE_=1920 ,					SCREAMING_SNAKE_CASE_=16 ,					SCREAMING_SNAKE_CASE_=[1, 16, 224, 224] ,					**SCREAMING_SNAKE_CASE_ ,					)		->   int:





       '''simple docstring'''





       super().__init__(**__UpperCamelCase						)

       UpperCamelCase__					    =   num_latents
       UpperCamelCase__					    =   d_latents
       UpperCamelCase__					    =   d_model
       UpperCamelCase__					    =   num_blocks
       UpperCamelCase__					    =   num_self_attends_per_block
       UpperCamelCase__					    =   num_self_attention_heads
       UpperCamelCase__					    =   num_cross_attention_heads
       UpperCamelCase__					    =   qk_channels
       UpperCamelCase__					    =   v_channels
       UpperCamelCase__					    =   cross_attention_shape_for_attention
       UpperCamelCase__					    =   self_attention_widening_factor
       UpperCamelCase__					    =   cross_attention_widening_factor
       UpperCamelCase__					    =   hidden_act
       UpperCamelCase__					    =   attention_probs_dropout_prob
       UpperCamelCase__					    =   initializer_range
       UpperCamelCase__					    =   layer_norm_eps
       UpperCamelCase__					    =   use_query_residual
       # masked language modeling attributes
       UpperCamelCase__					    =   vocab_size
       UpperCamelCase__					    =   max_position_embeddings
       # image classification attributes
       UpperCamelCase__					    =   image_size
       # flow attributes
       UpperCamelCase__					    =   train_size
       # multimodal autoencoding attributes
       UpperCamelCase__					    =   num_frames
       UpperCamelCase__					    =   audio_samples_per_frame
       UpperCamelCase__					    =   samples_per_patch
       UpperCamelCase__					    =   output_shape



class      _A (     a_				):






  @property
  def 		_a       (self						)		->   Mapping[str, Mapping[int, str]]:





       '''simple docstring'''





       if self.task == "multiple-choice":
            UpperCamelCase__					    =   {0: '''batch''', 1: '''choice''', 2: '''sequence'''}
       else:
            UpperCamelCase__					    =   {0: '''batch''', 1: '''sequence'''}
       return OrderedDict(
           [
               ('''inputs''', dynamic_axis),
               ('''attention_mask''', dynamic_axis),
           ]						)






  @property
  def 		_a       (self						)		->   float:





       '''simple docstring'''





       return 1E-4






  def 		_a       (self ,					SCREAMING_SNAKE_CASE_ ,					SCREAMING_SNAKE_CASE_ = -1 ,					SCREAMING_SNAKE_CASE_ = -1 ,					SCREAMING_SNAKE_CASE_ = -1 ,					SCREAMING_SNAKE_CASE_ = False ,					SCREAMING_SNAKE_CASE_ = None ,					SCREAMING_SNAKE_CASE_ = 3 ,					SCREAMING_SNAKE_CASE_ = 40 ,					SCREAMING_SNAKE_CASE_ = 40 ,					)		->   Mapping[str, Any]:





       '''simple docstring'''





       if isinstance(__UpperCamelCase ,					__UpperCamelCase						):
            # If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
            UpperCamelCase__					    =   compute_effective_axis_dimension(
                __UpperCamelCase ,					fixed_dimension=OnnxConfig.default_fixed_batch ,					num_token_to_add=0						)
            # If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
            UpperCamelCase__					    =   preprocessor.num_special_tokens_to_add(__UpperCamelCase						)
            UpperCamelCase__					    =   compute_effective_axis_dimension(
                __UpperCamelCase ,					fixed_dimension=OnnxConfig.default_fixed_sequence ,					num_token_to_add=__UpperCamelCase						)
            # Generate dummy inputs according to compute batch and sequence
            UpperCamelCase__					    =   [''' '''.join(['''a''']						) * seq_length] * batch_size
            UpperCamelCase__					    =   dict(preprocessor(__UpperCamelCase ,					return_tensors=__UpperCamelCase						)						)
            UpperCamelCase__					    =   inputs.pop('''input_ids'''						)
            return inputs
       elif isinstance(__UpperCamelCase ,					__UpperCamelCase						) and preprocessor.model_input_names[0] == "pixel_values":
            # If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
            UpperCamelCase__					    =   compute_effective_axis_dimension(__UpperCamelCase ,					fixed_dimension=OnnxConfig.default_fixed_batch						)
            UpperCamelCase__					    =   self._generate_dummy_images(__UpperCamelCase ,					__UpperCamelCase ,					__UpperCamelCase ,					__UpperCamelCase						)
            UpperCamelCase__					    =   dict(preprocessor(images=__UpperCamelCase ,					return_tensors=__UpperCamelCase						)						)
            UpperCamelCase__					    =   inputs.pop('''pixel_values'''						)
            return inputs
       else:
            raise ValueError(
                '''Unable to generate dummy inputs for the model. Please provide a tokenizer or a preprocessor.'''						)











import os

# Precomputes a list of the 100 first triangular numbers
lowerCamelCase      :       str    =						[int(0.5 * n * (n + 1)) for n in range(1, 101)]





def    __lowerCAmelCase   (    ):
     __lowerCAmelCase             =       os.path.dirname(os.path.realpath(__snake_case							)							)
     __lowerCAmelCase             =       os.path.join(__snake_case       ,			"words.txt"							)

     __lowerCAmelCase             =       ""
     with open(__snake_case							) as f:
          __lowerCAmelCase             =       f.readline()

     __lowerCAmelCase             =       [word.strip("\""							) for word in words.strip("\r\n"							).split(","							)]
     __lowerCAmelCase             =       [
         word
         for word in [sum(ord(__snake_case							) - 64 for x in word							) for word in words]
         if word in TRIANGULAR_NUMBERS
     ]
     return len(__snake_case							)


if __name__ == "__main__":
 print(solution())






