
'''simple docstring'''







from __future__ import annotations







def 				SCREAMING_SNAKE_CASE__	(   __A	)       ->	int:
	_snake_case   						=		len(__A	) // 2

	# choose the middle 3 elements
	_snake_case   						=		lst[m - 1 : m + 2]

	# if middle element is peak
	if three[1] > three[0] and three[1] > three[2]:
		return three[1]

	# if increasing, recurse on right
	elif three[0] < three[2]:
		if len(lst[:m]	) == 2:
			m -= 1
		return peak(lst[m:]	)

	# decreasing
	else:
		if len(lst[:m]	) == 2:
			m += 1
		return peak(lst[:m]	)


if __name__ == "__main__":
					import doctest

					doctest.testmod()



'''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  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		AutoModelForSeqaSeqLM.from_pretrained('google/mt5-small'    ,   return_dict=lowerCAmelCase_  ).to(lowerCAmelCase_  )
								_snake_case   						=		AutoTokenizer.from_pretrained('google/mt5-small'  )

								_snake_case   						=		tokenizer('Hello there'    ,   return_tensors='pt'  ).input_ids
								_snake_case   						=		tokenizer('Hi I am'    ,   return_tensors='pt'  ).input_ids

								_snake_case   						=		model(input_ids.to(lowerCAmelCase_  )    ,   labels=labels.to(lowerCAmelCase_  )  ).loss
								_snake_case   						=		-(labels.shape[-1] * loss.item())

								_snake_case   						=		-84.9127
								self.assertTrue(abs(mtf_score - EXPECTED_SCORE  ) < 1E-4  )

