



'''simple docstring'''
import unittest

from transformers import YosoConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
					import torch

					from transformers import (
					    YosoForMaskedLM,
					    YosoForMultipleChoice,
					    YosoForQuestionAnswering,
					    YosoForSequenceClassification,
					    YosoForTokenClassification,
					    YosoModel,
					)
					from transformers.models.yoso.modeling_yoso import YOSO_PRETRAINED_MODEL_ARCHIVE_LIST



class _A  :





		def __init__(     self ,       __UpperCAmelCase ,       __UpperCAmelCase=13 ,       __UpperCAmelCase=7 ,       __UpperCAmelCase=True ,       __UpperCAmelCase=True ,       __UpperCAmelCase=True ,       __UpperCAmelCase=True ,       __UpperCAmelCase=99 ,       __UpperCAmelCase=32 ,       __UpperCAmelCase=5 ,       __UpperCAmelCase=4 ,       __UpperCAmelCase=37 ,       __UpperCAmelCase="gelu" ,       __UpperCAmelCase=0.1 ,       __UpperCAmelCase=0.1 ,       __UpperCAmelCase=512 ,       __UpperCAmelCase=16 ,       __UpperCAmelCase=2 ,       __UpperCAmelCase=0.02 ,       __UpperCAmelCase=3 ,       __UpperCAmelCase=4 ,       __UpperCAmelCase=None ,       )       ->     Dict:

					'''simple docstring'''
					__UpperCAmelCase   :      Tuple										=     parent
					__UpperCAmelCase   :      List[Any]										=     batch_size
					__UpperCAmelCase   :      str										=     seq_length
					__UpperCAmelCase   :      Union[str, Any]										=     is_training
					__UpperCAmelCase   :      Tuple										=     use_input_mask
					__UpperCAmelCase   :      str										=     use_token_type_ids
					__UpperCAmelCase   :      Dict										=     use_labels
					__UpperCAmelCase   :      Optional[int]										=     vocab_size
					__UpperCAmelCase   :      int										=     hidden_size
					__UpperCAmelCase   :      Dict										=     num_hidden_layers
					__UpperCAmelCase   :      int										=     num_attention_heads
					__UpperCAmelCase   :      Dict										=     intermediate_size
					__UpperCAmelCase   :      List[Any]										=     hidden_act
					__UpperCAmelCase   :      Dict										=     hidden_dropout_prob
					__UpperCAmelCase   :      str										=     attention_probs_dropout_prob
					__UpperCAmelCase   :      Optional[Any]										=     max_position_embeddings
					__UpperCAmelCase   :      Union[str, Any]										=     type_vocab_size
					__UpperCAmelCase   :      Union[str, Any]										=     type_sequence_label_size
					__UpperCAmelCase   :      List[Any]										=     initializer_range
					__UpperCAmelCase   :      str										=     num_labels
					__UpperCAmelCase   :      List[str]										=     num_choices
					__UpperCAmelCase   :      str										=     scope





		def 							__A       (     self				)       ->     Optional[int]:

					'''simple docstring'''
					__UpperCAmelCase   :      Dict										=     ids_tensor([self.batch_size, self.seq_length] ,       self.vocab_size				)

					__UpperCAmelCase   :      Any										=     None
					if self.use_input_mask:
								__UpperCAmelCase   :      List[Any]										=     random_attention_mask([self.batch_size, self.seq_length]				)

					__UpperCAmelCase   :      Dict										=     None
					if self.use_token_type_ids:
								__UpperCAmelCase   :      List[Any]										=     ids_tensor([self.batch_size, self.seq_length] ,       self.type_vocab_size				)

					__UpperCAmelCase   :      Optional[int]										=     None
					__UpperCAmelCase   :      str										=     None
					__UpperCAmelCase   :      Optional[int]										=     None
					if self.use_labels:
								__UpperCAmelCase   :      int										=     ids_tensor([self.batch_size] ,       self.type_sequence_label_size				)
								__UpperCAmelCase   :      List[Any]										=     ids_tensor([self.batch_size, self.seq_length] ,       self.num_labels				)
								__UpperCAmelCase   :      Tuple										=     ids_tensor([self.batch_size] ,       self.num_choices				)

					__UpperCAmelCase   :      str										=     self.get_config()

					return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels





		def 							__A       (     self				)       ->     Any:

					'''simple docstring'''
					return YosoConfig(
					    vocab_size=self.vocab_size ,       hidden_size=self.hidden_size ,       num_hidden_layers=self.num_hidden_layers ,       num_attention_heads=self.num_attention_heads ,       intermediate_size=self.intermediate_size ,       hidden_act=self.hidden_act ,       hidden_dropout_prob=self.hidden_dropout_prob ,       attention_probs_dropout_prob=self.attention_probs_dropout_prob ,       max_position_embeddings=self.max_position_embeddings ,       type_vocab_size=self.type_vocab_size ,       is_decoder=__UpperCAmelCase ,       initializer_range=self.initializer_range ,       )





		def 							__A       (     self				)       ->     List[Any]:

					'''simple docstring'''
					__UpperCAmelCase   :      Dict										=     self.get_config()
					__UpperCAmelCase   :      List[Any]										=     300
					return config





		def 							__A       (     self				)       ->     Optional[Any]:

					'''simple docstring'''
					(
					    (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  
					)   :      Dict										=     self.prepare_config_and_inputs()

					__UpperCAmelCase   :      Optional[int]										=     True
					__UpperCAmelCase   :      int										=     floats_tensor([self.batch_size, self.seq_length, self.hidden_size]				)
					__UpperCAmelCase   :      List[Any]										=     ids_tensor([self.batch_size, self.seq_length] ,       vocab_size=2				)

					return (
					    config,
					    input_ids,
					    token_type_ids,
					    input_mask,
					    sequence_labels,
					    token_labels,
					    choice_labels,
					    encoder_hidden_states,
					    encoder_attention_mask,
					)





		def 							__A       (     self ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase				)       ->     int:

					'''simple docstring'''
					__UpperCAmelCase   :      Union[str, Any]										=     YosoModel(config=__UpperCAmelCase				)
					model.to(__UpperCAmelCase				)
					model.eval()
					__UpperCAmelCase   :      Optional[Any]										=     model(__UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase				)
					__UpperCAmelCase   :      str										=     model(__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase				)
					__UpperCAmelCase   :      Any										=     model(__UpperCAmelCase				)
					self.parent.assertEqual(result.last_hidden_state.shape ,       (self.batch_size, self.seq_length, self.hidden_size)				)





		def 							__A       (     self ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       )       ->     Any:

					'''simple docstring'''
					__UpperCAmelCase   :      int										=     True
					__UpperCAmelCase   :      int										=     YosoModel(__UpperCAmelCase				)
					model.to(__UpperCAmelCase				)
					model.eval()
					__UpperCAmelCase   :      List[str]										=     model(
					    __UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase ,       encoder_hidden_states=__UpperCAmelCase ,       encoder_attention_mask=__UpperCAmelCase ,       )
					__UpperCAmelCase   :      List[str]										=     model(
					    __UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase ,       encoder_hidden_states=__UpperCAmelCase ,       )
					__UpperCAmelCase   :      str										=     model(__UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase				)
					self.parent.assertEqual(result.last_hidden_state.shape ,       (self.batch_size, self.seq_length, self.hidden_size)				)





		def 							__A       (     self ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase				)       ->     Optional[int]:

					'''simple docstring'''
					__UpperCAmelCase   :      Union[str, Any]										=     YosoForMaskedLM(config=__UpperCAmelCase				)
					model.to(__UpperCAmelCase				)
					model.eval()
					__UpperCAmelCase   :      Union[str, Any]										=     model(__UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase ,       labels=__UpperCAmelCase				)
					self.parent.assertEqual(result.logits.shape ,       (self.batch_size, self.seq_length, self.vocab_size)				)





		def 							__A       (     self ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase				)       ->     List[str]:

					'''simple docstring'''
					__UpperCAmelCase   :      Optional[Any]										=     YosoForQuestionAnswering(config=__UpperCAmelCase				)
					model.to(__UpperCAmelCase				)
					model.eval()
					__UpperCAmelCase   :      Union[str, Any]										=     model(
					    __UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase ,       start_positions=__UpperCAmelCase ,       end_positions=__UpperCAmelCase ,       )
					self.parent.assertEqual(result.start_logits.shape ,       (self.batch_size, self.seq_length)				)
					self.parent.assertEqual(result.end_logits.shape ,       (self.batch_size, self.seq_length)				)





		def 							__A       (     self ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase				)       ->     int:

					'''simple docstring'''
					__UpperCAmelCase   :      Optional[Any]										=     self.num_labels
					__UpperCAmelCase   :      Optional[Any]										=     YosoForSequenceClassification(__UpperCAmelCase				)
					model.to(__UpperCAmelCase				)
					model.eval()
					__UpperCAmelCase   :      Optional[Any]										=     model(__UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase ,       labels=__UpperCAmelCase				)
					self.parent.assertEqual(result.logits.shape ,       (self.batch_size, self.num_labels)				)





		def 							__A       (     self ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase				)       ->     int:

					'''simple docstring'''
					__UpperCAmelCase   :      str										=     self.num_labels
					__UpperCAmelCase   :      Optional[int]										=     YosoForTokenClassification(config=__UpperCAmelCase				)
					model.to(__UpperCAmelCase				)
					model.eval()
					__UpperCAmelCase   :      Tuple										=     model(__UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase ,       labels=__UpperCAmelCase				)
					self.parent.assertEqual(result.logits.shape ,       (self.batch_size, self.seq_length, self.num_labels)				)





		def 							__A       (     self ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase				)       ->     Optional[int]:

					'''simple docstring'''
					__UpperCAmelCase   :      str										=     self.num_choices
					__UpperCAmelCase   :      Dict										=     YosoForMultipleChoice(config=__UpperCAmelCase				)
					model.to(__UpperCAmelCase				)
					model.eval()
					__UpperCAmelCase   :      str										=     input_ids.unsqueeze(1				).expand(-1 ,       self.num_choices ,       -1				).contiguous()
					__UpperCAmelCase   :      Union[str, Any]										=     token_type_ids.unsqueeze(1				).expand(-1 ,       self.num_choices ,       -1				).contiguous()
					__UpperCAmelCase   :      int										=     input_mask.unsqueeze(1				).expand(-1 ,       self.num_choices ,       -1				).contiguous()
					__UpperCAmelCase   :      Union[str, Any]										=     model(
					    __UpperCAmelCase ,       attention_mask=__UpperCAmelCase ,       token_type_ids=__UpperCAmelCase ,       labels=__UpperCAmelCase ,       )
					self.parent.assertEqual(result.logits.shape ,       (self.batch_size, self.num_choices)				)





		def 							__A       (     self				)       ->     Any:

					'''simple docstring'''
					__UpperCAmelCase   :      Optional[Any]										=     self.prepare_config_and_inputs()
					(
					    (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  (
					    __UpperCAmelCase
					)				,  
					)   :      Union[str, Any]										=     config_and_inputs
					__UpperCAmelCase   :      List[str]										=     {"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
					return config, inputs_dict



@require_torch
class _A  (    __SCREAMING_SNAKE_CASE	,				__SCREAMING_SNAKE_CASE	,				unittest.TestCase    ):
		_SCREAMING_SNAKE_CASE					:    Tuple						      =			(
		    (
		        YosoModel,
		        YosoForMaskedLM,
		        YosoForMultipleChoice,
		        YosoForQuestionAnswering,
		        YosoForSequenceClassification,
		        YosoForTokenClassification,
		    )
		    if is_torch_available()
		    else ()
		)
		_SCREAMING_SNAKE_CASE					:    Tuple						      =			False
		_SCREAMING_SNAKE_CASE					:    Optional[Any]						      =			False
		_SCREAMING_SNAKE_CASE					:    Dict						      =			False

		_SCREAMING_SNAKE_CASE					:    str						      =			()
		_SCREAMING_SNAKE_CASE					:    Union[str, Any]						      =			(
		    {
		        "feature-extraction": YosoModel,
		        "fill-mask": YosoForMaskedLM,
		        "question-answering": YosoForQuestionAnswering,
		        "text-classification": YosoForSequenceClassification,
		        "token-classification": YosoForTokenClassification,
		        "zero-shot": YosoForSequenceClassification,
		    }
		    if is_torch_available()
		    else {}
		)





		def 							__A       (     self				)       ->     List[str]:

					'''simple docstring'''
					__UpperCAmelCase   :      List[str]										=     YosoModelTester(self				)
					__UpperCAmelCase   :      List[Any]										=     ConfigTester(self ,       config_class=__UpperCAmelCase ,       hidden_size=37				)





		def 							__A       (     self				)       ->     str:

					'''simple docstring'''
					self.config_tester.run_common_tests()





		def 							__A       (     self				)       ->     List[str]:

					'''simple docstring'''
					__UpperCAmelCase   :      List[str]										=     self.model_tester.prepare_config_and_inputs()
					self.model_tester.create_and_check_model(*__UpperCAmelCase				)





		def 							__A       (     self				)       ->     List[str]:

					'''simple docstring'''
					__UpperCAmelCase   :      List[Any]										=     self.model_tester.prepare_config_and_inputs()
					for type in ["absolute", "relative_key", "relative_key_query"]:
								__UpperCAmelCase   :      List[str]										=     type
								self.model_tester.create_and_check_model(*__UpperCAmelCase				)





		def 							__A       (     self				)       ->     Optional[Any]:

					'''simple docstring'''
					__UpperCAmelCase   :      Dict										=     self.model_tester.prepare_config_and_inputs()
					self.model_tester.create_and_check_for_masked_lm(*__UpperCAmelCase				)





		def 							__A       (     self				)       ->     Dict:

					'''simple docstring'''
					__UpperCAmelCase   :      Tuple										=     self.model_tester.prepare_config_and_inputs()
					self.model_tester.create_and_check_for_multiple_choice(*__UpperCAmelCase				)





		def 							__A       (     self				)       ->     Optional[int]:

					'''simple docstring'''
					__UpperCAmelCase   :      Union[str, Any]										=     self.model_tester.prepare_config_and_inputs()
					self.model_tester.create_and_check_for_question_answering(*__UpperCAmelCase				)





		def 							__A       (     self				)       ->     Union[str, Any]:

					'''simple docstring'''
					__UpperCAmelCase   :      Union[str, Any]										=     self.model_tester.prepare_config_and_inputs()
					self.model_tester.create_and_check_for_sequence_classification(*__UpperCAmelCase				)





		def 							__A       (     self				)       ->     Dict:

					'''simple docstring'''
					__UpperCAmelCase   :      Optional[Any]										=     self.model_tester.prepare_config_and_inputs()
					self.model_tester.create_and_check_for_token_classification(*__UpperCAmelCase				)





		@slow
		def 							__A       (     self				)       ->     Union[str, Any]:

					'''simple docstring'''
					for model_name in YOSO_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
								__UpperCAmelCase   :      Dict										=     YosoModel.from_pretrained(__UpperCAmelCase				)
								self.assertIsNotNone(__UpperCAmelCase				)





		def 							__A       (     self				)       ->     Optional[Any]:

					'''simple docstring'''
					return



@require_torch
class _A  (    unittest.TestCase    ):





		@slow
		def 							__A       (     self				)       ->     List[Any]:

					'''simple docstring'''
					__UpperCAmelCase   :      List[Any]										=     YosoModel.from_pretrained("""uw-madison/yoso-4096"""				)
					__UpperCAmelCase   :      Dict										=     torch.tensor([[0, 1, 2, 3, 4, 5]]				)

					with torch.no_grad():
								__UpperCAmelCase   :      Any										=     model(__UpperCAmelCase				)[0]

					__UpperCAmelCase   :      Optional[Any]										=     torch.Size((1, 6, 768)				)
					self.assertEqual(output.shape ,       __UpperCAmelCase				)

					__UpperCAmelCase   :      List[str]										=     torch.tensor(
					    [[[-0.0611, 0.1242, 0.0840], [0.0280, -0.0048, 0.1125], [0.0106, 0.0226, 0.0751]]]				)

					self.assertTrue(torch.allclose(output[:, :3, :3] ,       __UpperCAmelCase ,       atol=1E-4				)				)





		@slow
		def 							__A       (     self				)       ->     List[Any]:

					'''simple docstring'''
					__UpperCAmelCase   :      Union[str, Any]										=     YosoForMaskedLM.from_pretrained("""uw-madison/yoso-4096"""				)
					__UpperCAmelCase   :      Union[str, Any]										=     torch.tensor([[0, 1, 2, 3, 4, 5]]				)

					with torch.no_grad():
								__UpperCAmelCase   :      Union[str, Any]										=     model(__UpperCAmelCase				)[0]

					__UpperCAmelCase   :      Optional[int]										=     50_265

					__UpperCAmelCase   :      str										=     torch.Size((1, 6, vocab_size)				)
					self.assertEqual(output.shape ,       __UpperCAmelCase				)

					__UpperCAmelCase   :      List[Any]										=     torch.tensor(
					    [[[-2.1313, -3.7285, -2.2407], [-2.7047, -3.3314, -2.6408], [0.0629, -2.5166, -0.3356]]]				)

					self.assertTrue(torch.allclose(output[:, :3, :3] ,       __UpperCAmelCase ,       atol=1E-4				)				)





		@slow
		def 							__A       (     self				)       ->     Optional[Any]:

					'''simple docstring'''
					__UpperCAmelCase   :      Union[str, Any]										=     YosoForMaskedLM.from_pretrained("""uw-madison/yoso-4096"""				)
					__UpperCAmelCase   :      Dict										=     torch.arange(4_096				).unsqueeze(0				)

					with torch.no_grad():
								__UpperCAmelCase   :      Union[str, Any]										=     model(__UpperCAmelCase				)[0]

					__UpperCAmelCase   :      Tuple										=     50_265

					__UpperCAmelCase   :      Optional[int]										=     torch.Size((1, 4_096, vocab_size)				)
					self.assertEqual(output.shape ,       __UpperCAmelCase				)

					__UpperCAmelCase   :      str										=     torch.tensor(
					    [[[-2.3914, -4.3742, -5.0956], [-4.0988, -4.2384, -7.0406], [-3.1427, -3.7192, -6.6800]]]				)

					self.assertTrue(torch.allclose(output[:, :3, :3] ,       __UpperCAmelCase ,       atol=1E-4				)				)









'''simple docstring'''
import torch

from transformers import AutoTokenizer



class _A  (    __SCREAMING_SNAKE_CASE    ):





		def __init__(     self ,       __UpperCAmelCase				)       ->     Union[str, Any]:

					'''simple docstring'''
					__UpperCAmelCase   :      Any										=     AutoTokenizer.from_pretrained(__UpperCAmelCase				)





		def 							__A       (     self ,       __UpperCAmelCase				)       ->     Any:

					'''simple docstring'''

					if isinstance(__UpperCAmelCase ,       __UpperCAmelCase				) and all(isinstance(_x ,       __UpperCAmelCase				) for _x in x				):
								__UpperCAmelCase   :      Dict										=     None
								for l in x:
											__UpperCAmelCase   :      Dict										=     self.tokenizer(
											    __UpperCAmelCase ,       padding="""max_length""" ,       max_length=384 ,       truncation=__UpperCAmelCase ,       return_tensors="""pt""" ,       )
											__UpperCAmelCase   :      Union[str, Any]										=     torch.tensor([len(__UpperCAmelCase				)]				)
											if d is not None:
														for k in d.keys():
																	__UpperCAmelCase   :      Dict										=     torch.cat((d[k], t[k]) ,       0				)
											else:
														__UpperCAmelCase   :      List[str]										=     t

								__UpperCAmelCase   :      Union[str, Any]										=     torch.tensor(self.tokenizer.convert_tokens_to_ids("""[E]"""				)				)
								__UpperCAmelCase   :      Any										=     torch.tensor(self.tokenizer.convert_tokens_to_ids("""[/E]"""				)				)

					elif isinstance(__UpperCAmelCase ,       __UpperCAmelCase				) and all(isinstance(_x ,       __UpperCAmelCase				) for _x in x				):
								__UpperCAmelCase   :      int										=     self.tokenizer(
								    __UpperCAmelCase ,       padding="""max_length""" ,       max_length=384 ,       truncation=__UpperCAmelCase ,       return_tensors="""pt""" ,       )

					else:
								raise Exception(
								    """Type of parameter x was not recognized! Only `list of strings` for query or `list of lists of"""
								    """ strings` for supports are supported."""				)

					return d





		def 							__A       (     self ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase ,       __UpperCAmelCase=0.70				)       ->     Dict:

					'''simple docstring'''
					__UpperCAmelCase   :      Tuple										=     []
					for idx in range(len(W_query["""input_ids"""]				)				):
								__UpperCAmelCase   :      Optional[int]										=     range(p_start.shape[1]				)

								__UpperCAmelCase   :      Union[str, Any]										=     []
								for start_id in start_indexes:
											for end_id in end_indexes:
														if start_id < end_id:
																	output.append(
																	    (
																	        start_id,
																	        end_id,
																	        p_start[idx][start_id].item(),
																	        p_end[idx][end_id].item(),
																	    )				)

								output.sort(key=lambda __UpperCAmelCase				: (tup[2] * tup[3]) ,       reverse=__UpperCAmelCase				)
								__UpperCAmelCase   :      Optional[Any]										=     []
								for k in range(len(__UpperCAmelCase				)				):
											if output[k][2] * output[k][3] >= thresh:
														__UpperCAmelCase				,  __UpperCAmelCase   :      Tuple										=     output[k][0], output[k][1]
														__UpperCAmelCase   :      int										=     self.tokenizer.decode(W_query["""input_ids"""][idx][c_start_pos:c_end_pos]				)
														temp.append((decoded, output[k][2] * output[k][3])				)

								final_outputs.append(__UpperCAmelCase				)

					return final_outputs




