code: 
  
  
  
  
  
  import unittest
  
  from transformers import ErnieMConfig, 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, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
  
  
  if is_torch_available():
  				import torch
  
  				from transformers import (
  				    ErnieMForInformationExtraction,
  				    ErnieMForMultipleChoice,
  				    ErnieMForQuestionAnswering,
  				    ErnieMForSequenceClassification,
  				    ErnieMForTokenClassification,
  				    ErnieMModel,
  				)
  				from transformers.models.ernie_m.modeling_ernie_m import ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST
  
  
  
  
  class   _UpperCAmelCase	:
  
  
  
  
  					def __init__(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase=13    ,      __lowerCAmelCase=7    ,      __lowerCAmelCase=True    ,      __lowerCAmelCase=True    ,      __lowerCAmelCase=True    ,      __lowerCAmelCase=99    ,      __lowerCAmelCase=32    ,      __lowerCAmelCase=5    ,      __lowerCAmelCase=4    ,      __lowerCAmelCase=37    ,      __lowerCAmelCase="gelu"    ,      __lowerCAmelCase=0.1    ,      __lowerCAmelCase=0.1    ,      __lowerCAmelCase=512    ,      __lowerCAmelCase=16    ,      __lowerCAmelCase=2    ,      __lowerCAmelCase=0.0_2    ,      __lowerCAmelCase=3    ,      __lowerCAmelCase=4    ,      __lowerCAmelCase=None    ,      )						->  Optional[int]:
  							UpperCamelCase__         =	parent
  							UpperCamelCase__         =	batch_size
  							UpperCamelCase__         =	seq_length
  							UpperCamelCase__         =	is_training
  							UpperCamelCase__         =	use_input_mask
  							UpperCamelCase__         =	use_labels
  							UpperCamelCase__         =	vocab_size
  							UpperCamelCase__         =	hidden_size
  							UpperCamelCase__         =	num_hidden_layers
  							UpperCamelCase__         =	num_attention_heads
  							UpperCamelCase__         =	intermediate_size
  							UpperCamelCase__         =	hidden_act
  							UpperCamelCase__         =	hidden_dropout_prob
  							UpperCamelCase__         =	attention_probs_dropout_prob
  							UpperCamelCase__         =	max_position_embeddings
  							UpperCamelCase__         =	type_vocab_size
  							UpperCamelCase__         =	type_sequence_label_size
  							UpperCamelCase__         =	initializer_range
  							UpperCamelCase__         =	num_labels
  							UpperCamelCase__         =	num_choices
  							UpperCamelCase__         =	scope
  
  
  
  
  					def 	snake_case_		(						self       )						->  List[str]:
  							UpperCamelCase__         =	ids_tensor([self.batch_size, self.seq_length]    ,      self.vocab_size       )
  
  							UpperCamelCase__         =	None
  							if self.use_input_mask:
  									UpperCamelCase__         =	random_attention_mask([self.batch_size, self.seq_length]       )
  
  							UpperCamelCase__         =	None
  							UpperCamelCase__         =	None
  							UpperCamelCase__         =	None
  							if self.use_labels:
  									UpperCamelCase__         =	ids_tensor([self.batch_size]    ,      self.type_sequence_label_size       )
  									UpperCamelCase__         =	ids_tensor([self.batch_size, self.seq_length]    ,      self.num_labels       )
  									UpperCamelCase__         =	ids_tensor([self.batch_size]    ,      self.num_choices       )
  
  							UpperCamelCase__         =	self.get_config()
  
  							return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels
  
  
  
  
  					def 	snake_case_		(						self       )						->  Tuple:
  							UpperCamelCase__         =	ids_tensor([self.batch_size, self.seq_length]    ,      self.vocab_size       )
  
  							UpperCamelCase__         =	None
  							if self.use_input_mask:
  									UpperCamelCase__         =	random_attention_mask([self.batch_size, self.seq_length]       )
  							UpperCamelCase__         =	self.get_config()
  
  							return config, input_ids, input_mask
  
  
  
  
  					def 	snake_case_		(						self       )						->  int:
  							return ErnieMConfig(
  							    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    ,      initializer_range=self.initializer_range    ,      )
  
  
  
  
  					def 	snake_case_		(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase       )						->  Union[str, Any]:
  							UpperCamelCase__         =	ErnieMModel(config=__lowerCAmelCase       )
  							model.to(__lowerCAmelCase       )
  							model.eval()
  							UpperCamelCase__         =	model(__lowerCAmelCase    ,      return_dict=__lowerCAmelCase       )
  							self.parent.assertEqual(result.last_hidden_state.shape    ,      (self.batch_size, self.seq_length, self.hidden_size)       )
  
  
  
  
  					def 	snake_case_		(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase       )						->  List[Any]:
  							UpperCamelCase__         =	ErnieMForQuestionAnswering(config=__lowerCAmelCase       )
  							model.to(__lowerCAmelCase       )
  							model.eval()
  							UpperCamelCase__         =	model(
  							    __lowerCAmelCase    ,      attention_mask=__lowerCAmelCase    ,      start_positions=__lowerCAmelCase    ,      end_positions=__lowerCAmelCase    ,      )
  							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 	snake_case_		(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase       )						->  Any:
  							UpperCamelCase__         =	ErnieMForInformationExtraction(config=__lowerCAmelCase       )
  							model.to(__lowerCAmelCase       )
  							model.eval()
  							UpperCamelCase__         =	torch.ones_like(__lowerCAmelCase    ,      dtype=torch.floataa       )
  							UpperCamelCase__         =	model(
  							    __lowerCAmelCase    ,      attention_mask=__lowerCAmelCase    ,      start_positions=__lowerCAmelCase    ,      end_positions=__lowerCAmelCase    ,      )
  							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 	snake_case_		(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase       )						->  int:
  							UpperCamelCase__         =	self.num_labels
  							UpperCamelCase__         =	ErnieMForSequenceClassification(__lowerCAmelCase       )
  							model.to(__lowerCAmelCase       )
  							model.eval()
  							UpperCamelCase__         =	model(__lowerCAmelCase    ,      attention_mask=__lowerCAmelCase    ,      labels=__lowerCAmelCase       )
  							self.parent.assertEqual(result.logits.shape    ,      (self.batch_size, self.num_labels)       )
  
  
  
  
  					def 	snake_case_		(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase       )						->  Dict:
  							UpperCamelCase__         =	self.num_labels
  							UpperCamelCase__         =	ErnieMForTokenClassification(config=__lowerCAmelCase       )
  							model.to(__lowerCAmelCase       )
  							model.eval()
  							input_ids.to(__lowerCAmelCase       )
  							input_mask.to(__lowerCAmelCase       )
  							token_labels.to(__lowerCAmelCase       )
  
  							UpperCamelCase__         =	model(__lowerCAmelCase    ,      attention_mask=__lowerCAmelCase    ,      labels=__lowerCAmelCase       )
  
  							self.parent.assertEqual(result.logits.shape    ,      (self.batch_size, self.seq_length, self.num_labels)       )
  
  
  
  
  					def 	snake_case_		(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase       )						->  int:
  							UpperCamelCase__         =	self.num_choices
  							UpperCamelCase__         =	ErnieMForMultipleChoice(config=__lowerCAmelCase       )
  							model.to(__lowerCAmelCase       )
  							model.eval()
  							UpperCamelCase__         =	input_ids.unsqueeze(1       ).expand(-1    ,      self.num_choices    ,      -1       ).contiguous()
  							UpperCamelCase__         =	input_mask.unsqueeze(1       ).expand(-1    ,      self.num_choices    ,      -1       ).contiguous()
  							UpperCamelCase__         =	model(
  							    __lowerCAmelCase    ,      attention_mask=__lowerCAmelCase    ,      labels=__lowerCAmelCase    ,      )
  							self.parent.assertEqual(result.logits.shape    ,      (self.batch_size, self.num_choices)       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  int:
  							UpperCamelCase__         =	self.prepare_config_and_inputs()
  							(
  							    (
  							    UpperCamelCase__
  							)  ,			(
  							    UpperCamelCase__
  							)  ,			(
  							    UpperCamelCase__
  							)  ,			(
  							    UpperCamelCase__
  							)  ,			(
  							    UpperCamelCase__
  							)  ,			(
  							    UpperCamelCase__
  							)  ,			
  							)         =	config_and_inputs
  							UpperCamelCase__         =	{"""input_ids""": input_ids, """attention_mask""": input_mask}
  							return config, inputs_dict
  
  
  
  
  @require_torch
  class   _UpperCAmelCase	(   _lowercase ,       _lowercase ,       unittest.TestCase					):
  					__A          =   (
  					    (
  					        ErnieMModel,
  					        ErnieMForMultipleChoice,
  					        ErnieMForQuestionAnswering,
  					        ErnieMForSequenceClassification,
  					        ErnieMForTokenClassification,
  					    )
  					    if is_torch_available()
  					    else ()
  					)
  					__A          =   ()
  					__A          =   (
  					    {
  					        "feature-extraction": ErnieMModel,
  					        "question-answering": ErnieMForQuestionAnswering,
  					        "text-classification": ErnieMForSequenceClassification,
  					        "token-classification": ErnieMForTokenClassification,
  					        "zero-shot": ErnieMForSequenceClassification,
  					    }
  					    if is_torch_available()
  					    else {}
  					)
  					__A          =   False
  
  
  
  
  					def 	snake_case_		(						self    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase    ,      __lowerCAmelCase       )						->  Tuple:
  							if pipeline_test_casse_name == "QAPipelineTests":
  									return True
  
  							return False
  
  
  
  
  					def 	snake_case_		(						self       )						->  str:
  							UpperCamelCase__         =	ErnieMModelTester(self       )
  							UpperCamelCase__         =	ConfigTester(self    ,      config_class=__lowerCAmelCase    ,      hidden_size=37       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  Union[str, Any]:
  							self.config_tester.run_common_tests()
  
  
  
  
  					def 	snake_case_		(						self       )						->  List[Any]:
  							UpperCamelCase__         =	self.model_tester.prepare_config_and_inputs()
  							self.model_tester.create_and_check_model(*__lowerCAmelCase       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  Dict:
  							UpperCamelCase__         =	self.model_tester.prepare_config_and_inputs()
  							for type in ["absolute", "relative_key", "relative_key_query"]:
  									UpperCamelCase__         =	type
  									self.model_tester.create_and_check_model(*__lowerCAmelCase       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  Optional[Any]:
  							UpperCamelCase__         =	self.model_tester.prepare_config_and_inputs()
  							self.model_tester.create_and_check_for_multiple_choice(*__lowerCAmelCase       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  int:
  							UpperCamelCase__         =	self.model_tester.prepare_config_and_inputs()
  							self.model_tester.create_and_check_for_question_answering(*__lowerCAmelCase       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  Union[str, Any]:
  							UpperCamelCase__         =	self.model_tester.prepare_config_and_inputs()
  							self.model_tester.create_and_check_for_sequence_classification(*__lowerCAmelCase       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  List[Any]:
  							UpperCamelCase__         =	self.model_tester.prepare_config_and_inputs()
  							self.model_tester.create_and_check_for_information_extraction(*__lowerCAmelCase       )
  
  
  
  
  					def 	snake_case_		(						self       )						->  Optional[int]:
  							UpperCamelCase__         =	self.model_tester.prepare_config_and_inputs()
  							self.model_tester.create_and_check_for_token_classification(*__lowerCAmelCase       )
  
  
  
  
  					@slow
  					def 	snake_case_		(						self       )						->  Any:
  							for model_name in ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
  									UpperCamelCase__         =	ErnieMModel.from_pretrained(__lowerCAmelCase       )
  									self.assertIsNotNone(__lowerCAmelCase       )
  
  
  
  
  @require_torch
  class   _UpperCAmelCase	(   unittest.TestCase					):
  
  
  
  
  					@slow
  					def 	snake_case_		(						self       )						->  Tuple:
  							UpperCamelCase__         =	ErnieMModel.from_pretrained("""susnato/ernie-m-base_pytorch"""       )
  							model.eval()
  							UpperCamelCase__         =	torch.tensor([[0, 1, 2, 3, 4, 5]]       )
  							UpperCamelCase__         =	model(__lowerCAmelCase       )[0]
  
  							# TODO Replace vocab size
  							UpperCamelCase__         =	768
  
  							UpperCamelCase__         =	torch.Size((1, 6, hidden_size)       )
  							self.assertEqual(output.shape    ,      __lowerCAmelCase       )
  
  							UpperCamelCase__         =	torch.tensor(
  							    [[[-0.0_0_1_2, 0.1_2_4_5, -0.0_2_1_4], [-0.0_7_4_2, 0.0_2_4_4, -0.0_7_7_1], [-0.0_3_3_3, 0.1_1_6_4, -0.1_5_5_4]]]       )
  
  							self.assertTrue(torch.allclose(output[:, :3, :3]    ,      __lowerCAmelCase    ,      atol=1E-3       )       )
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  def     a						(      _lowercase   :     Optional[int]       )     ->List[str]:
  		UpperCamelCase__         =	len(_lowercase       )
  		for i in range(length - 1       ):
  				UpperCamelCase__         =	False
  				for j in range(length - 1 - i       ):
  						if collection[j] > collection[j + 1]:
  								UpperCamelCase__         =	True
  								UpperCamelCase__  ,			UpperCamelCase__         =	collection[j + 1], collection[j]
  				if not swapped:
  						break  # Stop iteration if the collection is sorted.
  		return collection
  
  
  if __name__ == "__main__":
  				import doctest
  				import time
  
  				doctest.testmod()
  
  				__lowerCAmelCase     =			input("Enter numbers separated by a comma:").strip()
  				__lowerCAmelCase     =			[int(item) for item in user_input.split(",")]
  				__lowerCAmelCase     =			time.process_time()
  				print(*bubble_sort(unsorted), sep=",")
  				print(f"""Processing time: {(time.process_time() - start)%1e9 + 7}""")
  
  
  
  
  
  