
"""simple docstring"""

import unittest

from transformers import is_flax_available
from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow


if is_flax_available():
					import optax
					from flax.training.common_utils import onehot

					from transformers import AutoTokenizer, FlaxMTaForConditionalGeneration
					from transformers.models.ta.modeling_flax_ta import shift_tokens_right






@require_torch
@require_sentencepiece
@require_tokenizers
@require_flax
class 	_lowercase       (    unittest.TestCase		):




	@slow
	def       _UpperCamelCase   (			self )		->							str:






			"""simple docstring"""




			lowerCamelCase					:      int          =   FlaxMTaForConditionalGeneration.from_pretrained('google/mt5-small' )
			lowerCamelCase					:      Tuple          =   AutoTokenizer.from_pretrained('google/mt5-small' )

			lowerCamelCase					:      str          =   tokenizer('Hello there'		,			return_tensors='np' ).input_ids
			lowerCamelCase					:      int          =   tokenizer('Hi I am'		,			return_tensors='np' ).input_ids

			lowerCamelCase					:      Any          =   shift_tokens_right(__lowerCAmelCase		,			model.config.pad_token_id		,			model.config.decoder_start_token_id )

			lowerCamelCase					:      Tuple          =   model(__lowerCAmelCase		,			decoder_input_ids=__lowerCAmelCase ).logits
			lowerCamelCase					:      Union[str, Any]          =   optax.softmax_cross_entropy(__lowerCAmelCase		,			onehot(__lowerCAmelCase		,			logits.shape[-1] ) ).mean()

			lowerCamelCase					:      Tuple          =   -(labels.shape[-1] * loss.item())

			lowerCamelCase					:      str          =   -84.9127
			self.assertTrue(abs(mtf_score - EXPECTED_SCORE ) < 1E-4 )








"""simple docstring"""

def 		UpperCAmelCase (		a_      ):





		'''simple docstring'''


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





		'''simple docstring'''


		return int(a_      ) + int(str(a_      )[::-1]      )
def 		UpperCAmelCase (		a_ = 1_0000      ):





		'''simple docstring'''


		lowerCamelCase					:      Optional[Any]          =   []
		for num in range(1,						a_      ):
				lowerCamelCase					:      List[str]          =   0
				lowerCamelCase					:      Union[str, Any]          =   num
				while iterations < 50:
						lowerCamelCase					:      Optional[int]          =   sum_reverse(a_      )
						iterations += 1
						if is_palindrome(a_      ):
								break
				else:
						lychrel_nums.append(a_      )
		return len(a_      )


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






