





import unittest

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


if is_torch_available():
							import torch

							from transformers import XLMRobertaModel






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







		@slow
		def        lowercase       (    self				)      ->      Any:


							'''simple docstring'''

							_snake_case       :					List[Any]				       =   XLMRobertaModel.from_pretrained("xlm-roberta-base"				)
							_snake_case       :					int				       =   torch.tensor([[0, 5_8_1, 1_0_2_6_9, 8_3, 9_9_9_4_2, 1_3_6, 6_0_7_4_2, 2_3, 7_0, 8_0_5_8_3, 1_8_2_7_6, 2]]				)
							# The dog is cute and lives in the garden house

							_snake_case       :					str				       =   torch.Size((1, 1_2, 7_6_8)				)  # batch_size, sequence_length, embedding_vector_dim
							_snake_case       :					Tuple				       =   torch.tensor(
							    [[-0.01_01, 0.12_18, -0.08_03, 0.08_01, 0.13_27, 0.07_76, -0.12_15, 0.23_83, 0.33_38, 0.31_06, 0.03_00, 0.02_52]]				)
							#  xlmr = torch.hub.load('pytorch/fairseq', 'xlmr.base')
							#  xlmr.eval()
							#  expected_output_values_last_dim = xlmr.extract_features(input_ids[0])[:, :, -1]
							with torch.no_grad():
												_snake_case       :					List[Any]				       =   model(__snake_case				)["last_hidden_state"].detach()
							self.assertEqual(output.shape ,						__snake_case				)
							# compare the actual values for a slice of last dim
							self.assertTrue(torch.allclose(output[:, :, -1] ,						__snake_case ,						atol=1E-3				)				)







		@slow
		def        lowercase       (    self				)      ->      Tuple:


							'''simple docstring'''

							_snake_case       :					Dict				       =   XLMRobertaModel.from_pretrained("xlm-roberta-large"				)
							_snake_case       :					Dict				       =   torch.tensor([[0, 5_8_1, 1_0_2_6_9, 8_3, 9_9_9_4_2, 1_3_6, 6_0_7_4_2, 2_3, 7_0, 8_0_5_8_3, 1_8_2_7_6, 2]]				)
							# The dog is cute and lives in the garden house

							_snake_case       :					Optional[int]				       =   torch.Size((1, 1_2, 1_0_2_4)				)  # batch_size, sequence_length, embedding_vector_dim
							_snake_case       :					str				       =   torch.tensor(
							    [[-0.06_99, -0.03_18, 0.07_05, -0.12_41, 0.09_99, -0.05_20, 0.10_04, -0.18_38, -0.47_04, 0.14_37, 0.08_21, 0.01_26]]				)
							#  xlmr = torch.hub.load('pytorch/fairseq', 'xlmr.large')
							#  xlmr.eval()
							#  expected_output_values_last_dim = xlmr.extract_features(input_ids[0])[:, :, -1]
							with torch.no_grad():
												_snake_case       :					List[str]				       =   model(__snake_case				)["last_hidden_state"].detach()
							self.assertEqual(output.shape ,						__snake_case				)
							# compare the actual values for a slice of last dim
							self.assertTrue(torch.allclose(output[:, :, -1] ,						__snake_case ,						atol=1E-3				)				)












def    A				(							UpperCAmelCase				):
					return str(UpperCAmelCase				) == str(UpperCAmelCase				)[::-1]







def    A				(							UpperCAmelCase				):
					return int(UpperCAmelCase				) + int(str(UpperCAmelCase				)[::-1]				)







def    A				(							UpperCAmelCase = 10_000				):
					_snake_case       :					Optional[int]				       =   []
					for num in range(1  ,  UpperCAmelCase				):
										_snake_case       :					Optional[Any]				       =   0
										_snake_case       :					Optional[int]				       =   num
										while iterations < 50:
															_snake_case       :					Optional[Any]				       =   sum_reverse(UpperCAmelCase				)
															iterations += 1
															if is_palindrome(UpperCAmelCase				):
																				break
										else:
															lychrel_nums.append(UpperCAmelCase				)
					return len(UpperCAmelCase				)


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