
'''simple docstring'''







def 				SCREAMING_SNAKE_CASE__	(   __A	)       ->	List[Any]:
	_snake_case   						=		[0] * len(__A	)
	_snake_case   						=		[]
	_snake_case   						=		[1] * len(__A	)

	for values in graph.values():
		for i in values:
			indegree[i] += 1

	for i in range(len(__A	)	):
		if indegree[i] == 0:
			queue.append(__A	)

	while queue:
		_snake_case   						=		queue.pop(0	)
		for x in graph[vertex]:
			indegree[x] -= 1

			if long_dist[vertex] + 1 > long_dist[x]:
				_snake_case   						=		long_dist[vertex] + 1

			if indegree[x] == 0:
				queue.append(__A	)

	print(max(__A	)	)


# Adjacency list of Graph
lowercase    :							Any      =					{0: [2, 3, 4], 1: [2, 7], 2: [5], 3: [5, 7], 4: [7], 5: [6], 6: [7], 7: []}





longest_distance(graph)



'''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  )

