
import unittest

from parameterized import parameterized

from transformers import OpenLlamaConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, torch_device

from ...generation.test_utils import GenerationTesterMixin
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 OpenLlamaForCausalLM, OpenLlamaForSequenceClassification, OpenLlamaModel





class 			_lowerCAmelCase      :




				def __init__(      self       ,       _UpperCamelCase       ,       _UpperCamelCase=13       ,       _UpperCamelCase=7       ,       _UpperCamelCase=True       ,       _UpperCamelCase=True       ,       _UpperCamelCase=False       ,       _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       ,       )       ->   List[Any]:
							lowerCAmelCase_      			=			parent
							lowerCAmelCase_      			=			batch_size
							lowerCAmelCase_      			=			seq_length
							lowerCAmelCase_      			=			is_training
							lowerCAmelCase_      			=			use_input_mask
							lowerCAmelCase_      			=			use_token_type_ids
							lowerCAmelCase_      			=			use_labels
							lowerCAmelCase_      			=			vocab_size
							lowerCAmelCase_      			=			hidden_size
							lowerCAmelCase_      			=			num_hidden_layers
							lowerCAmelCase_      			=			num_attention_heads
							lowerCAmelCase_      			=			intermediate_size
							lowerCAmelCase_      			=			hidden_act
							lowerCAmelCase_      			=			hidden_dropout_prob
							lowerCAmelCase_      			=			attention_probs_dropout_prob
							lowerCAmelCase_      			=			max_position_embeddings
							lowerCAmelCase_      			=			type_vocab_size
							lowerCAmelCase_      			=			type_sequence_label_size
							lowerCAmelCase_      			=			initializer_range
							lowerCAmelCase_      			=			num_labels
							lowerCAmelCase_      			=			num_choices
							lowerCAmelCase_      			=			scope




				def   __a		(      self  )       ->   Any:
							lowerCAmelCase_      			=			ids_tensor([self.batch_size, self.seq_length]       ,       self.vocab_size  )

							lowerCAmelCase_      			=			None
							if self.use_input_mask:
										lowerCAmelCase_      			=			random_attention_mask([self.batch_size, self.seq_length]  )

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

							lowerCAmelCase_      			=			None
							lowerCAmelCase_      			=			None
							lowerCAmelCase_      			=			None
							if self.use_labels:
										lowerCAmelCase_      			=			ids_tensor([self.batch_size]       ,       self.type_sequence_label_size  )
										lowerCAmelCase_      			=			ids_tensor([self.batch_size, self.seq_length]       ,       self.num_labels  )
										lowerCAmelCase_      			=			ids_tensor([self.batch_size]       ,       self.num_choices  )

							lowerCAmelCase_      			=			self.get_config()

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




				def   __a		(      self  )       ->   List[str]:
							return OpenLlamaConfig(
							    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       ,       use_stable_embedding=_UpperCamelCase       ,       )




				def   __a		(      self       ,       _UpperCamelCase       ,       _UpperCamelCase       ,       _UpperCamelCase       ,       _UpperCamelCase       ,       _UpperCamelCase       ,       _UpperCamelCase       ,       _UpperCamelCase  )       ->   Dict:
							lowerCAmelCase_      			=			OpenLlamaModel(config=_UpperCamelCase  )
							model.to(_UpperCamelCase  )
							model.eval()
							lowerCAmelCase_      			=			model(_UpperCamelCase       ,       attention_mask=_UpperCamelCase  )
							lowerCAmelCase_      			=			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       ,       )       ->   Tuple:
							lowerCAmelCase_      			=			True
							lowerCAmelCase_      			=			OpenLlamaModel(_UpperCamelCase  )
							model.to(_UpperCamelCase  )
							model.eval()
							lowerCAmelCase_      			=			model(
							    _UpperCamelCase       ,       attention_mask=_UpperCamelCase       ,       encoder_hidden_states=_UpperCamelCase       ,       encoder_attention_mask=_UpperCamelCase       ,       )
							lowerCAmelCase_      			=			model(
							    _UpperCamelCase       ,       attention_mask=_UpperCamelCase       ,       encoder_hidden_states=_UpperCamelCase       ,       )
							lowerCAmelCase_      			=			model(_UpperCamelCase       ,       attention_mask=_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       ,       )       ->   Union[str, Any]:
							lowerCAmelCase_      			=			OpenLlamaForCausalLM(config=_UpperCamelCase  )
							model.to(_UpperCamelCase  )
							model.eval()
							lowerCAmelCase_      			=			model(_UpperCamelCase       ,       attention_mask=_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       ,       _UpperCamelCase       ,       _UpperCamelCase       ,       )       ->   Dict:
							lowerCAmelCase_      			=			True
							lowerCAmelCase_      			=			True
							lowerCAmelCase_      			=			OpenLlamaForCausalLM(config=_UpperCamelCase  )
							model.to(_UpperCamelCase  )
							model.eval()

							# first forward pass
							lowerCAmelCase_      			=			model(
							    _UpperCamelCase       ,       attention_mask=_UpperCamelCase       ,       encoder_hidden_states=_UpperCamelCase       ,       encoder_attention_mask=_UpperCamelCase       ,       use_cache=_UpperCamelCase       ,       )
							lowerCAmelCase_      			=			outputs.past_key_values

							# create hypothetical multiple next token and extent to next_input_ids
							lowerCAmelCase_      			=			ids_tensor((self.batch_size, 3)       ,       config.vocab_size  )
							lowerCAmelCase_      			=			ids_tensor((self.batch_size, 3)       ,       vocab_size=2  )

							# append to next input_ids and
							lowerCAmelCase_      			=			torch.cat([input_ids, next_tokens]       ,       dim=-1  )
							lowerCAmelCase_      			=			torch.cat([input_mask, next_mask]       ,       dim=-1  )

							lowerCAmelCase_      			=			model(
							    _UpperCamelCase       ,       attention_mask=_UpperCamelCase       ,       encoder_hidden_states=_UpperCamelCase       ,       encoder_attention_mask=_UpperCamelCase       ,       output_hidden_states=_UpperCamelCase       ,       )["hidden_states"][0]
							lowerCAmelCase_      			=			model(
							    _UpperCamelCase       ,       attention_mask=_UpperCamelCase       ,       encoder_hidden_states=_UpperCamelCase       ,       encoder_attention_mask=_UpperCamelCase       ,       past_key_values=_UpperCamelCase       ,       output_hidden_states=_UpperCamelCase       ,       )["hidden_states"][0]

							# select random slice
							lowerCAmelCase_      			=			ids_tensor((1,)       ,       output_from_past.shape[-1]  ).item()
							lowerCAmelCase_      			=			output_from_no_past[:, -3:, random_slice_idx].detach()
							lowerCAmelCase_      			=			output_from_past[:, :, random_slice_idx].detach()

							self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]  )

							# test that outputs are equal for slice
							self.parent.assertTrue(torch.allclose(_UpperCamelCase       ,       _UpperCamelCase       ,       atol=1e-3  )  )




				def   __a		(      self  )       ->   List[str]:
							lowerCAmelCase_      			=			self.prepare_config_and_inputs()
							(
							    (
							    lowerCAmelCase_
							)			,						(
							    lowerCAmelCase_
							)			,						(
							    lowerCAmelCase_
							)			,						(
							    lowerCAmelCase_
							)			,						(
							    lowerCAmelCase_
							)			,						(
							    lowerCAmelCase_
							)			,						(
							    lowerCAmelCase_
							)			,						
							)      			=			config_and_inputs
							lowerCAmelCase_      			=			{"input_ids": input_ids, "attention_mask": input_mask}
							return config, inputs_dict





@require_torch
class 			_lowerCAmelCase      (			__a      ,   __a      ,   __a      ,   unittest.TestCase ):
				_lowercase    	=(
				    (OpenLlamaModel, OpenLlamaForCausalLM, OpenLlamaForSequenceClassification) if is_torch_available() else ()
				)
				_lowercase    	=(OpenLlamaForCausalLM,) if is_torch_available() else ()
				_lowercase    	=(
				    {
				        '''feature-extraction''': OpenLlamaModel,
				        '''text-classification''': OpenLlamaForSequenceClassification,
				        '''text-generation''': OpenLlamaForCausalLM,
				        '''zero-shot''': OpenLlamaForSequenceClassification,
				    }
				    if is_torch_available()
				    else {}
				)
				_lowercase    	=False
				_lowercase    	=False




				def   __a		(      self  )       ->   List[Any]:
							lowerCAmelCase_      			=			OpenLlamaModelTester(self  )
							lowerCAmelCase_      			=			ConfigTester(self       ,       config_class=_UpperCamelCase       ,       hidden_size=37  )




				def   __a		(      self  )       ->   List[str]:
							self.config_tester.run_common_tests()




				def   __a		(      self  )       ->   Dict:
							lowerCAmelCase_      			=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*_UpperCamelCase  )




				def   __a		(      self  )       ->   List[str]:
							lowerCAmelCase_      			=			self.model_tester.prepare_config_and_inputs()
							for type in ["absolute", "relative_key", "relative_key_query"]:
										lowerCAmelCase_      			=			type
										self.model_tester.create_and_check_model(*_UpperCamelCase  )




				def   __a		(      self  )       ->   Optional[int]:
							lowerCAmelCase_			,						lowerCAmelCase_      			=			self.model_tester.prepare_config_and_inputs_for_common()
							lowerCAmelCase_      			=			3
							lowerCAmelCase_      			=			input_dict["input_ids"]
							lowerCAmelCase_      			=			input_ids.ne(1  ).to(_UpperCamelCase  )
							lowerCAmelCase_      			=			ids_tensor([self.model_tester.batch_size]       ,       self.model_tester.type_sequence_label_size  )
							lowerCAmelCase_      			=			OpenLlamaForSequenceClassification(_UpperCamelCase  )
							model.to(_UpperCamelCase  )
							model.eval()
							lowerCAmelCase_      			=			model(_UpperCamelCase       ,       attention_mask=_UpperCamelCase       ,       labels=_UpperCamelCase  )
							self.assertEqual(result.logits.shape       ,       (self.model_tester.batch_size, self.model_tester.num_labels)  )




				def   __a		(      self  )       ->   List[Any]:
							lowerCAmelCase_			,						lowerCAmelCase_      			=			self.model_tester.prepare_config_and_inputs_for_common()
							lowerCAmelCase_      			=			3
							lowerCAmelCase_      			=			"single_label_classification"
							lowerCAmelCase_      			=			input_dict["input_ids"]
							lowerCAmelCase_      			=			input_ids.ne(1  ).to(_UpperCamelCase  )
							lowerCAmelCase_      			=			ids_tensor([self.model_tester.batch_size]       ,       self.model_tester.type_sequence_label_size  )
							lowerCAmelCase_      			=			OpenLlamaForSequenceClassification(_UpperCamelCase  )
							model.to(_UpperCamelCase  )
							model.eval()
							lowerCAmelCase_      			=			model(_UpperCamelCase       ,       attention_mask=_UpperCamelCase       ,       labels=_UpperCamelCase  )
							self.assertEqual(result.logits.shape       ,       (self.model_tester.batch_size, self.model_tester.num_labels)  )




				def   __a		(      self  )       ->   Optional[Any]:
							lowerCAmelCase_			,						lowerCAmelCase_      			=			self.model_tester.prepare_config_and_inputs_for_common()
							lowerCAmelCase_      			=			3
							lowerCAmelCase_      			=			"multi_label_classification"
							lowerCAmelCase_      			=			input_dict["input_ids"]
							lowerCAmelCase_      			=			input_ids.ne(1  ).to(_UpperCamelCase  )
							lowerCAmelCase_      			=			ids_tensor(
							    [self.model_tester.batch_size, config.num_labels]       ,       self.model_tester.type_sequence_label_size  ).to(torch.float  )
							lowerCAmelCase_      			=			OpenLlamaForSequenceClassification(_UpperCamelCase  )
							model.to(_UpperCamelCase  )
							model.eval()
							lowerCAmelCase_      			=			model(_UpperCamelCase       ,       attention_mask=_UpperCamelCase       ,       labels=_UpperCamelCase  )
							self.assertEqual(result.logits.shape       ,       (self.model_tester.batch_size, self.model_tester.num_labels)  )




				@unittest.skip("Open-Llama buffers include complex numbers, which breaks this test"  )
				def   __a		(      self  )       ->   List[Any]:
							pass




				@parameterized.expand([("linear",), ("dynamic",)]  )
				def   __a		(      self       ,       _UpperCamelCase  )       ->   Dict:
							lowerCAmelCase_			,						lowerCAmelCase_      			=			self.model_tester.prepare_config_and_inputs_for_common()
							lowerCAmelCase_      			=			ids_tensor([1, 10]       ,       config.vocab_size  )
							lowerCAmelCase_      			=			ids_tensor([1, int(config.max_position_embeddings * 1.5  )]       ,       config.vocab_size  )

							set_seed(42  )  # Fixed seed at init time so the two models get the same random weights
							lowerCAmelCase_      			=			OpenLlamaModel(_UpperCamelCase  )
							original_model.to(_UpperCamelCase  )
							original_model.eval()
							lowerCAmelCase_      			=			original_model(_UpperCamelCase  ).last_hidden_state
							lowerCAmelCase_      			=			original_model(_UpperCamelCase  ).last_hidden_state

							set_seed(42  )  # Fixed seed at init time so the two models get the same random weights
							lowerCAmelCase_      			=			{"type": scaling_type, "factor": 10.0}
							lowerCAmelCase_      			=			OpenLlamaModel(_UpperCamelCase  )
							scaled_model.to(_UpperCamelCase  )
							scaled_model.eval()
							lowerCAmelCase_      			=			scaled_model(_UpperCamelCase  ).last_hidden_state
							lowerCAmelCase_      			=			scaled_model(_UpperCamelCase  ).last_hidden_state

							# Dynamic scaling does not change the RoPE embeddings until it receives an input longer than the original
							# maximum sequence length, so the outputs for the short input should match.
							if scaling_type == "dynamic":
										self.assertTrue(torch.allclose(_UpperCamelCase       ,       _UpperCamelCase       ,       atol=1e-5  )  )
							else:
										self.assertFalse(torch.allclose(_UpperCamelCase       ,       _UpperCamelCase       ,       atol=1e-5  )  )

							# The output should be different for long inputs
							self.assertFalse(torch.allclose(_UpperCamelCase       ,       _UpperCamelCase       ,       atol=1e-5  )  )





import os
import re
import shutil
import sys
import tempfile
import unittest

import black


_A     =  os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, "utils"))

import check_copies  # noqa: E402


# This is the reference code that will be used in the tests.
# If BertLMPredictionHead is changed in modeling_bert.py, this code needs to be manually updated.
_A     =  "    def __init__(self, config):\n        super().__init__()\n        self.transform = BertPredictionHeadTransform(config)\n\n        # The output weights are the same as the input embeddings, but there is\n        # an output-only bias for each token.\n        self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)\n\n        self.bias = nn.Parameter(torch.zeros(config.vocab_size))\n\n        # Need a link between the two variables so that the bias is correctly resized with `resize_token_embeddings`\n        self.decoder.bias = self.bias\n\n    def forward(self, hidden_states):\n        hidden_states = self.transform(hidden_states)\n        hidden_states = self.decoder(hidden_states)\n        return hidden_states\n"





class 			_lowerCAmelCase      (			unittest.TestCase ):




				def   __a		(      self  )       ->   Any:
							lowerCAmelCase_      			=			tempfile.mkdtemp()
							os.makedirs(os.path.join(self.transformer_dir       ,       "models/bert/"  )  )
							lowerCAmelCase_      			=			self.transformer_dir
							shutil.copy(
							    os.path.join(_UpperCamelCase       ,       "src/transformers/models/bert/modeling_bert.py"  )       ,       os.path.join(self.transformer_dir       ,       "models/bert/modeling_bert.py"  )       ,       )




				def   __a		(      self  )       ->   List[Any]:
							lowerCAmelCase_      			=			"src/transformers"
							shutil.rmtree(self.transformer_dir  )




				def   __a		(      self       ,       _UpperCamelCase       ,       _UpperCamelCase       ,       _UpperCamelCase       ,       _UpperCamelCase=None  )       ->   Optional[int]:
							lowerCAmelCase_      			=			comment + f"""\nclass {class_name}(nn.Module):\n""" + class_code
							if overwrite_result is not None:
										lowerCAmelCase_      			=			comment + f"""\nclass {class_name}(nn.Module):\n""" + overwrite_result
							lowerCAmelCase_      			=			black.Mode(target_versions={black.TargetVersion.PYaa}       ,       line_length=119  )
							lowerCAmelCase_      			=			black.format_str(_UpperCamelCase       ,       mode=_UpperCamelCase  )
							lowerCAmelCase_      			=			os.path.join(self.transformer_dir       ,       "new_code.py"  )
							with open(_UpperCamelCase       ,       "w"       ,       newline="\n"  ) as f:
										f.write(_UpperCamelCase  )
							if overwrite_result is None:
										self.assertTrue(len(check_copies.is_copy_consistent(_UpperCamelCase  )  ) == 0  )
							else:
										check_copies.is_copy_consistent(f.name       ,       overwrite=_UpperCamelCase  )
										with open(_UpperCamelCase       ,       "r"  ) as f:
													self.assertTrue(f.read()       ,       _UpperCamelCase  )




				def   __a		(      self  )       ->   Any:
							lowerCAmelCase_      			=			check_copies.find_code_in_transformers("models.bert.modeling_bert.BertLMPredictionHead"  )
							self.assertEqual(_UpperCamelCase       ,       _UpperCamelCase  )




				def   __a		(      self  )       ->   Any:
							# Base copy consistency
							self.check_copy_consistency(
							    "# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead"       ,       "BertLMPredictionHead"       ,       REFERENCE_CODE + "\n"       ,       )

							# With no empty line at the end
							self.check_copy_consistency(
							    "# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead"       ,       "BertLMPredictionHead"       ,       _UpperCamelCase       ,       )

							# Copy consistency with rename
							self.check_copy_consistency(
							    "# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead with Bert->TestModel"       ,       "TestModelLMPredictionHead"       ,       re.sub("Bert"       ,       "TestModel"       ,       _UpperCamelCase  )       ,       )

							# Copy consistency with a really long name
							lowerCAmelCase_      			=			"TestModelWithAReallyLongNameBecauseSomePeopleLikeThatForSomeReason"
							self.check_copy_consistency(
							    f"""# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead with Bert->{long_class_name}"""       ,       f"""{long_class_name}LMPredictionHead"""       ,       re.sub("Bert"       ,       _UpperCamelCase       ,       _UpperCamelCase  )       ,       )

							# Copy consistency with overwrite
							self.check_copy_consistency(
							    "# Copied from transformers.models.bert.modeling_bert.BertLMPredictionHead with Bert->TestModel"       ,       "TestModelLMPredictionHead"       ,       _UpperCamelCase       ,       overwrite_result=re.sub("Bert"       ,       "TestModel"       ,       _UpperCamelCase  )       ,       )




				def   __a		(      self  )       ->   Any:
							lowerCAmelCase_      			=			check_copies.LOCALIZED_READMES["README_zh-hans.md"]

							lowerCAmelCase_      			=			(
							    "1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (from Google Research and the"
							    " Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for"
							    " Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), by Zhenzhong"
							    " Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.\n1."
							    " **[DistilBERT](https://huggingface.co/transformers/model_doc/distilbert.html)** (from HuggingFace),"
							    " released together with the paper [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and"
							    " lighter](https://arxiv.org/abs/1910.01108) by Victor Sanh, Lysandre Debut and Thomas Wolf. The same"
							    " method has been applied to compress GPT2 into"
							    " [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/distillation), RoBERTa into"
							    " [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/distillation),"
							    " Multilingual BERT into"
							    " [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/distillation) and a German"
							    " version of DistilBERT.\n1. **[ELECTRA](https://huggingface.co/transformers/model_doc/electra.html)**"
							    " (from Google Research/Stanford University) released with the paper [ELECTRA: Pre-training text encoders"
							    " as discriminators rather than generators](https://arxiv.org/abs/2003.10555) by Kevin Clark, Minh-Thang"
							    " Luong, Quoc V. Le, Christopher D. Manning."
							)
							lowerCAmelCase_      			=			(
							    "1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (来自 Google Research and the"
							    " Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of"
							    " Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian"
							    " Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。\n"
							)
							lowerCAmelCase_      			=			(
							    "1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (来自 Google Research and the"
							    " Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of"
							    " Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian"
							    " Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。\n1."
							    " **[DistilBERT](https://huggingface.co/transformers/model_doc/distilbert.html)** (来自 HuggingFace) 伴随论文"
							    " [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and"
							    " lighter](https://arxiv.org/abs/1910.01108) 由 Victor Sanh, Lysandre Debut and Thomas Wolf 发布。 The same"
							    " method has been applied to compress GPT2 into"
							    " [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/distillation), RoBERTa into"
							    " [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/distillation),"
							    " Multilingual BERT into"
							    " [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/distillation) and a German"
							    " version of DistilBERT.\n1. **[ELECTRA](https://huggingface.co/transformers/model_doc/electra.html)** (来自"
							    " Google Research/Stanford University) 伴随论文 [ELECTRA: Pre-training text encoders as discriminators rather"
							    " than generators](https://arxiv.org/abs/2003.10555) 由 Kevin Clark, Minh-Thang Luong, Quoc V. Le,"
							    " Christopher D. Manning 发布。\n"
							)

							lowerCAmelCase_			,						lowerCAmelCase_      			=			check_copies.convert_to_localized_md(
							    _UpperCamelCase       ,       _UpperCamelCase       ,       localized_readme["format_model_list"]  )

							self.assertFalse(_UpperCamelCase  )
							self.assertEqual(_UpperCamelCase       ,       _UpperCamelCase  )

							lowerCAmelCase_			,						lowerCAmelCase_      			=			check_copies.convert_to_localized_md(
							    _UpperCamelCase       ,       _UpperCamelCase       ,       localized_readme["format_model_list"]  )

							# Check whether the number of models is equal to README.md after conversion.
							self.assertTrue(_UpperCamelCase  )

							lowerCAmelCase_      			=			(
							    "1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (from Google Research and the"
							    " Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for"
							    " Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), by Zhenzhong"
							    " Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut."
							)
							lowerCAmelCase_      			=			(
							    "1. **[ALBERT](https://huggingface.co/transformers/main/model_doc/albert.html)** (来自 Google Research and"
							    " the Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of"
							    " Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian"
							    " Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。\n"
							)
							lowerCAmelCase_      			=			(
							    "1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (来自 Google Research and the"
							    " Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of"
							    " Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian"
							    " Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。\n"
							)

							lowerCAmelCase_			,						lowerCAmelCase_      			=			check_copies.convert_to_localized_md(
							    _UpperCamelCase       ,       _UpperCamelCase       ,       localized_readme["format_model_list"]  )

							# Check if the model link is synchronized.
							self.assertEqual(_UpperCamelCase       ,       _UpperCamelCase  )



