



"""simple docstring"""






import os
from typing import List

def  lowerCAmelCase_      (_SCREAMING_SNAKE_CASE	:List[str]		,			_SCREAMING_SNAKE_CASE	:str  )				-> Union[str, Any]:
						if name != "training_function" and name != "main":
												raise ValueError(F'''Incorrect function name passed: {name}, choose either \'main\' or \'training_function\''''  )
						a_							:			str     		=					[], False
						for line in lines:
												if not found_start and F'''def {name}''' in line:
																		a_							:			List[str]     		=					True
																		good_lines.append(_SCREAMING_SNAKE_CASE  )
																		continue
												if found_start:
																		if name == "training_function" and "def main" in line:
																								return good_lines
																		if name == "main" and "if __name__" in line:
																								return good_lines
																		good_lines.append(_SCREAMING_SNAKE_CASE  )

def  lowerCAmelCase_      (_SCREAMING_SNAKE_CASE	:List[str]  )				-> Optional[int]:
						return [line for line in lines if not line.lstrip().startswith("#"  ) and line != "\n"]



def  lowerCAmelCase_      (_SCREAMING_SNAKE_CASE	:str		,			_SCREAMING_SNAKE_CASE	:str		,			_SCREAMING_SNAKE_CASE	:bool		,			_SCREAMING_SNAKE_CASE	:str = None  )				-> List[str]:
						with open(_SCREAMING_SNAKE_CASE		,			"r"  ) as f:
												a_							:			List[str]     		=					f.readlines()
						with open(os.path.abspath(os.path.join("examples"		,			"nlp_example.py"  )  )		,			"r"  ) as f:
												a_							:			List[str]     		=					f.readlines()
						with open(_SCREAMING_SNAKE_CASE		,			"r"  ) as f:
												a_							:			List[Any]     		=					f.readlines()
						if secondary_filename is not None:
												with open(_SCREAMING_SNAKE_CASE		,			"r"  ) as f:
																		a_							:			Union[str, Any]     		=					f.readlines()

    # This is our base, we remove all the code from here in our `full_filename` and `feature_filename` to find the new content
						if parser_only:
												a_							:			Optional[int]     		=					clean_lines(get_function_contents_by_name(_SCREAMING_SNAKE_CASE		,			"main"  )  )
												a_							:			Any     		=					clean_lines(get_function_contents_by_name(_SCREAMING_SNAKE_CASE		,			"main"  )  )
												a_							:			Tuple     		=					clean_lines(get_function_contents_by_name(_SCREAMING_SNAKE_CASE		,			"main"  )  )
												if secondary_filename is not None:
																		a_							:			Dict     		=					clean_lines(get_function_contents_by_name(_SCREAMING_SNAKE_CASE		,			"main"  )  )
						else:
												a_							:			Optional[Any]     		=					clean_lines(get_function_contents_by_name(_SCREAMING_SNAKE_CASE		,			"training_function"  )  )
												a_							:			int     		=					clean_lines(get_function_contents_by_name(_SCREAMING_SNAKE_CASE		,			"training_function"  )  )
												a_							:			List[str]     		=					clean_lines(get_function_contents_by_name(_SCREAMING_SNAKE_CASE		,			"training_function"  )  )
												if secondary_filename is not None:
																		a_							:			List[Any]     		=					clean_lines(
																		    get_function_contents_by_name(_SCREAMING_SNAKE_CASE		,			"training_function"  )  )

						a_							:			int     		=					"train_dataloader, eval_dataloader = get_dataloaders(accelerator, batch_size)\n"

						# Specific code in our script that differs from the full version, aka what is new
						a_							:			str     		=					[]
						a_							:			List[Any]     		=					[]  # We keep track of the idxs just in case it's a repeated statement
						a_							:			Dict     		=					iter(_SCREAMING_SNAKE_CASE  )
						for i in range(len(_SCREAMING_SNAKE_CASE  ) - 1  ):
												if i not in passed_idxs:
																		a_							:			Tuple     		=					next(_SCREAMING_SNAKE_CASE  )
																		if (line not in full_file_func) and (line.lstrip() != _dl_line):
																								if "TESTING_MOCKED_DATALOADERS" not in line:
																														new_feature_code.append(_SCREAMING_SNAKE_CASE  )
																														passed_idxs.append(_SCREAMING_SNAKE_CASE  )
																								else:
																														# Skip over the `config['num_epochs'] = 2` statement
																														a_							:			str     		=					next(_SCREAMING_SNAKE_CASE  )

    # Extract out just the new parts from the full_file_training_func
						a_							:			List[Any]     		=					[]
						a_							:			int     		=					[]  # We keep track of the idxs just in case it's a repeated statement
						for i, line in enumerate(_SCREAMING_SNAKE_CASE  ):
												if i not in passed_idxs:
																		if (line not in full_file_func) and (line.lstrip() != _dl_line):
																								if "TESTING_MOCKED_DATALOADERS" not in line:
																														new_full_example_parts.append(_SCREAMING_SNAKE_CASE  )
																														passed_idxs.append(_SCREAMING_SNAKE_CASE  )

    # Finally, get the overall diff
						a_							:			Tuple     		=					[line for line in new_feature_code if line not in new_full_example_parts]
						if secondary_filename is not None:
												a_							:			Any     		=					[line for line in full_file_contents if line not in secondary_file_func]
												a_							:			Optional[Any]     		=					[line for line in diff_from_example if line not in diff_from_two]

						return diff_from_example





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


	"""simple docstring"""







	def __init__(			self       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE=1_3       ,     _SCREAMING_SNAKE_CASE=7       ,     _SCREAMING_SNAKE_CASE=True       ,     _SCREAMING_SNAKE_CASE=True       ,     _SCREAMING_SNAKE_CASE=True       ,     _SCREAMING_SNAKE_CASE=True       ,     _SCREAMING_SNAKE_CASE=9_9       ,     _SCREAMING_SNAKE_CASE=3_2       ,     _SCREAMING_SNAKE_CASE=5       ,     _SCREAMING_SNAKE_CASE=4       ,     _SCREAMING_SNAKE_CASE=3_7       ,     _SCREAMING_SNAKE_CASE="gelu"       ,     _SCREAMING_SNAKE_CASE=0.1       ,     _SCREAMING_SNAKE_CASE=0.1       ,     _SCREAMING_SNAKE_CASE=5_1_2       ,     _SCREAMING_SNAKE_CASE=1_6       ,     _SCREAMING_SNAKE_CASE=2       ,     _SCREAMING_SNAKE_CASE=0.0_2       ,     _SCREAMING_SNAKE_CASE=3       ,     _SCREAMING_SNAKE_CASE=4       ,     _SCREAMING_SNAKE_CASE=None       ,     )    ->	Optional[int]:
							a_							:			str     		=					parent
							a_							:			Tuple     		=					batch_size
							a_							:			Optional[int]     		=					seq_length
							a_							:			Any     		=					is_training
							a_							:			List[str]     		=					use_input_mask
							a_							:			Optional[Any]     		=					use_token_type_ids
							a_							:			Dict     		=					use_labels
							a_							:			str     		=					vocab_size
							a_							:			Optional[int]     		=					hidden_size
							a_							:			str     		=					num_hidden_layers
							a_							:			List[str]     		=					num_attention_heads
							a_							:			List[Any]     		=					intermediate_size
							a_							:			Any     		=					hidden_act
							a_							:			Union[str, Any]     		=					hidden_dropout_prob
							a_							:			Tuple     		=					attention_probs_dropout_prob
							a_							:			Tuple     		=					max_position_embeddings
							a_							:			Tuple     		=					type_vocab_size
							a_							:			Union[str, Any]     		=					type_sequence_label_size
							a_							:			List[str]     		=					initializer_range
							a_							:			List[str]     		=					num_labels
							a_							:			Optional[Any]     		=					num_choices
							a_							:			Dict     		=					scope







	def       A    (			self )    ->	Optional[int]:
							a_							:			int     		=					ids_tensor([self.batch_size, self.seq_length]       ,     self.vocab_size )

							a_							:			Optional[int]     		=					None
							if self.use_input_mask:
													a_							:			Tuple     		=					random_attention_mask([self.batch_size, self.seq_length] )

							a_							:			List[str]     		=					None
							if self.use_token_type_ids:
													a_							:			str     		=					ids_tensor([self.batch_size, self.seq_length]       ,     self.type_vocab_size )

							a_							:			Dict     		=					None
							a_							:			Dict     		=					None
							a_							:			Union[str, Any]     		=					None
							if self.use_labels:
													a_							:			List[str]     		=					ids_tensor([self.batch_size]       ,     self.type_sequence_label_size )
													a_							:			List[Any]     		=					ids_tensor([self.batch_size, self.seq_length]       ,     self.num_labels )
													a_							:			List[Any]     		=					ids_tensor([self.batch_size]       ,     self.num_choices )

							a_							:			str     		=					self.get_config()

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







	def       A    (			self )    ->	Dict:
							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=_SCREAMING_SNAKE_CASE       ,     initializer_range=self.initializer_range       ,     )







	def       A    (			self )    ->	Optional[Any]:
							a_							:			Optional[int]     		=					self.get_config()
							a_							:			List[Any]     		=					3_0_0
							return config







	def       A    (			self )    ->	int:
							(
							    (
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					
							)							:			Tuple     		=					self.prepare_config_and_inputs()

							a_							:			Optional[int]     		=					True
							a_							:			str     		=					floats_tensor([self.batch_size, self.seq_length, self.hidden_size] )
							a_							:			Tuple     		=					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       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE )    ->	List[str]:
							a_							:			Tuple     		=					YosoModel(config=_SCREAMING_SNAKE_CASE )
							model.to(_SCREAMING_SNAKE_CASE )
							model.eval()
							a_							:			Optional[Any]     		=					model(_SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE )
							a_							:			Optional[Any]     		=					model(_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE )
							a_							:			Union[str, Any]     		=					model(_SCREAMING_SNAKE_CASE )
							self.parent.assertEqual(result.last_hidden_state.shape       ,     (self.batch_size, self.seq_length, self.hidden_size) )







	def       A    (			self       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     )    ->	List[Any]:
							a_							:			int     		=					True
							a_							:			Optional[Any]     		=					YosoModel(_SCREAMING_SNAKE_CASE )
							model.to(_SCREAMING_SNAKE_CASE )
							model.eval()
							a_							:			Tuple     		=					model(
							    _SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE       ,     encoder_hidden_states=_SCREAMING_SNAKE_CASE       ,     encoder_attention_mask=_SCREAMING_SNAKE_CASE       ,     )
							a_							:			str     		=					model(
							    _SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE       ,     encoder_hidden_states=_SCREAMING_SNAKE_CASE       ,     )
							a_							:			str     		=					model(_SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE )
							self.parent.assertEqual(result.last_hidden_state.shape       ,     (self.batch_size, self.seq_length, self.hidden_size) )







	def       A    (			self       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE )    ->	List[str]:
							a_							:			Optional[int]     		=					YosoForMaskedLM(config=_SCREAMING_SNAKE_CASE )
							model.to(_SCREAMING_SNAKE_CASE )
							model.eval()
							a_							:			str     		=					model(_SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE       ,     labels=_SCREAMING_SNAKE_CASE )
							self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, self.seq_length, self.vocab_size) )







	def       A    (			self       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE )    ->	Optional[int]:
							a_							:			Tuple     		=					YosoForQuestionAnswering(config=_SCREAMING_SNAKE_CASE )
							model.to(_SCREAMING_SNAKE_CASE )
							model.eval()
							a_							:			Optional[int]     		=					model(
							    _SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE       ,     start_positions=_SCREAMING_SNAKE_CASE       ,     end_positions=_SCREAMING_SNAKE_CASE       ,     )
							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       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE )    ->	int:
							a_							:			int     		=					self.num_labels
							a_							:			Optional[int]     		=					YosoForSequenceClassification(_SCREAMING_SNAKE_CASE )
							model.to(_SCREAMING_SNAKE_CASE )
							model.eval()
							a_							:			Union[str, Any]     		=					model(_SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE       ,     labels=_SCREAMING_SNAKE_CASE )
							self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, self.num_labels) )







	def       A    (			self       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE )    ->	List[str]:
							a_							:			str     		=					self.num_labels
							a_							:			List[str]     		=					YosoForTokenClassification(config=_SCREAMING_SNAKE_CASE )
							model.to(_SCREAMING_SNAKE_CASE )
							model.eval()
							a_							:			Tuple     		=					model(_SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE       ,     labels=_SCREAMING_SNAKE_CASE )
							self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, self.seq_length, self.num_labels) )







	def       A    (			self       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE       ,     _SCREAMING_SNAKE_CASE )    ->	Union[str, Any]:
							a_							:			Optional[int]     		=					self.num_choices
							a_							:			int     		=					YosoForMultipleChoice(config=_SCREAMING_SNAKE_CASE )
							model.to(_SCREAMING_SNAKE_CASE )
							model.eval()
							a_							:			Optional[Any]     		=					input_ids.unsqueeze(1 ).expand(-1       ,     self.num_choices       ,     -1 ).contiguous()
							a_							:			Optional[Any]     		=					token_type_ids.unsqueeze(1 ).expand(-1       ,     self.num_choices       ,     -1 ).contiguous()
							a_							:			Optional[int]     		=					input_mask.unsqueeze(1 ).expand(-1       ,     self.num_choices       ,     -1 ).contiguous()
							a_							:			Optional[int]     		=					model(
							    _SCREAMING_SNAKE_CASE       ,     attention_mask=_SCREAMING_SNAKE_CASE       ,     token_type_ids=_SCREAMING_SNAKE_CASE       ,     labels=_SCREAMING_SNAKE_CASE       ,     )
							self.parent.assertEqual(result.logits.shape       ,     (self.batch_size, self.num_choices) )







	def       A    (			self )    ->	Tuple:
							a_							:			Optional[Any]     		=					self.prepare_config_and_inputs()
							(
							    (
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					(
							    a_
							)		,					
							)							:			Any     		=					config_and_inputs
							a_							:			Any     		=					{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
							return config, inputs_dict




@require_torch
class   UpperCAmelCase__				(    __lowerCamelCase,      __lowerCamelCase,      unittest.TestCase			):


	"""simple docstring"""
	lowerCAmelCase__    :					List[str]						      =							(
	    (
	        YosoModel,
	        YosoForMaskedLM,
	        YosoForMultipleChoice,
	        YosoForQuestionAnswering,
	        YosoForSequenceClassification,
	        YosoForTokenClassification,
	    )
	    if is_torch_available()
	    else ()
	)
	lowerCAmelCase__    :					Any						      =							False
	lowerCAmelCase__    :					List[Any]						      =							False
	lowerCAmelCase__    :					Dict						      =							False

	lowerCAmelCase__    :					Optional[int]						      =							()
	lowerCAmelCase__    :					int						      =							(
	    {
	        """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 )    ->	Optional[Any]:
							a_							:			str     		=					YosoModelTester(self )
							a_							:			Any     		=					ConfigTester(self       ,     config_class=_SCREAMING_SNAKE_CASE       ,     hidden_size=3_7 )







	def       A    (			self )    ->	Optional[Any]:
							self.config_tester.run_common_tests()







	def       A    (			self )    ->	Optional[int]:
							a_							:			Dict     		=					self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*_SCREAMING_SNAKE_CASE )







	def       A    (			self )    ->	Union[str, Any]:
							a_							:			Any     		=					self.model_tester.prepare_config_and_inputs()
							for type in ["absolute", "relative_key", "relative_key_query"]:
													a_							:			Optional[Any]     		=					type
													self.model_tester.create_and_check_model(*_SCREAMING_SNAKE_CASE )







	def       A    (			self )    ->	Any:
							a_							:			str     		=					self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_masked_lm(*_SCREAMING_SNAKE_CASE )







	def       A    (			self )    ->	int:
							a_							:			str     		=					self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_multiple_choice(*_SCREAMING_SNAKE_CASE )







	def       A    (			self )    ->	Union[str, Any]:
							a_							:			Tuple     		=					self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_question_answering(*_SCREAMING_SNAKE_CASE )







	def       A    (			self )    ->	Optional[Any]:
							a_							:			int     		=					self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_sequence_classification(*_SCREAMING_SNAKE_CASE )







	def       A    (			self )    ->	Optional[Any]:
							a_							:			str     		=					self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_token_classification(*_SCREAMING_SNAKE_CASE )







	@slow
	def       A    (			self )    ->	int:
							for model_name in YOSO_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
													a_							:			Optional[int]     		=					YosoModel.from_pretrained(_SCREAMING_SNAKE_CASE )
													self.assertIsNotNone(_SCREAMING_SNAKE_CASE )







	def       A    (			self )    ->	Any:
							return




@require_torch
class   UpperCAmelCase__				(    unittest.TestCase			):


	"""simple docstring"""







	@slow
	def       A    (			self )    ->	Optional[Any]:
							a_							:			Optional[int]     		=					YosoModel.from_pretrained("uw-madison/yoso-4096" )
							a_							:			Union[str, Any]     		=					torch.tensor([[0, 1, 2, 3, 4, 5]] )

							with torch.no_grad():
													a_							:			Tuple     		=					model(_SCREAMING_SNAKE_CASE )[0]

							a_							:			int     		=					torch.Size((1, 6, 7_6_8) )
							self.assertEqual(output.shape       ,     _SCREAMING_SNAKE_CASE )

							a_							:			List[str]     		=					torch.tensor(
							    [[[-0.0_6_1_1, 0.1_2_4_2, 0.0_8_4_0], [0.0_2_8_0, -0.0_0_4_8, 0.1_1_2_5], [0.0_1_0_6, 0.0_2_2_6, 0.0_7_5_1]]] )

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







	@slow
	def       A    (			self )    ->	Optional[int]:
							a_							:			int     		=					YosoForMaskedLM.from_pretrained("uw-madison/yoso-4096" )
							a_							:			Tuple     		=					torch.tensor([[0, 1, 2, 3, 4, 5]] )

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

							a_							:			List[str]     		=					5_0_2_6_5

							a_							:			Union[str, Any]     		=					torch.Size((1, 6, vocab_size) )
							self.assertEqual(output.shape       ,     _SCREAMING_SNAKE_CASE )

							a_							:			Optional[Any]     		=					torch.tensor(
							    [[[-2.1_3_1_3, -3.7_2_8_5, -2.2_4_0_7], [-2.7_0_4_7, -3.3_3_1_4, -2.6_4_0_8], [0.0_6_2_9, -2.5_1_6_6, -0.3_3_5_6]]] )

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







	@slow
	def       A    (			self )    ->	int:
							a_							:			List[str]     		=					YosoForMaskedLM.from_pretrained("uw-madison/yoso-4096" )
							a_							:			Dict     		=					torch.arange(4_0_9_6 ).unsqueeze(0 )

							with torch.no_grad():
													a_							:			Tuple     		=					model(_SCREAMING_SNAKE_CASE )[0]

							a_							:			str     		=					5_0_2_6_5

							a_							:			List[Any]     		=					torch.Size((1, 4_0_9_6, vocab_size) )
							self.assertEqual(output.shape       ,     _SCREAMING_SNAKE_CASE )

							a_							:			str     		=					torch.tensor(
							    [[[-2.3_9_1_4, -4.3_7_4_2, -5.0_9_5_6], [-4.0_9_8_8, -4.2_3_8_4, -7.0_4_0_6], [-3.1_4_2_7, -3.7_1_9_2, -6.6_8_0_0]]] )

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




