


'''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


UpperCAmelCase_ :     Any								=      logging.get_logger(__name__)

UpperCAmelCase_ :     Tuple								=      {
    '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 						__magic_name__					(    __lowerCamelCase				):




 '''simple docstring'''
 __lowercase				:		Optional[Any]    							=						'''gptj'''
 __lowercase				:		Any    							=						{
     '''max_position_embeddings''': '''n_positions''',
     '''hidden_size''': '''n_embd''',
     '''num_attention_heads''': '''n_head''',
     '''num_hidden_layers''': '''n_layer''',
 }


 def __init__(      self      ,      __lowercase=50_400      ,      __lowercase=2_048      ,      __lowercase=4_096      ,      __lowercase=28      ,      __lowercase=16      ,      __lowercase=64      ,      __lowercase=None      ,      __lowercase="gelu_new"      ,      __lowercase=0.0      ,      __lowercase=0.0      ,      __lowercase=0.0      ,      __lowercase=1E-5      ,      __lowercase=0.0_2      ,      __lowercase=True      ,      __lowercase=50_256      ,      __lowercase=50_256      ,      __lowercase=False      ,      **__lowercase      ,      ):

  """simple docstring"""







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

  __A  :		int       =			bos_token_id
  __A  :		List[Any]       =			eos_token_id

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


class 						__magic_name__					(    __lowerCamelCase				):




 '''simple docstring'''


 def __init__(      self      ,      __lowercase      ,      __lowercase = "default"      ,      __lowercase = None      ,      __lowercase = False      ,      ):

  """simple docstring"""







  super().__init__(a_      ,      task=a_      ,      patching_specs=a_      ,      use_past=a_						)
  if not getattr(self._config      ,      'pad_token_id'      ,      a_						):
   # TODO: how to do that better?
   __A  :		int       =			0


 @property
 def  snake_case__   (      self						):

  """simple docstring"""







  __A  :		Tuple       =			OrderedDict({'input_ids': {0: 'batch', 1: 'sequence'}}						)
  if self.use_past:
   self.fill_with_past_key_values_(a_      ,      direction='inputs'						)
   __A  :		Optional[Any]       =			{0: "batch", 1: "past_sequence + sequence"}
  else:
   __A  :		Optional[Any]       =			{0: "batch", 1: "sequence"}

  return common_inputs


 @property
 def  snake_case__   (      self						):

  """simple docstring"""







  return self._config.n_layer


 @property
 def  snake_case__   (      self						):

  """simple docstring"""







  return self._config.n_head


 def  snake_case__   (      self      ,      __lowercase      ,      __lowercase = -1      ,      __lowercase = -1      ,      __lowercase = False      ,      __lowercase = None      ,      ):

  """simple docstring"""







  __A  :		str       =			super(a_      ,      self						).generate_dummy_inputs(
      a_      ,      batch_size=a_      ,      seq_length=a_      ,      is_pair=a_      ,      framework=a_						)

  # We need to order the input in the way they appears in the forward()
  __A  :		Dict       =			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

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

  __A  :		Union[str, Any]       =			common_inputs["attention_mask"]
  if self.use_past:
   __A  :		Optional[int]       =			ordered_inputs["attention_mask"].dtype
   __A  :		Any       =			torch.cat(
       [ordered_inputs['attention_mask'], torch.ones(a_      ,      a_      ,      dtype=a_						)]      ,      dim=1						)

  return ordered_inputs







 @property
 def  snake_case__   (      self						):

  """simple docstring"""







  return 13










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


def 			_lowercase       (				UpperCamelCase__       :					int = 1000000,				UpperCamelCase__       :					int = 10			):
 __A  :		defaultdict       =			defaultdict(UpperCamelCase__			)

 for outer_width in range(3,				(t_limit // 4) + 2			):
  if outer_width * outer_width > t_limit:
   __A  :		Optional[int]       =			max(
       ceil(sqrt(outer_width * outer_width - t_limit			)			),				1			)
  else:
   __A  :		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() = }''')






