




'''simple docstring'''


import json
import pathlib
import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision, slow
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
	import torch

if is_vision_available():
	from PIL import Image

	from transformers import DetrImageProcessor
class 						a_				(			unittest.TestCase						):




	def __init__(       self     :  str       ,		__lowerCAmelCase     :  Dict       ,		__lowerCAmelCase     :  Tuple=7       ,		__lowerCAmelCase     :  Any=3       ,		__lowerCAmelCase     :  Tuple=3_0       ,		__lowerCAmelCase     :  List[Any]=4_0_0       ,		__lowerCAmelCase     :  Optional[Any]=True       ,		__lowerCAmelCase     :  Union[str, Any]=None       ,		__lowerCAmelCase     :  Optional[Any]=True       ,		__lowerCAmelCase     :  List[Any]=1 / 2_5_5       ,		__lowerCAmelCase     :  Optional[int]=True       ,		__lowerCAmelCase     :  Optional[Any]=[0.5, 0.5, 0.5]       ,		__lowerCAmelCase     :  str=[0.5, 0.5, 0.5]       ,		__lowerCAmelCase     :  Union[str, Any]=True       ,		):
							# by setting size["longest_edge"] > max_resolution we're effectively not testing this :p
							__snake_case						 =   size if size is not None else {'shortest_edge': 1_8, 'longest_edge': 1_3_3_3}
							__snake_case						 =   parent
							__snake_case						 =   batch_size
							__snake_case						 =   num_channels
							__snake_case						 =   min_resolution
							__snake_case						 =   max_resolution
							__snake_case						 =   do_resize
							__snake_case						 =   size
							__snake_case						 =   do_rescale
							__snake_case						 =   rescale_factor
							__snake_case						 =   do_normalize
							__snake_case						 =   image_mean
							__snake_case						 =   image_std
							__snake_case						 =   do_pad




	def   lowercase__   (       self     :  int      ):
							return {
							    "do_resize": self.do_resize,
							    "size": self.size,
							    "do_rescale": self.do_rescale,
							    "rescale_factor": self.rescale_factor,
							    "do_normalize": self.do_normalize,
							    "image_mean": self.image_mean,
							    "image_std": self.image_std,
							    "do_pad": self.do_pad,
							}




	def   lowercase__   (       self     :  Tuple       ,		__lowerCAmelCase     :  Union[str, Any]       ,		__lowerCAmelCase     :  str=False      ):
							if not batched:
													__snake_case						 =   image_inputs[0]
													if isinstance(__lowerCAmelCase       ,		Image.Image      ):
																			__snake_case ,       __snake_case						 =   image.size
													else:
																			__snake_case ,       __snake_case						 =   image.shape[1], image.shape[2]
													if w < h:
																			__snake_case						 =   int(self.size['shortest_edge'] * h / w      )
																			__snake_case						 =   self.size['shortest_edge']
													elif w > h:
																			__snake_case						 =   self.size['shortest_edge']
																			__snake_case						 =   int(self.size['shortest_edge'] * w / h      )
													else:
																			__snake_case						 =   self.size['shortest_edge']
																			__snake_case						 =   self.size['shortest_edge']

							else:
													__snake_case						 =   []
													for image in image_inputs:
																			__snake_case ,       __snake_case						 =   self.get_expected_values([image]      )
																			expected_values.append((expected_height, expected_width)      )
													__snake_case						 =   max(__lowerCAmelCase       ,		key=lambda __lowerCAmelCase      : item[0]      )[0]
													__snake_case						 =   max(__lowerCAmelCase       ,		key=lambda __lowerCAmelCase      : item[1]      )[1]

							return expected_height, expected_width





@require_torch
@require_vision
class 						a_				(			UpperCAmelCase__     ,						unittest.TestCase						):
	lowercase_       :     List[Any]			  =      DetrImageProcessor if is_vision_available() else None




	def   lowercase__   (       self     :  Union[str, Any]      ):
							__snake_case						 =   DetrImageProcessingTester(self      )




	@property
	def   lowercase__   (       self     :  Dict      ):
							return self.image_processor_tester.prepare_image_processor_dict()




	def   lowercase__   (       self     :  Dict      ):
							__snake_case						 =   self.image_processing_class(**self.image_processor_dict      )
							self.assertTrue(hasattr(__lowerCAmelCase       ,		'image_mean'      )      )
							self.assertTrue(hasattr(__lowerCAmelCase       ,		'image_std'      )      )
							self.assertTrue(hasattr(__lowerCAmelCase       ,		'do_normalize'      )      )
							self.assertTrue(hasattr(__lowerCAmelCase       ,		'do_rescale'      )      )
							self.assertTrue(hasattr(__lowerCAmelCase       ,		'rescale_factor'      )      )
							self.assertTrue(hasattr(__lowerCAmelCase       ,		'do_resize'      )      )
							self.assertTrue(hasattr(__lowerCAmelCase       ,		'size'      )      )
							self.assertTrue(hasattr(__lowerCAmelCase       ,		'do_pad'      )      )




	def   lowercase__   (       self     :  int      ):
							__snake_case						 =   self.image_processing_class.from_dict(self.image_processor_dict      )
							self.assertEqual(image_processor.size       ,		{'shortest_edge': 1_8, 'longest_edge': 1_3_3_3}      )
							self.assertEqual(image_processor.do_pad       ,		__lowerCAmelCase      )

							__snake_case						 =   self.image_processing_class.from_dict(
							    self.image_processor_dict       ,		size=4_2       ,		max_size=8_4       ,		pad_and_return_pixel_mask=__lowerCAmelCase      )
							self.assertEqual(image_processor.size       ,		{'shortest_edge': 4_2, 'longest_edge': 8_4}      )
							self.assertEqual(image_processor.do_pad       ,		__lowerCAmelCase      )




	def   lowercase__   (       self     :  Dict      ):
							pass




	def   lowercase__   (       self     :  List[Any]      ):
							# Initialize image_processing
							__snake_case						 =   self.image_processing_class(**self.image_processor_dict      )
							# create random PIL images
							__snake_case						 =   prepare_image_inputs(self.image_processor_tester       ,		equal_resolution=__lowerCAmelCase      )
							for image in image_inputs:
													self.assertIsInstance(__lowerCAmelCase       ,		Image.Image      )

							# Test not batched input
							__snake_case						 =   image_processing(image_inputs[0]       ,		return_tensors='pt'      ).pixel_values

							__snake_case ,       __snake_case						 =   self.image_processor_tester.get_expected_values(__lowerCAmelCase      )

							self.assertEqual(
							    encoded_images.shape       ,		(1, self.image_processor_tester.num_channels, expected_height, expected_width)       ,		)

							# Test batched
							__snake_case ,       __snake_case						 =   self.image_processor_tester.get_expected_values(__lowerCAmelCase       ,		batched=__lowerCAmelCase      )

							__snake_case						 =   image_processing(__lowerCAmelCase       ,		return_tensors='pt'      ).pixel_values
							self.assertEqual(
							    encoded_images.shape       ,		(
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        expected_height,
							        expected_width,
							    )       ,		)




	def   lowercase__   (       self     :  Any      ):
							# Initialize image_processing
							__snake_case						 =   self.image_processing_class(**self.image_processor_dict      )
							# create random numpy tensors
							__snake_case						 =   prepare_image_inputs(self.image_processor_tester       ,		equal_resolution=__lowerCAmelCase       ,		numpify=__lowerCAmelCase      )
							for image in image_inputs:
													self.assertIsInstance(__lowerCAmelCase       ,		np.ndarray      )

							# Test not batched input
							__snake_case						 =   image_processing(image_inputs[0]       ,		return_tensors='pt'      ).pixel_values

							__snake_case ,       __snake_case						 =   self.image_processor_tester.get_expected_values(__lowerCAmelCase      )

							self.assertEqual(
							    encoded_images.shape       ,		(1, self.image_processor_tester.num_channels, expected_height, expected_width)       ,		)

							# Test batched
							__snake_case						 =   image_processing(__lowerCAmelCase       ,		return_tensors='pt'      ).pixel_values

							__snake_case ,       __snake_case						 =   self.image_processor_tester.get_expected_values(__lowerCAmelCase       ,		batched=__lowerCAmelCase      )

							self.assertEqual(
							    encoded_images.shape       ,		(
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        expected_height,
							        expected_width,
							    )       ,		)




	def   lowercase__   (       self     :  Dict      ):
							# Initialize image_processing
							__snake_case						 =   self.image_processing_class(**self.image_processor_dict      )
							# create random PyTorch tensors
							__snake_case						 =   prepare_image_inputs(self.image_processor_tester       ,		equal_resolution=__lowerCAmelCase       ,		torchify=__lowerCAmelCase      )
							for image in image_inputs:
													self.assertIsInstance(__lowerCAmelCase       ,		torch.Tensor      )

							# Test not batched input
							__snake_case						 =   image_processing(image_inputs[0]       ,		return_tensors='pt'      ).pixel_values

							__snake_case ,       __snake_case						 =   self.image_processor_tester.get_expected_values(__lowerCAmelCase      )

							self.assertEqual(
							    encoded_images.shape       ,		(1, self.image_processor_tester.num_channels, expected_height, expected_width)       ,		)

							# Test batched
							__snake_case						 =   image_processing(__lowerCAmelCase       ,		return_tensors='pt'      ).pixel_values

							__snake_case ,       __snake_case						 =   self.image_processor_tester.get_expected_values(__lowerCAmelCase       ,		batched=__lowerCAmelCase      )

							self.assertEqual(
							    encoded_images.shape       ,		(
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        expected_height,
							        expected_width,
							    )       ,		)




	@slow
	def   lowercase__   (       self     :  Tuple      ):
							# prepare image and target
							__snake_case						 =   Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'      )
							with open('./tests/fixtures/tests_samples/COCO/coco_annotations.txt'       ,		'r'      ) as f:
													__snake_case						 =   json.loads(f.read()      )

							__snake_case						 =   {'image_id': 3_9_7_6_9, 'annotations': target}

							# encode them
							__snake_case						 =   DetrImageProcessor.from_pretrained('facebook/detr-resnet-50'      )
							__snake_case						 =   image_processing(images=__lowerCAmelCase       ,		annotations=__lowerCAmelCase       ,		return_tensors='pt'      )

							# verify pixel values
							__snake_case						 =   torch.Size([1, 3, 8_0_0, 1_0_6_6]      )
							self.assertEqual(encoding['pixel_values'].shape       ,		__lowerCAmelCase      )

							__snake_case						 =   torch.tensor([0.2796, 0.3138, 0.3481]      )
							self.assertTrue(torch.allclose(encoding['pixel_values'][0, 0, 0, :3]       ,		__lowerCAmelCase       ,		atol=1E-4      )      )

							# verify area
							__snake_case						 =   torch.tensor([5887.9600, 11250.2061, 489353.8438, 837122.7500, 147967.5156, 165732.3438]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['area']       ,		__lowerCAmelCase      )      )
							# verify boxes
							__snake_case						 =   torch.Size([6, 4]      )
							self.assertEqual(encoding['labels'][0]['boxes'].shape       ,		__lowerCAmelCase      )
							__snake_case						 =   torch.tensor([0.5503, 0.2765, 0.0604, 0.2215]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['boxes'][0]       ,		__lowerCAmelCase       ,		atol=1E-3      )      )
							# verify image_id
							__snake_case						 =   torch.tensor([3_9_7_6_9]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['image_id']       ,		__lowerCAmelCase      )      )
							# verify is_crowd
							__snake_case						 =   torch.tensor([0, 0, 0, 0, 0, 0]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['iscrowd']       ,		__lowerCAmelCase      )      )
							# verify class_labels
							__snake_case						 =   torch.tensor([7_5, 7_5, 6_3, 6_5, 1_7, 1_7]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['class_labels']       ,		__lowerCAmelCase      )      )
							# verify orig_size
							__snake_case						 =   torch.tensor([4_8_0, 6_4_0]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['orig_size']       ,		__lowerCAmelCase      )      )
							# verify size
							__snake_case						 =   torch.tensor([8_0_0, 1_0_6_6]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['size']       ,		__lowerCAmelCase      )      )




	@slow
	def   lowercase__   (       self     :  Dict      ):
							# prepare image, target and masks_path
							__snake_case						 =   Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'      )
							with open('./tests/fixtures/tests_samples/COCO/coco_panoptic_annotations.txt'       ,		'r'      ) as f:
													__snake_case						 =   json.loads(f.read()      )

							__snake_case						 =   {'file_name': '000000039769.png', 'image_id': 3_9_7_6_9, 'segments_info': target}

							__snake_case						 =   pathlib.Path('./tests/fixtures/tests_samples/COCO/coco_panoptic'      )

							# encode them
							__snake_case						 =   DetrImageProcessor.from_pretrained('facebook/detr-resnet-50-panoptic'      )
							__snake_case						 =   image_processing(images=__lowerCAmelCase       ,		annotations=__lowerCAmelCase       ,		masks_path=__lowerCAmelCase       ,		return_tensors='pt'      )

							# verify pixel values
							__snake_case						 =   torch.Size([1, 3, 8_0_0, 1_0_6_6]      )
							self.assertEqual(encoding['pixel_values'].shape       ,		__lowerCAmelCase      )

							__snake_case						 =   torch.tensor([0.2796, 0.3138, 0.3481]      )
							self.assertTrue(torch.allclose(encoding['pixel_values'][0, 0, 0, :3]       ,		__lowerCAmelCase       ,		atol=1E-4      )      )

							# verify area
							__snake_case						 =   torch.tensor([147979.6875, 165527.0469, 484638.5938, 11292.9375, 5879.6562, 7634.1147]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['area']       ,		__lowerCAmelCase      )      )
							# verify boxes
							__snake_case						 =   torch.Size([6, 4]      )
							self.assertEqual(encoding['labels'][0]['boxes'].shape       ,		__lowerCAmelCase      )
							__snake_case						 =   torch.tensor([0.2625, 0.5437, 0.4688, 0.8625]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['boxes'][0]       ,		__lowerCAmelCase       ,		atol=1E-3      )      )
							# verify image_id
							__snake_case						 =   torch.tensor([3_9_7_6_9]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['image_id']       ,		__lowerCAmelCase      )      )
							# verify is_crowd
							__snake_case						 =   torch.tensor([0, 0, 0, 0, 0, 0]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['iscrowd']       ,		__lowerCAmelCase      )      )
							# verify class_labels
							__snake_case						 =   torch.tensor([1_7, 1_7, 6_3, 7_5, 7_5, 9_3]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['class_labels']       ,		__lowerCAmelCase      )      )
							# verify masks
							__snake_case						 =   8_2_2_8_7_3
							self.assertEqual(encoding['labels'][0]['masks'].sum().item()       ,		__lowerCAmelCase      )
							# verify orig_size
							__snake_case						 =   torch.tensor([4_8_0, 6_4_0]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['orig_size']       ,		__lowerCAmelCase      )      )
							# verify size
							__snake_case						 =   torch.tensor([8_0_0, 1_0_6_6]      )
							self.assertTrue(torch.allclose(encoding['labels'][0]['size']       ,		__lowerCAmelCase      )      )







'''simple docstring'''


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

import black


_lowercase  =			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.
_lowercase  =			"""    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 						a_				(			unittest.TestCase						):




	def   lowercase__   (       self     :  int      ):
							__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   lowercase__   (       self     :  Optional[Any]      ):
							__snake_case						 =   'src/transformers'
							shutil.rmtree(self.transformer_dir      )




	def   lowercase__   (       self     :  List[Any]       ,		__lowerCAmelCase     :  Optional[int]       ,		__lowerCAmelCase     :  str       ,		__lowerCAmelCase     :  str       ,		__lowerCAmelCase     :  List[str]=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_1_9      )
							__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   lowercase__   (       self     :  Tuple      ):
							__snake_case						 =   check_copies.find_code_in_transformers('models.bert.modeling_bert.BertLMPredictionHead'      )
							self.assertEqual(__lowerCAmelCase       ,		__lowerCAmelCase      )




	def   lowercase__   (       self     :  int      ):
							# 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   lowercase__   (       self     :  List[str]      ):
							__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      )

