



"""simple docstring"""







import os
import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
 import torch

 from transformers import GPTaLMHeadModel

@require_torch
@require_sentencepiece
@require_tokenizers
class       UpperCamelCase  (					unittest.TestCase				):





     """simple docstring"""






     @slow
     @unittest.skip('''Model is not available.''' )
     def 						A__  (					self :							Any ):
          A__				=   '''nvidia/megatron-gpt2-345m/'''
          if "MYDIR" in os.environ:
               A__				=   os.path.join(os.environ['''MYDIR''']	,      _lowerCamelCase )
          A__				=   GPTaLMHeadModel.from_pretrained(_lowerCamelCase )
          model.to(_lowerCamelCase )
          model.half()

          A__				=   torch.tensor(
              [[1_0_1, 7_1_1_0, 1_0_0_5, 1_0_5_6, 2_0_2_3, 1_1_3_3_3, 1_7_4_1_3, 1_0_2_9, 1_0_2]]	,      device=_lowerCamelCase	,      dtype=torch.long	,      )

          with torch.no_grad():
               A__				=   model(_lowerCamelCase ).logits

          A__				=   torch.Size((1, 9, 5_0_2_5_7) )
          self.assertEqual(output.shape	,      _lowerCamelCase )

          A__				=   torch.tensor(
              [
                  4.9_414,
                  -0.2_920,
                  -1.2_148,
                  -4.0_273,
                  -0.5_161,
                  -5.2_109,
                  -1.2_412,
                  -1.8_301,
                  -1.7_734,
                  -4.7_148,
                  -0.2_317,
                  -1.0_811,
                  -2.1_777,
                  0.4_141,
                  -3.7_969,
                  -4.0_586,
                  -2.5_332,
                  -3.3_809,
                  4.3_867,
              ]	,      device=_lowerCamelCase	,      dtype=torch.half	,      )

          for i in range(1_9 ):
               A__	,     A__				=   8 * i // 1_7, 2_7_9_2 * i  # along the diagonal
               A__	,     A__				=   output[0, r, c], expected_diag[i]
               A__				=   F'''row={r} col={c} computed={computed} expected={expected}'''
               self.assertAlmostEqual(_lowerCamelCase	,      _lowerCamelCase	,      delta=1E-4	,      msg=_lowerCamelCase )








"""simple docstring"""







from math import factorial



def   a_	(			__a		,							__a      ):
     return factorial(__a      ) / (factorial(__a      ) * factorial(n - r      ))



def   a_	(			):
     A__				=   0

     for i in range(1		,							101      ):
          for j in range(1		,							i + 1      ):
               if combinations(__a		,							__a      ) > 1e6:
                    total += 1
     return total


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



