code: 
  
  
  
  
  
  
  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 ):
  
  
  
  
  
  
  
   @slow
   @unittest.skip("Model is not available."		)
   def       __lowercase      (	self      :     Union[str, Any]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Optional[Any]        =						"nvidia/megatron-gpt2-345m/"
        if "MYDIR" in os.environ:
             UpperCamelCase__    :     Tuple        =						os.path.join(os.environ["MYDIR"]							,     SCREAMING_SNAKE_CASE		)
        UpperCamelCase__    :     Optional[int]        =						GPTaLMHeadModel.from_pretrained(SCREAMING_SNAKE_CASE		)
        model.to(SCREAMING_SNAKE_CASE		)
        model.half()
  
        UpperCamelCase__    :     Dict        =						torch.tensor(
            [[1_01, 71_10, 10_05, 10_56, 20_23, 1_13_33, 1_74_13, 10_29, 1_02]]							,     device=SCREAMING_SNAKE_CASE							,     dtype=torch.long							,     )
  
        with torch.no_grad():
             UpperCamelCase__    :     Optional[Any]        =						model(SCREAMING_SNAKE_CASE		).logits
  
        UpperCamelCase__    :     Optional[int]        =						torch.Size((1, 9, 5_02_57)		)
        self.assertEqual(output.shape							,     SCREAMING_SNAKE_CASE		)
  
        UpperCamelCase__    :     Any        =						torch.tensor(
            [
                4.9_4_1_4,
                -0.2_9_2_0,
                -1.2_1_4_8,
                -4.0_2_7_3,
                -0.5_1_6_1,
                -5.2_1_0_9,
                -1.2_4_1_2,
                -1.8_3_0_1,
                -1.7_7_3_4,
                -4.7_1_4_8,
                -0.2_3_1_7,
                -1.0_8_1_1,
                -2.1_7_7_7,
                0.4_1_4_1,
                -3.7_9_6_9,
                -4.0_5_8_6,
                -2.5_3_3_2,
                -3.3_8_0_9,
                4.3_8_6_7,
            ]							,     device=SCREAMING_SNAKE_CASE							,     dtype=torch.half							,     )
  
        for i in range(19		):
             UpperCamelCase__       ,  UpperCamelCase__    :     Dict        =						8 * i // 17, 27_92 * i  # along the diagonal
             UpperCamelCase__       ,  UpperCamelCase__    :     List[str]        =						output[0, r, c], expected_diag[i]
             UpperCamelCase__    :     Any        =						F'row={r} col={c} computed={computed} expected={expected}'
             self.assertAlmostEqual(SCREAMING_SNAKE_CASE							,     SCREAMING_SNAKE_CASE							,     delta=1e-4							,     msg=SCREAMING_SNAKE_CASE		)
style_context: 
  
  
  
  
  
  
  from __future__ import annotations
  
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			list[int]:
       if not list_of_ints:
            return []
  
       if min(__lowerCAmelCase    ) < 0:
            raise ValueError("All numbers must be positive"    )
  
       UpperCamelCase__    :     Dict        =						max(len(bin(__lowerCAmelCase    )[2:]    ) for x in list_of_ints    )
       return _msd_radix_sort(__lowerCAmelCase      ,					__lowerCAmelCase    )
  
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase      ,					__lowerCAmelCase    )				->			list[int]:
       if bit_position == 0 or len(__lowerCAmelCase    ) in [0, 1]:
            return list_of_ints
  
       UpperCamelCase__    :     Union[str, Any]        =						[]
       UpperCamelCase__    :     Dict        =						[]
       # Split numbers based on bit at bit_position from the right
       for number in list_of_ints:
            if (number >> (bit_position - 1)) & 1:
                 # number has a one at bit bit_position
                 ones.append(__lowerCAmelCase    )
            else:
                 # number has a zero at bit bit_position
                 zeros.append(__lowerCAmelCase    )
  
      # recursively split both lists further
       UpperCamelCase__    :     str        =						_msd_radix_sort(__lowerCAmelCase      ,					bit_position - 1    )
       UpperCamelCase__    :     Optional[Any]        =						_msd_radix_sort(__lowerCAmelCase      ,					bit_position - 1    )
  
       # recombine lists
       UpperCamelCase__    :     Optional[int]        =						zeros
       res.extend(__lowerCAmelCase    )
  
       return res
  
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			Dict:
       UpperCamelCase__    :     Optional[int]        =						len(__lowerCAmelCase    )
       if not list_of_ints or length == 1:
            return
  
       if min(__lowerCAmelCase    ) < 0:
            raise ValueError("All numbers must be positive"    )
  
       UpperCamelCase__    :     int        =						max(len(bin(__lowerCAmelCase    )[2:]    ) for x in list_of_ints    )
       _msd_radix_sort_inplace(__lowerCAmelCase      ,					__lowerCAmelCase      ,					0      ,					__lowerCAmelCase    )
  
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase    )				->			List[str]:
       if bit_position == 0 or end_index - begin_index <= 1:
            return
  
       bit_position -= 1
  
       UpperCamelCase__    :     Any        =						begin_index
       UpperCamelCase__    :     List[str]        =						end_index - 1
       while i <= j:
            UpperCamelCase__    :     Tuple        =						False
            if not (list_of_ints[i] >> bit_position) & 1:
                 # found zero at the beginning
                 i += 1
                 UpperCamelCase__    :     Any        =						True
            if (list_of_ints[j] >> bit_position) & 1:
                 # found one at the end
                 j -= 1
                 UpperCamelCase__    :     Dict        =						True
  
            if changed:
                 continue
  
            UpperCamelCase__       ,  UpperCamelCase__    :     Any        =						list_of_ints[j], list_of_ints[i]
            j -= 1
            if j != i:
                 i += 1
  
       _msd_radix_sort_inplace(__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase    )
       _msd_radix_sort_inplace(__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase    )
  
  
  if __name__ == "__main__":
   import doctest
  
   doctest.testmod()