



"""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	):

						'''simple docstring'''




						@slow
						def 	_A     (   self		):







													'''simple docstring'''

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

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

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

													__SCREAMING_SNAKE_CASE									= -84.9_127
													self.assertTrue(abs(mtf_score - EXPECTED_SCORE		) < 1e-4		)











from ..utils import DummyObject, requires_backends

class        UpperCAmelCase_  (       metaclass=UpperCamelCase_	):

						'''simple docstring'''




						UpperCamelCase__      :			Optional[int]      =  ['''speech''']






						def __init__(   self				,							*_A				,							**_A		):







													'''simple docstring'''

													requires_backends(self				,							['speech']		)







class        UpperCAmelCase_  (       metaclass=UpperCamelCase_	):

						'''simple docstring'''




						UpperCamelCase__      :			Optional[int]      =  ['''speech''']






						def __init__(   self				,							*_A				,							**_A		):







													'''simple docstring'''

													requires_backends(self				,							['speech']		)






