




'''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  A		(			unittest.TestCase		):




    '''simple docstring'''





    @slow
    @unittest.skip("Model is not available."      )
    def 	a_	(self      )     ->	List[Any]:
       __UpperCamelCase				:      Tuple									=       "nvidia/megatron-gpt2-345m/"
       if "MYDIR" in os.environ:
          __UpperCamelCase				:      str									=       os.path.join(os.environ["MYDIR"]			,  _UpperCamelCase      )
       __UpperCamelCase				:      int									=       GPTaLMHeadModel.from_pretrained(_UpperCamelCase      )
       model.to(_UpperCamelCase      )
       model.half()

       __UpperCamelCase				:      Any									=       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=_UpperCamelCase			,  dtype=torch.long			,  )

       with torch.no_grad():
          __UpperCamelCase				:      Union[str, Any]									=       model(_UpperCamelCase      ).logits

       __UpperCamelCase				:      List[str]									=       torch.Size((1, 9, 5_0_2_5_7)      )
       self.assertEqual(output.shape			,  _UpperCamelCase      )

       __UpperCamelCase				:      Dict									=       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=_UpperCamelCase			,  dtype=torch.half			,  )

       for i in range(1_9      ):
          __UpperCamelCase		, __UpperCamelCase				:      Union[str, Any]									=       8 * i // 1_7, 2_7_9_2 * i  # along the diagonal
          __UpperCamelCase		, __UpperCamelCase				:      List[Any]									=       output[0, r, c], expected_diag[i]
          __UpperCamelCase				:      List[str]									=       f"row={r} col={c} computed={computed} expected={expected}"
          self.assertAlmostEqual(_UpperCamelCase			,  _UpperCamelCase			,  delta=1E-4			,  msg=_UpperCamelCase      )









'''simple docstring'''






def       __lowerCAmelCase (   snake_case__ = 4_000_000						):
			__UpperCamelCase				:      Tuple									=       1
			__UpperCamelCase				:      int									=       2
			__UpperCamelCase				:      str									=       0
			while j <= n:
						if j % 2 == 0:
									total += j
						__UpperCamelCase		, __UpperCamelCase				:      List[Any]									=       j, i + j

			return total


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



