





'''simple docstring'''


lowerCAmelCase					:     Tuple												=range(2, 20 + 1)
lowerCAmelCase					:     str												=[10**k for k in range(ks[-1] + 1)]
lowerCAmelCase					:     Optional[Any]												={}
def 							UpperCAmelCase_  (						__lowerCamelCase					:					int	,__lowerCamelCase					:					Tuple	,__lowerCamelCase					:					Any	,__lowerCamelCase					:					Union[str, Any] ):
   lowercase_			:Optional[int]    			= sum(a_i[j] for j in range(__snake_case	,len(__snake_case ) ) )
   lowercase_			:str    			= sum(a_i[j] * base[j] for j in range(min(len(__snake_case )	,__snake_case ) ) )

   lowercase_			,							lowercase_			:Dict    			= 0, 0
   lowercase_			:List[str]    			= n - i

   lowercase_			:Dict    			= memo.get(__snake_case )

   if sub_memo is not None:
      lowercase_			:int    			= sub_memo.get(__snake_case )

      if jumps is not None and len(__snake_case ) > 0:
         # find and make the largest jump without going over
         lowercase_			:int    			= -1
         for _k in range(len(__snake_case ) - 1	,-1	,-1 ):
            if jumps[_k][2] <= k and jumps[_k][1] <= max_dn:
               lowercase_			:List[str]    			= _k
               break

         if max_jump >= 0:
            lowercase_			,							lowercase_			,							lowercase_			:Dict    			= jumps[max_jump]
            # since the difference between jumps is cached, add c
            lowercase_			:Optional[int]    			= diff + c
            for j in range(min(__snake_case	,len(__snake_case ) ) ):
               lowercase_			,							lowercase_			:List[Any]    			= divmod(__snake_case	,10 )
            if new_c > 0:
               add(__snake_case	,__snake_case	,__snake_case )

      else:
         lowercase_			:Optional[int]    			= []
   else:
      lowercase_			:List[str]    			= {c: []}
      lowercase_			:List[Any]    			= sub_memo

   if dn >= max_dn or c + diff >= base[k]:
      return diff, dn

   if k > ks[0]:
      while True:
         # keep doing smaller jumps
         lowercase_			,							lowercase_			:Dict    			= next_term(__snake_case	,k - 1	,i + dn	,__snake_case )
         diff += _diff
         dn += terms_jumped

         if dn >= max_dn or c + diff >= base[k]:
            break
   else:
      # would be too small a jump, just compute sequential terms instead
      lowercase_			,							lowercase_			:str    			= compute(__snake_case	,__snake_case	,i + dn	,__snake_case )
      diff += _diff
      dn += terms_jumped

   lowercase_			:Optional[int]    			= sub_memo[c]

   # keep jumps sorted by # of terms skipped
   lowercase_			:Dict    			= 0
   while j < len(__snake_case ):
      if jumps[j][1] > dn:
         break
      j += 1

   # cache the jump for this value digitsum(b) and c
   sub_memo[c].insert(__snake_case	,(diff, dn, k) )
   return (diff, dn)
def 							UpperCAmelCase_  (						__lowerCamelCase					:					Optional[int]	,__lowerCamelCase					:					List[Any]	,__lowerCamelCase					:					int	,__lowerCamelCase					:					str ):







   if i >= n:
      return 0, i
   if k > len(__snake_case ):
      a_i.extend([0 for _ in range(k - len(__snake_case ) )] )

   # note: a_i -> b * 10^k + c
   # ds_b -> digitsum(b)
   # ds_c -> digitsum(c)
   lowercase_			:Any    			= i
   lowercase_			,							lowercase_			,							lowercase_			:Any    			= 0, 0, 0
   for j in range(len(__snake_case ) ):
      if j >= k:
         ds_b += a_i[j]
      else:
         ds_c += a_i[j]

   while i < n:
      i += 1
      lowercase_			:Optional[int]    			= ds_c + ds_b
      diff += addend
      lowercase_			:int    			= 0
      for j in range(__snake_case ):
         lowercase_			:Optional[Any]    			= a_i[j] + addend
         lowercase_			,							lowercase_			:List[str]    			= divmod(__snake_case	,10 )

         ds_c += a_i[j]

      if addend > 0:
         break

   if addend > 0:
      add(__snake_case	,__snake_case	,__snake_case )
   return diff, i - start_i
def 							UpperCAmelCase_  (						__lowerCamelCase					:					Optional[int]	,__lowerCamelCase					:					Any	,__lowerCamelCase					:					Union[str, Any] ):







   for j in range(__snake_case	,len(__snake_case ) ):
      lowercase_			:Tuple    			= digits[j] + addend
      if s >= 10:
         lowercase_			,							lowercase_			:Any    			= divmod(__snake_case	,10 )
         lowercase_			:Optional[Any]    			= addend // 10 + quotient
      else:
         lowercase_			:Any    			= s
         lowercase_			:Dict    			= addend // 10

      if addend == 0:
         break

   while addend > 0:
      lowercase_			,							lowercase_			:Union[str, Any]    			= divmod(__snake_case	,10 )
      digits.append(__snake_case )
def 							UpperCAmelCase_  (						__lowerCamelCase					:					List[Any] = 10**15 ):
   lowercase_			:Dict    			= [1]
   lowercase_			:Dict    			= 1
   lowercase_			:Union[str, Any]    			= 0
   while True:
      lowercase_			,							lowercase_			:Tuple    			= next_term(__snake_case	,20	,i + dn	,__snake_case )
      dn += terms_jumped
      if dn == n - i:
         break

   lowercase_			:Optional[Any]    			= 0
   for j in range(len(__snake_case ) ):
      a_n += digits[j] * 10**j
   return a_n


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









import math
import os
import unittest

from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
			import torch

			from transformers import (
			    MODEL_FOR_PRETRAINING_MAPPING,
			    MegatronBertForCausalLM,
			    MegatronBertForMaskedLM,
			    MegatronBertForMultipleChoice,
			    MegatronBertForNextSentencePrediction,
			    MegatronBertForPreTraining,
			    MegatronBertForQuestionAnswering,
			    MegatronBertForSequenceClassification,
			    MegatronBertForTokenClassification,
			    MegatronBertModel,
			)






class 					__A    :

			'''simple docstring'''







			def __init__(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase=1_3       ,  __lowerCAmelCase=7       ,  __lowerCAmelCase=True       ,  __lowerCAmelCase=True       ,  __lowerCAmelCase=True       ,  __lowerCAmelCase=True       ,  __lowerCAmelCase=9_9       ,  __lowerCAmelCase=6_4       ,  __lowerCAmelCase=3_2       ,  __lowerCAmelCase=5       ,  __lowerCAmelCase=4       ,  __lowerCAmelCase=3_7       ,  __lowerCAmelCase="gelu"       ,  __lowerCAmelCase=0.1       ,  __lowerCAmelCase=0.1       ,  __lowerCAmelCase=5_1_2       ,  __lowerCAmelCase=1_6       ,  __lowerCAmelCase=2       ,  __lowerCAmelCase=0.02       ,  __lowerCAmelCase=3       ,  __lowerCAmelCase=4       ,  __lowerCAmelCase=None       ,  ):



				'''simple docstring'''







				lowerCamelCase__								=		parent
				lowerCamelCase__								=		batch_size
				lowerCamelCase__								=		seq_length
				lowerCamelCase__								=		is_training
				lowerCamelCase__								=		use_input_mask
				lowerCamelCase__								=		use_token_type_ids
				lowerCamelCase__								=		use_labels
				lowerCamelCase__								=		vocab_size
				lowerCamelCase__								=		hidden_size
				lowerCamelCase__								=		embedding_size
				lowerCamelCase__								=		num_hidden_layers
				lowerCamelCase__								=		num_attention_heads
				lowerCamelCase__								=		intermediate_size
				lowerCamelCase__								=		hidden_act
				lowerCamelCase__								=		hidden_dropout_prob
				lowerCamelCase__								=		attention_probs_dropout_prob
				lowerCamelCase__								=		max_position_embeddings
				lowerCamelCase__								=		type_vocab_size
				lowerCamelCase__								=		type_sequence_label_size
				lowerCamelCase__								=		initializer_range
				lowerCamelCase__								=		num_labels
				lowerCamelCase__								=		num_choices
				lowerCamelCase__								=		scope





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		ids_tensor([self.batch_size, self.seq_length]       ,  self.vocab_size							)

				lowerCamelCase__								=		None
				if self.use_input_mask:
					lowerCamelCase__								=		random_attention_mask([self.batch_size, self.seq_length]							)

				lowerCamelCase__								=		None
				if self.use_token_type_ids:
					lowerCamelCase__								=		ids_tensor([self.batch_size, self.seq_length]       ,  self.type_vocab_size							)

				lowerCamelCase__								=		None
				lowerCamelCase__								=		None
				lowerCamelCase__								=		None
				if self.use_labels:
					lowerCamelCase__								=		ids_tensor([self.batch_size]       ,  self.type_sequence_label_size							)
					lowerCamelCase__								=		ids_tensor([self.batch_size, self.seq_length]       ,  self.num_labels							)
					lowerCamelCase__								=		ids_tensor([self.batch_size]       ,  self.num_choices							)

				lowerCamelCase__								=		self.get_config()

				return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				return MegatronBertConfig(
				    vocab_size=self.vocab_size       ,  hidden_size=self.hidden_size       ,  num_hidden_layers=self.num_hidden_layers       ,  num_attention_heads=self.num_attention_heads       ,  intermediate_size=self.intermediate_size       ,  embedding_size=self.embedding_size       ,  hidden_act=self.hidden_act       ,  hidden_dropout_prob=self.hidden_dropout_prob       ,  attention_probs_dropout_prob=self.attention_probs_dropout_prob       ,  max_position_embeddings=self.max_position_embeddings       ,  type_vocab_size=self.type_vocab_size       ,  is_decoder=__lowerCAmelCase       ,  initializer_range=self.initializer_range       ,  )





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		MegatronBertModel(config=__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		model(__lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase							)
				lowerCamelCase__								=		model(__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase							)
				lowerCamelCase__								=		model(__lowerCAmelCase							)

				self.parent.assertEqual(result.last_hidden_state.shape       ,  (self.batch_size, self.seq_length, self.hidden_size)							)
				self.parent.assertEqual(result.pooler_output.shape       ,  (self.batch_size, self.hidden_size)							)





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		MegatronBertForMaskedLM(config=__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		model(__lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase       ,  labels=__lowerCAmelCase							)
				self.parent.assertEqual(result.logits.shape       ,  (self.batch_size, self.seq_length, self.vocab_size)							)





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		MegatronBertForCausalLM(config=__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		model(__lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase       ,  labels=__lowerCAmelCase							)
				self.parent.assertEqual(result.logits.shape       ,  (self.batch_size, self.seq_length, self.vocab_size)							)





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		MegatronBertForNextSentencePrediction(config=__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		model(
				    __lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase       ,  labels=__lowerCAmelCase       ,  )
				self.parent.assertEqual(result.logits.shape       ,  (self.batch_size, 2)							)





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		MegatronBertForPreTraining(config=__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		model(
				    __lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase       ,  labels=__lowerCAmelCase       ,  next_sentence_label=__lowerCAmelCase       ,  )
				self.parent.assertEqual(result.prediction_logits.shape       ,  (self.batch_size, self.seq_length, self.vocab_size)							)
				self.parent.assertEqual(result.seq_relationship_logits.shape       ,  (self.batch_size, 2)							)





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		MegatronBertForQuestionAnswering(config=__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		model(
				    __lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase       ,  start_positions=__lowerCAmelCase       ,  end_positions=__lowerCAmelCase       ,  )
				self.parent.assertEqual(result.start_logits.shape       ,  (self.batch_size, self.seq_length)							)
				self.parent.assertEqual(result.end_logits.shape       ,  (self.batch_size, self.seq_length)							)





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		self.num_labels
				lowerCamelCase__								=		MegatronBertForSequenceClassification(__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		model(__lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase       ,  labels=__lowerCAmelCase							)
				self.parent.assertEqual(result.logits.shape       ,  (self.batch_size, self.num_labels)							)





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		self.num_labels
				lowerCamelCase__								=		MegatronBertForTokenClassification(config=__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		model(__lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase       ,  labels=__lowerCAmelCase							)
				self.parent.assertEqual(result.logits.shape       ,  (self.batch_size, self.seq_length, self.num_labels)							)





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							):



				'''simple docstring'''







				lowerCamelCase__								=		self.num_choices
				lowerCamelCase__								=		MegatronBertForMultipleChoice(config=__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.eval()
				lowerCamelCase__								=		input_ids.unsqueeze(1							).expand(-1       ,  self.num_choices       ,  -1							).contiguous()
				lowerCamelCase__								=		token_type_ids.unsqueeze(1							).expand(-1       ,  self.num_choices       ,  -1							).contiguous()
				lowerCamelCase__								=		input_mask.unsqueeze(1							).expand(-1       ,  self.num_choices       ,  -1							).contiguous()
				lowerCamelCase__								=		model(
				    __lowerCAmelCase       ,  attention_mask=__lowerCAmelCase       ,  token_type_ids=__lowerCAmelCase       ,  labels=__lowerCAmelCase       ,  )
				self.parent.assertEqual(result.logits.shape       ,  (self.batch_size, self.num_choices)							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.prepare_config_and_inputs()
				(
				    (
				    lowerCamelCase__
				)				,	(
				    lowerCamelCase__
				)				,	(
				    lowerCamelCase__
				)				,	(
				    lowerCamelCase__
				)				,	(
				    lowerCamelCase__
				)				,	(
				    lowerCamelCase__
				)				,	(
				    lowerCamelCase__
				)				,	
				)								=		config_and_inputs
				lowerCamelCase__								=		{'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
				return config, inputs_dict






@require_torch
class 					__A    (    lowerCAmelCase			,				lowerCAmelCase			,				unittest.TestCase ):

			'''simple docstring'''







			lowerCAmelCase_							     =						(
			    (
			        MegatronBertModel,
			        MegatronBertForMaskedLM,
			        MegatronBertForCausalLM,
			        MegatronBertForMultipleChoice,
			        MegatronBertForNextSentencePrediction,
			        MegatronBertForPreTraining,
			        MegatronBertForQuestionAnswering,
			        MegatronBertForSequenceClassification,
			        MegatronBertForTokenClassification,
			    )
			    if is_torch_available()
			    else ()
			)
			lowerCAmelCase_							     =						(
			    {
			        """feature-extraction""": MegatronBertModel,
			        """fill-mask""": MegatronBertForMaskedLM,
			        """question-answering""": MegatronBertForQuestionAnswering,
			        """text-classification""": MegatronBertForSequenceClassification,
			        """text-generation""": MegatronBertForCausalLM,
			        """token-classification""": MegatronBertForTokenClassification,
			        """zero-shot""": MegatronBertForSequenceClassification,
			    }
			    if is_torch_available()
			    else {}
			)
			lowerCAmelCase_							     =						True
			# test_resize_embeddings = False
			lowerCAmelCase_							     =						False





			def 		__lowerCamelCase				(    self       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase=False							):



				'''simple docstring'''







				lowerCamelCase__								=		super()._prepare_for_class(__lowerCAmelCase       ,  __lowerCAmelCase       ,  return_labels=__lowerCAmelCase							)

				if return_labels:
					if model_class in get_values(__lowerCAmelCase							):
						lowerCamelCase__								=		torch.zeros(
						    (self.model_tester.batch_size, self.model_tester.seq_length)       ,  dtype=torch.long       ,  device=__lowerCAmelCase							)
						lowerCamelCase__								=		torch.zeros(
						    self.model_tester.batch_size       ,  dtype=torch.long       ,  device=__lowerCAmelCase							)
				return inputs_dict





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		MegatronBertModelTester(self							)
				lowerCamelCase__								=		ConfigTester(self       ,  config_class=__lowerCAmelCase       ,  hidden_size=3_7							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				self.config_tester.run_common_tests()





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_megatron_bert_model(*__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_megatron_bert_for_masked_lm(*__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_megatron_bert_for_multiple_choice(*__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_megatron_bert_for_next_sequence_prediction(*__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_megatron_bert_for_pretraining(*__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_megatron_bert_for_question_answering(*__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_megatron_bert_for_sequence_classification(*__lowerCAmelCase							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_megatron_bert_for_token_classification(*__lowerCAmelCase							)





def lowerCAmelCase__(__snake_case							)				->      List[str]:







	'''simple docstring'''







	return torch.tensor(
	    __snake_case       ,dtype=torch.long       ,device=__snake_case       ,)


_a 						=      1e-4






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

			'''simple docstring'''







			@slow
			@unittest.skip('''Model is not available.'''							)
			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		'''nvidia/megatron-bert-uncased-345m'''
				if "MYDIR" in os.environ:
					lowerCamelCase__								=		os.path.join(os.environ['''MYDIR''']       ,  __lowerCAmelCase							)
				lowerCamelCase__								=		MegatronBertModel.from_pretrained(__lowerCAmelCase							)
				model.to(__lowerCAmelCase							)
				model.half()
				lowerCamelCase__								=		_long_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]]							)
				with torch.no_grad():
					lowerCamelCase__								=		model(__lowerCAmelCase							)[0]
				lowerCamelCase__								=		torch.Size((1, 9, 1_0_2_4)							)
				self.assertEqual(output.shape       ,  __lowerCAmelCase							)

				lowerCamelCase__								=		[-0.6040, -0.2517, -0.1025, 0.3420, -0.6758, -0.0017, -0.1089, -0.1990, 0.5728]
				for ii in range(3							):
					for jj in range(3							):
						lowerCamelCase__								=		output[0, ii, jj]
						lowerCamelCase__								=		expected[3 * ii + jj]
						lowerCamelCase__								=		'''ii={} jj={} a={} b={}'''.format(__lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase       ,  __lowerCAmelCase							)
						self.assertTrue(math.isclose(__lowerCAmelCase       ,  __lowerCAmelCase       ,  rel_tol=__lowerCAmelCase       ,  abs_tol=__lowerCAmelCase							)       ,  msg=__lowerCAmelCase							)



