



"""simple docstring"""
from collections import OrderedDict
from typing import Any, List, Mapping, Optional

from ... import PreTrainedTokenizer, TensorType, is_torch_available
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSpec
from ...utils import logging


A:   Tuple								=		logging.get_logger(__name__)

A:   int								=		{
    "EleutherAI/gpt-j-6B": "https://huggingface.co/EleutherAI/gpt-j-6B/resolve/main/config.json",
    # See all GPT-J models at https://huggingface.co/models?filter=gpt_j
}



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__ ):
   __lowerCAmelCase  :   Optional[int]						=						'gptj'
   __lowerCAmelCase  :   List[Any]						=						{
       'max_position_embeddings': 'n_positions',
       'hidden_size': 'n_embd',
       'num_attention_heads': 'n_head',
       'num_hidden_layers': 'n_layer',
   }

   def __init__(   self      ,     _SCREAMING_SNAKE_CASE=50400      ,     _SCREAMING_SNAKE_CASE=2048      ,     _SCREAMING_SNAKE_CASE=4096      ,     _SCREAMING_SNAKE_CASE=28      ,     _SCREAMING_SNAKE_CASE=16      ,     _SCREAMING_SNAKE_CASE=64      ,     _SCREAMING_SNAKE_CASE=None      ,     _SCREAMING_SNAKE_CASE="gelu_new"      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=1E-5      ,     _SCREAMING_SNAKE_CASE=0.02      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=50256      ,     _SCREAMING_SNAKE_CASE=50256      ,     _SCREAMING_SNAKE_CASE=False      ,     **_SCREAMING_SNAKE_CASE      ,     )  ->      Dict:





    '''simple docstring'''




    UpperCAmelCase	:					Optional[Any]	=	vocab_size
    UpperCAmelCase	:					Union[str, Any]	=	n_positions
    UpperCAmelCase	:					Tuple	=	n_embd
    UpperCAmelCase	:					Optional[int]	=	n_layer
    UpperCAmelCase	:					str	=	n_head
    UpperCAmelCase	:					str	=	n_inner
    UpperCAmelCase	:					List[str]	=	rotary_dim
    UpperCAmelCase	:					List[Any]	=	activation_function
    UpperCAmelCase	:					Dict	=	resid_pdrop
    UpperCAmelCase	:					Tuple	=	embd_pdrop
    UpperCAmelCase	:					str	=	attn_pdrop
    UpperCAmelCase	:					Tuple	=	layer_norm_epsilon
    UpperCAmelCase	:					str	=	initializer_range
    UpperCAmelCase	:					int	=	use_cache

    UpperCAmelCase	:					int	=	bos_token_id
    UpperCAmelCase	:					Union[str, Any]	=	eos_token_id

    super().__init__(
        bos_token_id=_SCREAMING_SNAKE_CASE      ,     eos_token_id=_SCREAMING_SNAKE_CASE      ,     tie_word_embeddings=_SCREAMING_SNAKE_CASE      ,     **_SCREAMING_SNAKE_CASE						)



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__ ):

   def __init__(   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE = "default"      ,     _SCREAMING_SNAKE_CASE = None      ,     _SCREAMING_SNAKE_CASE = False      ,     )  ->      Optional[Any]:





    '''simple docstring'''




    super().__init__(_SCREAMING_SNAKE_CASE      ,     task=_SCREAMING_SNAKE_CASE      ,     patching_specs=_SCREAMING_SNAKE_CASE      ,     use_past=_SCREAMING_SNAKE_CASE						)
    if not getattr(self._config      ,     """pad_token_id"""      ,     _SCREAMING_SNAKE_CASE						):
     # TODO: how to do that better?
     UpperCAmelCase	:					Optional[Any]	=	0

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





    '''simple docstring'''




    UpperCAmelCase	:					List[str]	=	OrderedDict({"""input_ids""": {0: """batch""", 1: """sequence"""}}						)
    if self.use_past:
     self.fill_with_past_key_values_(_SCREAMING_SNAKE_CASE      ,     direction="""inputs"""						)
     UpperCAmelCase	:					Dict	=	{0: """batch""", 1: """past_sequence + sequence"""}
    else:
     UpperCAmelCase	:					List[str]	=	{0: """batch""", 1: """sequence"""}

    return common_inputs

   @property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    return self._config.n_layer

   @property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    return self._config.n_head

   def 	SCREAMING_SNAKE_CASE     (   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE = -1      ,     _SCREAMING_SNAKE_CASE = -1      ,     _SCREAMING_SNAKE_CASE = False      ,     _SCREAMING_SNAKE_CASE = None      ,     )  ->      Mapping[str, Any]:





    '''simple docstring'''




    UpperCAmelCase	:					Any	=	super(_SCREAMING_SNAKE_CASE      ,     self						).generate_dummy_inputs(
        _SCREAMING_SNAKE_CASE      ,     batch_size=_SCREAMING_SNAKE_CASE      ,     seq_length=_SCREAMING_SNAKE_CASE      ,     is_pair=_SCREAMING_SNAKE_CASE      ,     framework=_SCREAMING_SNAKE_CASE						)

    # We need to order the input in the way they appears in the forward()
    UpperCAmelCase	:					Union[str, Any]	=	OrderedDict({"""input_ids""": common_inputs["""input_ids"""]}						)

    # Need to add the past_keys
    if self.use_past:
     if not is_torch_available():
      raise ValueError("""Cannot generate dummy past_keys inputs without PyTorch installed."""						)
     else:
      import torch

      UpperCAmelCase	,		UpperCAmelCase	:					List[Any]	=	common_inputs["""input_ids"""].shape
      # Not using the same length for past_key_values
      UpperCAmelCase	:					Tuple	=	seqlen + 2
      UpperCAmelCase	:					Dict	=	(
          batch,
          self.num_attention_heads,
          past_key_values_length,
          self._config.hidden_size // self.num_attention_heads,
      )
      UpperCAmelCase	:					List[Any]	=	[
          (torch.zeros(_SCREAMING_SNAKE_CASE						), torch.zeros(_SCREAMING_SNAKE_CASE						)) for _ in range(self.num_layers						)
      ]

    UpperCAmelCase	:					str	=	common_inputs["""attention_mask"""]
    if self.use_past:
     UpperCAmelCase	:					int	=	ordered_inputs["""attention_mask"""].dtype
     UpperCAmelCase	:					Dict	=	torch.cat(
         [ordered_inputs["""attention_mask"""], torch.ones(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     dtype=_SCREAMING_SNAKE_CASE						)]      ,     dim=1						)

    return ordered_inputs




   @property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    return 13





"""simple docstring"""
from collections import defaultdict
from math import ceil, sqrt

def       _snake_case						(						UpperCamelCase						:		int = 1000000			,		UpperCamelCase						:		int = 10						):
 UpperCAmelCase	:					defaultdict	=	defaultdict(UpperCamelCase						)

 for outer_width in range(3			,		(t_limit // 4) + 2						):
  if outer_width * outer_width > t_limit:
   UpperCAmelCase	:					str	=	max(
       ceil(sqrt(outer_width * outer_width - t_limit						)						)			,		1						)
  else:
   UpperCAmelCase	:					Optional[Any]	=	1

  hole_width_lower_bound += (outer_width - hole_width_lower_bound) % 2

  for hole_width in range(UpperCamelCase			,		outer_width - 1			,		2						):
   count[outer_width * outer_width - hole_width * hole_width] += 1

 return sum(1 for n in count.values() if 1 <= n <= 10						)


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