



'''simple docstring'''




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():
							from transformers import AutoModelForSeqaSeqLM, AutoTokenizer

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





	@slow
	def  _lowercase(  self    )			->			int:
								UpperCAmelCase     :		Optional[Any]							     =		AutoModelForSeqaSeqLM.from_pretrained("""google/mt5-small"""		,		return_dict=A    ).to(A    )
								UpperCAmelCase     :		str							     =		AutoTokenizer.from_pretrained("""google/mt5-small"""    )

								UpperCAmelCase     :		Optional[int]							     =		tokenizer("""Hello there"""		,		return_tensors="""pt"""    ).input_ids
								UpperCAmelCase     :		Dict							     =		tokenizer("""Hi I am"""		,		return_tensors="""pt"""    ).input_ids

								UpperCAmelCase     :		List[str]							     =		model(input_ids.to(A    )		,		labels=labels.to(A    )    ).loss
								UpperCAmelCase     :		Optional[int]							     =		-(labels.shape[-1] * loss.item())

								UpperCAmelCase     :		Union[str, Any]							     =		-8_4.9_1_2_7
								self.assertTrue(abs(mtf_score - EXPECTED_SCORE    ) < 1e-4    )






'''simple docstring'''




def       __lowerCamelCase  (					_lowercase	,				_lowercase		)      ->			int:
							if b == 0:
														return 1
							if (b % 2) == 0:
														return actual_power(_lowercase	,				int(b / 2		)		) * actual_power(_lowercase	,				int(b / 2		)		)
							else:
														return a * actual_power(_lowercase	,				int(b / 2		)		) * actual_power(_lowercase	,				int(b / 2		)		)



def       __lowerCamelCase  (					_lowercase	,				_lowercase		)      ->			float:
							if b < 0:
														return 1 / actual_power(_lowercase	,				_lowercase		)
							return actual_power(_lowercase	,				_lowercase		)


if __name__ == "__main__":
							print(power(-2, -3))

