
import copy
import inspect
import unittest

import numpy as np
from huggingface_hub import hf_hub_download

from transformers import VideoMAEConfig
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

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


if is_torch_available():
     import torch
     from torch import nn

     from transformers import (
         MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING,
         VideoMAEForPreTraining,
         VideoMAEForVideoClassification,
         VideoMAEModel,
     )
     from transformers.models.videomae.modeling_videomae import VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
     from transformers import VideoMAEImageProcessor




class 					_SCREAMING_SNAKE_CASE  :
      def __init__(			self		,	lowerCamelCase		,	lowerCamelCase=13		,	lowerCamelCase=10		,	lowerCamelCase=3		,	lowerCamelCase=2		,	lowerCamelCase=2		,	lowerCamelCase=2		,	lowerCamelCase=True		,	lowerCamelCase=True		,	lowerCamelCase=32		,	lowerCamelCase=5		,	lowerCamelCase=4		,	lowerCamelCase=37		,	lowerCamelCase="gelu"		,	lowerCamelCase=0.1		,	lowerCamelCase=0.1		,	lowerCamelCase=10		,	lowerCamelCase=0.0_2		,	lowerCamelCase=0.9		,	lowerCamelCase=None		,	):
          snake_case__						=				parent
          snake_case__						=				batch_size
          snake_case__						=				image_size
          snake_case__						=				num_channels
          snake_case__						=				patch_size
          snake_case__						=				tubelet_size
          snake_case__						=				num_frames
          snake_case__						=				is_training
          snake_case__						=				use_labels
          snake_case__						=				hidden_size
          snake_case__						=				num_hidden_layers
          snake_case__						=				num_attention_heads
          snake_case__						=				intermediate_size
          snake_case__						=				hidden_act
          snake_case__						=				hidden_dropout_prob
          snake_case__						=				attention_probs_dropout_prob
          snake_case__						=				type_sequence_label_size
          snake_case__						=				initializer_range
          snake_case__						=				mask_ratio
          snake_case__						=				scope

          # in VideoMAE, the number of tokens equals num_frames/tubelet_size * num_patches per frame
          snake_case__						=				(image_size // patch_size) ** 2
          snake_case__						=				(num_frames // tubelet_size) * self.num_patches_per_frame

          # use this variable to define bool_masked_pos
          snake_case__						=				int(mask_ratio * self.seq_length )
      def A_			(			self ):
          snake_case__						=				floats_tensor(
              [self.batch_size, self.num_frames, self.num_channels, self.image_size, self.image_size] )

          snake_case__						=				None
          if self.use_labels:
              snake_case__						=				ids_tensor([self.batch_size]		,	self.type_sequence_label_size )

          snake_case__						=				self.get_config()

          return config, pixel_values, labels
      def A_			(			self ):
          return VideoMAEConfig(
              image_size=self.image_size		,	patch_size=self.patch_size		,	num_channels=self.num_channels		,	num_frames=self.num_frames		,	tubelet_size=self.tubelet_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		,	is_decoder=lowerCamelCase		,	initializer_range=self.initializer_range		,	)
      def A_			(			self		,	lowerCamelCase		,	lowerCamelCase		,	lowerCamelCase ):
          snake_case__						=				VideoMAEModel(config=lowerCamelCase )
          model.to(lowerCamelCase )
          model.eval()
          snake_case__						=				model(lowerCamelCase )
          self.parent.assertEqual(result.last_hidden_state.shape		,	(self.batch_size, self.seq_length, self.hidden_size) )
      def A_			(			self		,	lowerCamelCase		,	lowerCamelCase		,	lowerCamelCase ):
          snake_case__						=				VideoMAEForPreTraining(lowerCamelCase )
          model.to(lowerCamelCase )
          model.eval()
          # important: each video needs to have the same number of masked patches
          # hence we define a single mask, which we then repeat for each example in the batch
          snake_case__						=				torch.ones((self.num_masks,) )
          snake_case__						=				torch.cat([mask, torch.zeros(self.seq_length - mask.size(0 ) )] )
          snake_case__						=				mask.expand(self.batch_size		,	-1 ).bool()

          snake_case__						=				model(lowerCamelCase		,	lowerCamelCase )
          # model only returns predictions for masked patches
          snake_case__						=				mask.sum().item()
          snake_case__						=				3 * self.tubelet_size * self.patch_size**2
          self.parent.assertEqual(result.logits.shape		,	(self.batch_size, num_masked_patches, decoder_num_labels) )



      def A_			(			self ):
          snake_case__						=				self.prepare_config_and_inputs()
          snake_case__						,					snake_case__						,					snake_case__						=				config_and_inputs
          snake_case__						=				{"pixel_values": pixel_values}
          return config, inputs_dict





@require_torch
class 					_SCREAMING_SNAKE_CASE  (      __UpperCamelCase       ,					__UpperCamelCase       ,					unittest.TestCase ):
      _A						:		List[str]    	=     (
          (VideoMAEModel, VideoMAEForPreTraining, VideoMAEForVideoClassification) if is_torch_available() else ()
      )
      _A						:		int    	=     (
          {'feature-extraction': VideoMAEModel, 'video-classification': VideoMAEForVideoClassification}
          if is_torch_available()
          else {}
      )

      _A						:		Dict    	=     False
      _A						:		Union[str, Any]    	=     False
      _A						:		Any    	=     False
      _A						:		int    	=     False
      def A_			(			self ):
          snake_case__						=				VideoMAEModelTester(self )
          snake_case__						=				ConfigTester(self		,	config_class=lowerCamelCase		,	has_text_modality=lowerCamelCase		,	hidden_size=37 )
      def A_			(			self		,	lowerCamelCase		,	lowerCamelCase		,	lowerCamelCase=False ):
          snake_case__						=				copy.deepcopy(lowerCamelCase )

          if model_class == VideoMAEForPreTraining:
              # important: each video needs to have the same number of masked patches
              # hence we define a single mask, which we then repeat for each example in the batch
              snake_case__						=				torch.ones((self.model_tester.num_masks,) )
              snake_case__						=				torch.cat([mask, torch.zeros(self.model_tester.seq_length - mask.size(0 ) )] )
              snake_case__						=				mask.expand(self.model_tester.batch_size		,	-1 ).bool()
              snake_case__						=				bool_masked_pos.to(lowerCamelCase )

          if return_labels:
              if model_class in [
                  *get_values(lowerCamelCase ),
              ]:
                  snake_case__						=				torch.zeros(
                      self.model_tester.batch_size		,	dtype=torch.long		,	device=lowerCamelCase )

          return inputs_dict
      def A_			(			self ):
          self.config_tester.run_common_tests()
      @unittest.skip(reason="VideoMAE does not use inputs_embeds" )
      def A_			(			self ):
          pass
      def A_			(			self ):
          snake_case__						,					snake_case__						=				self.model_tester.prepare_config_and_inputs_for_common()

          for model_class in self.all_model_classes:
              snake_case__						=				model_class(lowerCamelCase )
              self.assertIsInstance(model.get_input_embeddings()		,	(nn.Module) )
              snake_case__						=				model.get_output_embeddings()
              self.assertTrue(x is None or isinstance(lowerCamelCase		,	nn.Linear ) )
      def A_			(			self ):
          snake_case__						,					snake_case__						=				self.model_tester.prepare_config_and_inputs_for_common()

          for model_class in self.all_model_classes:
              snake_case__						=				model_class(lowerCamelCase )
              snake_case__						=				inspect.signature(model.forward )
              # signature.parameters is an OrderedDict => so arg_names order is deterministic
              snake_case__						=				[*signature.parameters.keys()]

              snake_case__						=				["pixel_values"]
              self.assertListEqual(arg_names[:1]		,	lowerCamelCase )
      def A_			(			self ):
          snake_case__						=				self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_model(*lowerCamelCase )
      def A_			(			self ):
          snake_case__						=				self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_pretraining(*lowerCamelCase )
      @slow
      def A_			(			self ):
          for model_name in VIDEOMAE_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              snake_case__						=				VideoMAEModel.from_pretrained(lowerCamelCase )
              self.assertIsNotNone(lowerCamelCase )
      def A_			(			self ):
          if not self.has_attentions:
              pass

          else:
              snake_case__						,					snake_case__						=				self.model_tester.prepare_config_and_inputs_for_common()
              snake_case__						=				True

              for model_class in self.all_model_classes:
                  snake_case__						=				self.model_tester.seq_length - self.model_tester.num_masks
                  snake_case__						=				(
                      num_visible_patches if model_class == VideoMAEForPreTraining else self.model_tester.seq_length
                  )

                  snake_case__						=				True
                  snake_case__						=				False
                  snake_case__						=				True
                  snake_case__						=				model_class(lowerCamelCase )
                  model.to(lowerCamelCase )
                  model.eval()
                  with torch.no_grad():
                      snake_case__						=				model(**self._prepare_for_class(lowerCamelCase		,	lowerCamelCase ) )
                  snake_case__						=				outputs.attentions
                  self.assertEqual(len(lowerCamelCase )		,	self.model_tester.num_hidden_layers )

                  # check that output_attentions also work using config
                  del inputs_dict["output_attentions"]
                  snake_case__						=				True
                  snake_case__						=				model_class(lowerCamelCase )
                  model.to(lowerCamelCase )
                  model.eval()
                  with torch.no_grad():
                      snake_case__						=				model(**self._prepare_for_class(lowerCamelCase		,	lowerCamelCase ) )
                  snake_case__						=				outputs.attentions
                  self.assertEqual(len(lowerCamelCase )		,	self.model_tester.num_hidden_layers )

                  self.assertListEqual(
                      list(attentions[0].shape[-3:] )		,	[self.model_tester.num_attention_heads, seq_len, seq_len]		,	)
                  snake_case__						=				len(lowerCamelCase )

                  # Check attention is always last and order is fine
                  snake_case__						=				True
                  snake_case__						=				True
                  snake_case__						=				model_class(lowerCamelCase )
                  model.to(lowerCamelCase )
                  model.eval()
                  with torch.no_grad():
                      snake_case__						=				model(**self._prepare_for_class(lowerCamelCase		,	lowerCamelCase ) )

                  self.assertEqual(out_len + 1		,	len(lowerCamelCase ) )

                  snake_case__						=				outputs.attentions

                  self.assertEqual(len(lowerCamelCase )		,	self.model_tester.num_hidden_layers )
                  self.assertListEqual(
                      list(self_attentions[0].shape[-3:] )		,	[self.model_tester.num_attention_heads, seq_len, seq_len]		,	)
      def A_			(			self ):
          def check_hidden_states_output(lowerCamelCase		,	lowerCamelCase		,	lowerCamelCase ):
              snake_case__						=				model_class(lowerCamelCase )
              model.to(lowerCamelCase )
              model.eval()

              with torch.no_grad():
                  snake_case__						=				model(**self._prepare_for_class(lowerCamelCase		,	lowerCamelCase ) )

              snake_case__						=				outputs.hidden_states
              snake_case__						=				self.model_tester.num_hidden_layers + 1
              self.assertEqual(len(lowerCamelCase )		,	lowerCamelCase )

              snake_case__						=				self.model_tester.seq_length - self.model_tester.num_masks
              snake_case__						=				num_visible_patches if model_class == VideoMAEForPreTraining else self.model_tester.seq_length

              self.assertListEqual(
                  list(hidden_states[0].shape[-2:] )		,	[seq_length, self.model_tester.hidden_size]		,	)

          snake_case__						,					snake_case__						=				self.model_tester.prepare_config_and_inputs_for_common()

          for model_class in self.all_model_classes:
              snake_case__						=				True
              check_hidden_states_output(lowerCamelCase		,	lowerCamelCase		,	lowerCamelCase )

              # check that output_hidden_states also work using config
              del inputs_dict["output_hidden_states"]
              snake_case__						=				True

              check_hidden_states_output(lowerCamelCase		,	lowerCamelCase		,	lowerCamelCase )



      @unittest.skip("Will be fixed soon by reducing the size of the model used for common tests." )
      def A_			(			self ):
          pass





def 	SCREAMING_SNAKE_CASE__    (      ):
    snake_case__						=				hf_hub_download(
        repo_id="hf-internal-testing/spaghetti-video"    ,		filename="eating_spaghetti.npy"    ,		repo_type="dataset"							)
    snake_case__						=				np.load(__lowerCAmelCase							)
    return list(__lowerCAmelCase							)





@require_torch
@require_vision
class 					_SCREAMING_SNAKE_CASE  (      unittest.TestCase ):
      @cached_property
      def A_			(			self ):
          # logits were tested with a different mean and std, so we use the same here
          return (
              VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5]		,	image_std=[0.5, 0.5, 0.5] )
              if is_vision_available()
              else None
          )
      @slow
      def A_			(			self ):
          snake_case__						=				VideoMAEForVideoClassification.from_pretrained("MCG-NJU/videomae-base-finetuned-kinetics" ).to(
              lowerCamelCase )

          snake_case__						=				self.default_image_processor
          snake_case__						=				prepare_video()
          snake_case__						=				image_processor(lowerCamelCase		,	return_tensors="pt" ).to(lowerCamelCase )

          # forward pass
          with torch.no_grad():
              snake_case__						=				model(**lowerCamelCase )

          # verify the logits
          snake_case__						=				torch.Size((1, 4_00) )
          self.assertEqual(outputs.logits.shape		,	lowerCamelCase )

          snake_case__						=				torch.tensor([0.3_6_6_9, -0.0_6_8_8, -0.2_4_2_1] ).to(lowerCamelCase )

          self.assertTrue(torch.allclose(outputs.logits[0, :3]		,	lowerCamelCase		,	atol=1e-4 ) )



      @slow
      def A_			(			self ):
          snake_case__						=				VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-base-short" ).to(lowerCamelCase )

          snake_case__						=				self.default_image_processor
          snake_case__						=				prepare_video()
          snake_case__						=				image_processor(lowerCamelCase		,	return_tensors="pt" ).to(lowerCamelCase )

          # add boolean mask, indicating which patches to mask
          snake_case__						=				hf_hub_download(repo_id="hf-internal-testing/bool-masked-pos"		,	filename="bool_masked_pos.pt" )
          snake_case__						=				torch.load(lowerCamelCase )

          # forward pass
          with torch.no_grad():
              snake_case__						=				model(**lowerCamelCase )

          # verify the logits
          snake_case__						=				torch.Size([1, 14_08, 15_36] )
          snake_case__						=				torch.tensor(
              [[0.7_9_9_4, 0.9_6_1_2, 0.8_5_0_8], [0.7_4_0_1, 0.8_9_5_8, 0.8_3_0_2], [0.5_8_6_2, 0.7_4_6_8, 0.7_3_2_5]]		,	device=lowerCamelCase )
          self.assertEqual(outputs.logits.shape		,	lowerCamelCase )
          self.assertTrue(torch.allclose(outputs.logits[0, :3, :3]		,	lowerCamelCase		,	atol=1e-4 ) )

          # verify the loss (`config.norm_pix_loss` = `True`)
          snake_case__						=				torch.tensor([0.5_1_4_2]		,	device=lowerCamelCase )
          self.assertTrue(torch.allclose(outputs.loss		,	lowerCamelCase		,	atol=1e-4 ) )

          # verify the loss (`config.norm_pix_loss` = `False`)
          snake_case__						=				VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-base-short"		,	norm_pix_loss=lowerCamelCase ).to(
              lowerCamelCase )

          with torch.no_grad():
              snake_case__						=				model(**lowerCamelCase )

          snake_case__						=				torch.tensor(torch.tensor([0.6_4_6_9] )		,	device=lowerCamelCase )
          self.assertTrue(torch.allclose(outputs.loss		,	lowerCamelCase		,	atol=1e-4 ) )





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

import black


__magic_name__            =  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.
__magic_name__            =  '''    def __init__(self, config):
        super().__init__()
        self.transform = BertPredictionHeadTransform(config)

        # The output weights are the same as the input embeddings, but there is
        # an output-only bias for each token.
        self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)

        self.bias = nn.Parameter(torch.zeros(config.vocab_size))

        # Need a link between the two variables so that the bias is correctly resized with `resize_token_embeddings`
        self.decoder.bias = self.bias

    def forward(self, hidden_states):
        hidden_states = self.transform(hidden_states)
        hidden_states = self.decoder(hidden_states)
        return hidden_states
'''




class 					_SCREAMING_SNAKE_CASE  (      unittest.TestCase ):
      def A_			(			self ):
          snake_case__						=				tempfile.mkdtemp()
          os.makedirs(os.path.join(self.transformer_dir		,	"models/bert/" ) )
          snake_case__						=				self.transformer_dir
          shutil.copy(
              os.path.join(lowerCamelCase		,	"src/transformers/models/bert/modeling_bert.py" )		,	os.path.join(self.transformer_dir		,	"models/bert/modeling_bert.py" )		,	)
      def A_			(			self ):
          snake_case__						=				"src/transformers"
          shutil.rmtree(self.transformer_dir )
      def A_			(			self		,	lowerCamelCase		,	lowerCamelCase		,	lowerCamelCase		,	lowerCamelCase=None ):
          snake_case__						=				comment + F"""\nclass {class_name}(nn.Module):\n""" + class_code
          if overwrite_result is not None:
              snake_case__						=				comment + F"""\nclass {class_name}(nn.Module):\n""" + overwrite_result
          snake_case__						=				black.Mode(target_versions={black.TargetVersion.PYaa}		,	line_length=1_19 )
          snake_case__						=				black.format_str(lowerCamelCase		,	mode=lowerCamelCase )
          snake_case__						=				os.path.join(self.transformer_dir		,	"new_code.py" )
          with open(lowerCamelCase		,	"w"		,	newline="\n" ) as f:
              f.write(lowerCamelCase )
          if overwrite_result is None:
              self.assertTrue(len(check_copies.is_copy_consistent(lowerCamelCase ) ) == 0 )
          else:
              check_copies.is_copy_consistent(f.name		,	overwrite=lowerCamelCase )
              with open(lowerCamelCase		,	"r" ) as f:
                  self.assertTrue(f.read()		,	lowerCamelCase )
      def A_			(			self ):
          snake_case__						=				check_copies.find_code_in_transformers("models.bert.modeling_bert.BertLMPredictionHead" )
          self.assertEqual(lowerCamelCase		,	lowerCamelCase )
      def A_			(			self ):
          # 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"		,	lowerCamelCase		,	)

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

          # Copy consistency with a really long name
          snake_case__						=				"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"		,	lowerCamelCase		,	lowerCamelCase )		,	)

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



      def A_			(			self ):
          snake_case__						=				check_copies.LOCALIZED_READMES["README_zh-hans.md"]

          snake_case__						=				(
              "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."
          )
          snake_case__						=				(
              "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"
          )
          snake_case__						=				(
              "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"
          )

          snake_case__						,					snake_case__						=				check_copies.convert_to_localized_md(
              lowerCamelCase		,	lowerCamelCase		,	localized_readme["format_model_list"] )

          self.assertFalse(lowerCamelCase )
          self.assertEqual(lowerCamelCase		,	lowerCamelCase )

          snake_case__						,					snake_case__						=				check_copies.convert_to_localized_md(
              lowerCamelCase		,	lowerCamelCase		,	localized_readme["format_model_list"] )

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

          snake_case__						=				(
              "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."
          )
          snake_case__						=				(
              "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"
          )
          snake_case__						=				(
              "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"
          )

          snake_case__						,					snake_case__						=				check_copies.convert_to_localized_md(
              lowerCamelCase		,	lowerCamelCase		,	localized_readme["format_model_list"] )

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



