


import unittest

from transformers import (
    MODEL_FOR_OBJECT_DETECTION_MAPPING,
    AutoFeatureExtractor,
    AutoModelForObjectDetection,
    ObjectDetectionPipeline,
    is_vision_available,
    pipeline,
)
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_pytesseract,
    require_tf,
    require_timm,
    require_torch,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
       from PIL import Image
else:


       class   a__	:

              @staticmethod
              def 						UpperCAmelCase(   *lowerCamelCase_      :     Dict      ,							**lowerCamelCase_      :     int    ):
                   pass


@is_pipeline_test
@require_vision
@require_timm
@require_torch
class   a__	(						unittest.TestCase    ):
       lowerCamelCase__:     Tuple							    =     MODEL_FOR_OBJECT_DETECTION_MAPPING

       def 						UpperCAmelCase(   self      :     List[str]      ,							lowerCamelCase_      :     Union[str, Any]      ,							lowerCamelCase_      :     Optional[Any]      ,							lowerCamelCase_      :     Dict    ):
            a_    :     Dict										=    ObjectDetectionPipeline(model=lowerCamelCase_      ,							image_processor=lowerCamelCase_    )
            return object_detector, ["./tests/fixtures/tests_samples/COCO/000000039769.png"]

       def 						UpperCAmelCase(   self      :     Dict      ,							lowerCamelCase_      :     List[str]      ,							lowerCamelCase_      :     Any    ):
            a_    :     str										=    object_detector("""./tests/fixtures/tests_samples/COCO/000000039769.png"""      ,							threshold=0.0    )

            self.assertGreater(len(lowerCamelCase_    )      ,							0    )
            for detected_object in outputs:
                 self.assertEqual(
                     lowerCamelCase_      ,							{
                         """score""": ANY(lowerCamelCase_    ),
                         """label""": ANY(lowerCamelCase_    ),
                         """box""": {"""xmin""": ANY(lowerCamelCase_    ), """ymin""": ANY(lowerCamelCase_    ), """xmax""": ANY(lowerCamelCase_    ), """ymax""": ANY(lowerCamelCase_    )},
                     }      ,							)

            import datasets

            a_    :     Optional[int]										=    datasets.load_dataset("""hf-internal-testing/fixtures_image_utils"""      ,							"""image"""      ,							split="""test"""    )

            a_    :     int										=    [
                Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""    ),
                """http://images.cocodataset.org/val2017/000000039769.jpg""",
                # RGBA
                dataset[0]["""file"""],
                # LA
                dataset[1]["""file"""],
                # L
                dataset[2]["""file"""],
            ]
            a_    :     str										=    object_detector(lowerCamelCase_      ,							threshold=0.0    )

            self.assertEqual(len(lowerCamelCase_    )      ,							len(lowerCamelCase_    )    )
            for outputs in batch_outputs:
                 self.assertGreater(len(lowerCamelCase_    )      ,							0    )
                 for detected_object in outputs:
                      self.assertEqual(
                          lowerCamelCase_      ,							{
                              """score""": ANY(lowerCamelCase_    ),
                              """label""": ANY(lowerCamelCase_    ),
                              """box""": {"""xmin""": ANY(lowerCamelCase_    ), """ymin""": ANY(lowerCamelCase_    ), """xmax""": ANY(lowerCamelCase_    ), """ymax""": ANY(lowerCamelCase_    )},
                          }      ,							)

       @require_tf
       @unittest.skip("""Object detection not implemented in TF"""    )
       def 						UpperCAmelCase(   self      :     Optional[Any]    ):
            pass

       @require_torch
       def 						UpperCAmelCase(   self      :     List[Any]    ):
            a_    :     int										=    """hf-internal-testing/tiny-detr-mobilenetsv3"""

            a_    :     Union[str, Any]										=    AutoModelForObjectDetection.from_pretrained(lowerCamelCase_    )
            a_    :     Tuple										=    AutoFeatureExtractor.from_pretrained(lowerCamelCase_    )
            a_    :     List[Any]										=    ObjectDetectionPipeline(model=lowerCamelCase_      ,							feature_extractor=lowerCamelCase_    )

            a_    :     Any										=    object_detector("""http://images.cocodataset.org/val2017/000000039769.jpg"""      ,							threshold=0.0    )

            self.assertEqual(
                nested_simplify(lowerCamelCase_      ,							decimals=4    )      ,							[
                    {"""score""": 0.3_3_7_6, """label""": """LABEL_0""", """box""": {"""xmin""": 1_5_9, """ymin""": 1_2_0, """xmax""": 4_8_0, """ymax""": 3_5_9}},
                    {"""score""": 0.3_3_7_6, """label""": """LABEL_0""", """box""": {"""xmin""": 1_5_9, """ymin""": 1_2_0, """xmax""": 4_8_0, """ymax""": 3_5_9}},
                ]      ,							)

            a_    :     Dict										=    object_detector(
                [
                    """http://images.cocodataset.org/val2017/000000039769.jpg""",
                    """http://images.cocodataset.org/val2017/000000039769.jpg""",
                ]      ,							threshold=0.0      ,							)

            self.assertEqual(
                nested_simplify(lowerCamelCase_      ,							decimals=4    )      ,							[
                    [
                        {"""score""": 0.3_3_7_6, """label""": """LABEL_0""", """box""": {"""xmin""": 1_5_9, """ymin""": 1_2_0, """xmax""": 4_8_0, """ymax""": 3_5_9}},
                        {"""score""": 0.3_3_7_6, """label""": """LABEL_0""", """box""": {"""xmin""": 1_5_9, """ymin""": 1_2_0, """xmax""": 4_8_0, """ymax""": 3_5_9}},
                    ],
                    [
                        {"""score""": 0.3_3_7_6, """label""": """LABEL_0""", """box""": {"""xmin""": 1_5_9, """ymin""": 1_2_0, """xmax""": 4_8_0, """ymax""": 3_5_9}},
                        {"""score""": 0.3_3_7_6, """label""": """LABEL_0""", """box""": {"""xmin""": 1_5_9, """ymin""": 1_2_0, """xmax""": 4_8_0, """ymax""": 3_5_9}},
                    ],
                ]      ,							)

       @require_torch
       @slow
       def 						UpperCAmelCase(   self      :     List[str]    ):
            a_    :     Union[str, Any]										=    """facebook/detr-resnet-50"""

            a_    :     str										=    AutoModelForObjectDetection.from_pretrained(lowerCamelCase_    )
            a_    :     int										=    AutoFeatureExtractor.from_pretrained(lowerCamelCase_    )
            a_    :     Optional[int]										=    ObjectDetectionPipeline(model=lowerCamelCase_      ,							feature_extractor=lowerCamelCase_    )

            a_    :     Optional[int]										=    object_detector("""http://images.cocodataset.org/val2017/000000039769.jpg"""    )
            self.assertEqual(
                nested_simplify(lowerCamelCase_      ,							decimals=4    )      ,							[
                    {"""score""": 0.9_9_8_2, """label""": """remote""", """box""": {"""xmin""": 4_0, """ymin""": 7_0, """xmax""": 1_7_5, """ymax""": 1_1_7}},
                    {"""score""": 0.9_9_6_0, """label""": """remote""", """box""": {"""xmin""": 3_3_3, """ymin""": 7_2, """xmax""": 3_6_8, """ymax""": 1_8_7}},
                    {"""score""": 0.9_9_5_5, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 6_3_9, """ymax""": 4_7_3}},
                    {"""score""": 0.9_9_8_8, """label""": """cat""", """box""": {"""xmin""": 1_3, """ymin""": 5_2, """xmax""": 3_1_4, """ymax""": 4_7_0}},
                    {"""score""": 0.9_9_8_7, """label""": """cat""", """box""": {"""xmin""": 3_4_5, """ymin""": 2_3, """xmax""": 6_4_0, """ymax""": 3_6_8}},
                ]      ,							)

            a_    :     List[str]										=    object_detector(
                [
                    """http://images.cocodataset.org/val2017/000000039769.jpg""",
                    """http://images.cocodataset.org/val2017/000000039769.jpg""",
                ]    )
            self.assertEqual(
                nested_simplify(lowerCamelCase_      ,							decimals=4    )      ,							[
                    [
                        {"""score""": 0.9_9_8_2, """label""": """remote""", """box""": {"""xmin""": 4_0, """ymin""": 7_0, """xmax""": 1_7_5, """ymax""": 1_1_7}},
                        {"""score""": 0.9_9_6_0, """label""": """remote""", """box""": {"""xmin""": 3_3_3, """ymin""": 7_2, """xmax""": 3_6_8, """ymax""": 1_8_7}},
                        {"""score""": 0.9_9_5_5, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 6_3_9, """ymax""": 4_7_3}},
                        {"""score""": 0.9_9_8_8, """label""": """cat""", """box""": {"""xmin""": 1_3, """ymin""": 5_2, """xmax""": 3_1_4, """ymax""": 4_7_0}},
                        {"""score""": 0.9_9_8_7, """label""": """cat""", """box""": {"""xmin""": 3_4_5, """ymin""": 2_3, """xmax""": 6_4_0, """ymax""": 3_6_8}},
                    ],
                    [
                        {"""score""": 0.9_9_8_2, """label""": """remote""", """box""": {"""xmin""": 4_0, """ymin""": 7_0, """xmax""": 1_7_5, """ymax""": 1_1_7}},
                        {"""score""": 0.9_9_6_0, """label""": """remote""", """box""": {"""xmin""": 3_3_3, """ymin""": 7_2, """xmax""": 3_6_8, """ymax""": 1_8_7}},
                        {"""score""": 0.9_9_5_5, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 6_3_9, """ymax""": 4_7_3}},
                        {"""score""": 0.9_9_8_8, """label""": """cat""", """box""": {"""xmin""": 1_3, """ymin""": 5_2, """xmax""": 3_1_4, """ymax""": 4_7_0}},
                        {"""score""": 0.9_9_8_7, """label""": """cat""", """box""": {"""xmin""": 3_4_5, """ymin""": 2_3, """xmax""": 6_4_0, """ymax""": 3_6_8}},
                    ],
                ]      ,							)

       @require_torch
       @slow
       def 						UpperCAmelCase(   self      :     Optional[Any]    ):
            a_    :     int										=    """facebook/detr-resnet-50"""

            a_    :     Any										=    pipeline("""object-detection"""      ,							model=lowerCamelCase_    )

            a_    :     List[Any]										=    object_detector("""http://images.cocodataset.org/val2017/000000039769.jpg"""    )
            self.assertEqual(
                nested_simplify(lowerCamelCase_      ,							decimals=4    )      ,							[
                    {"""score""": 0.9_9_8_2, """label""": """remote""", """box""": {"""xmin""": 4_0, """ymin""": 7_0, """xmax""": 1_7_5, """ymax""": 1_1_7}},
                    {"""score""": 0.9_9_6_0, """label""": """remote""", """box""": {"""xmin""": 3_3_3, """ymin""": 7_2, """xmax""": 3_6_8, """ymax""": 1_8_7}},
                    {"""score""": 0.9_9_5_5, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 6_3_9, """ymax""": 4_7_3}},
                    {"""score""": 0.9_9_8_8, """label""": """cat""", """box""": {"""xmin""": 1_3, """ymin""": 5_2, """xmax""": 3_1_4, """ymax""": 4_7_0}},
                    {"""score""": 0.9_9_8_7, """label""": """cat""", """box""": {"""xmin""": 3_4_5, """ymin""": 2_3, """xmax""": 6_4_0, """ymax""": 3_6_8}},
                ]      ,							)

            a_    :     Any										=    object_detector(
                [
                    """http://images.cocodataset.org/val2017/000000039769.jpg""",
                    """http://images.cocodataset.org/val2017/000000039769.jpg""",
                ]    )
            self.assertEqual(
                nested_simplify(lowerCamelCase_      ,							decimals=4    )      ,							[
                    [
                        {"""score""": 0.9_9_8_2, """label""": """remote""", """box""": {"""xmin""": 4_0, """ymin""": 7_0, """xmax""": 1_7_5, """ymax""": 1_1_7}},
                        {"""score""": 0.9_9_6_0, """label""": """remote""", """box""": {"""xmin""": 3_3_3, """ymin""": 7_2, """xmax""": 3_6_8, """ymax""": 1_8_7}},
                        {"""score""": 0.9_9_5_5, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 6_3_9, """ymax""": 4_7_3}},
                        {"""score""": 0.9_9_8_8, """label""": """cat""", """box""": {"""xmin""": 1_3, """ymin""": 5_2, """xmax""": 3_1_4, """ymax""": 4_7_0}},
                        {"""score""": 0.9_9_8_7, """label""": """cat""", """box""": {"""xmin""": 3_4_5, """ymin""": 2_3, """xmax""": 6_4_0, """ymax""": 3_6_8}},
                    ],
                    [
                        {"""score""": 0.9_9_8_2, """label""": """remote""", """box""": {"""xmin""": 4_0, """ymin""": 7_0, """xmax""": 1_7_5, """ymax""": 1_1_7}},
                        {"""score""": 0.9_9_6_0, """label""": """remote""", """box""": {"""xmin""": 3_3_3, """ymin""": 7_2, """xmax""": 3_6_8, """ymax""": 1_8_7}},
                        {"""score""": 0.9_9_5_5, """label""": """couch""", """box""": {"""xmin""": 0, """ymin""": 1, """xmax""": 6_3_9, """ymax""": 4_7_3}},
                        {"""score""": 0.9_9_8_8, """label""": """cat""", """box""": {"""xmin""": 1_3, """ymin""": 5_2, """xmax""": 3_1_4, """ymax""": 4_7_0}},
                        {"""score""": 0.9_9_8_7, """label""": """cat""", """box""": {"""xmin""": 3_4_5, """ymin""": 2_3, """xmax""": 6_4_0, """ymax""": 3_6_8}},
                    ],
                ]      ,							)

       @require_torch
       @slow
       def 						UpperCAmelCase(   self      :     str    ):
            a_    :     Tuple										=    0.9_9_8_5
            a_    :     Optional[int]										=    """facebook/detr-resnet-50"""

            a_    :     Tuple										=    pipeline("""object-detection"""      ,							model=lowerCamelCase_    )

            a_    :     Optional[int]										=    object_detector("""http://images.cocodataset.org/val2017/000000039769.jpg"""      ,							threshold=lowerCamelCase_    )
            self.assertEqual(
                nested_simplify(lowerCamelCase_      ,							decimals=4    )      ,							[
                    {"""score""": 0.9_9_8_8, """label""": """cat""", """box""": {"""xmin""": 1_3, """ymin""": 5_2, """xmax""": 3_1_4, """ymax""": 4_7_0}},
                    {"""score""": 0.9_9_8_7, """label""": """cat""", """box""": {"""xmin""": 3_4_5, """ymin""": 2_3, """xmax""": 6_4_0, """ymax""": 3_6_8}},
                ]      ,							)

       @require_torch
       @require_pytesseract
       @slow
       def 						UpperCAmelCase(   self      :     Optional[Any]    ):
            a_    :     List[str]										=    """Narsil/layoutlmv3-finetuned-funsd"""
            a_    :     Optional[int]										=    0.9_9_9_3

            a_    :     str										=    pipeline("""object-detection"""      ,							model=lowerCamelCase_      ,							threshold=lowerCamelCase_    )

            a_    :     str										=    object_detector(
                """https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png"""    )
            self.assertEqual(
                nested_simplify(lowerCamelCase_      ,							decimals=4    )      ,							[
                    {"""score""": 0.9_9_9_3, """label""": """I-ANSWER""", """box""": {"""xmin""": 2_9_4, """ymin""": 2_5_4, """xmax""": 3_4_3, """ymax""": 2_6_4}},
                    {"""score""": 0.9_9_9_3, """label""": """I-ANSWER""", """box""": {"""xmin""": 2_9_4, """ymin""": 2_5_4, """xmax""": 3_4_3, """ymax""": 2_6_4}},
                ]      ,							)







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

import black


__lowerCamelCase        =     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.
__lowerCamelCase        =     '''    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 						UpperCAmelCase(   self      :     Dict    ):
            a_    :     Optional[Any]										=    tempfile.mkdtemp()
            os.makedirs(os.path.join(self.transformer_dir      ,							"""models/bert/"""    )    )
            a_    :     Optional[Any]										=    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 						UpperCAmelCase(   self      :     Dict    ):
            a_    :     Any										=    """src/transformers"""
            shutil.rmtree(self.transformer_dir    )

       def 						UpperCAmelCase(   self      :     Dict      ,							lowerCamelCase_      :     str      ,							lowerCamelCase_      :     Optional[int]      ,							lowerCamelCase_      :     int      ,							lowerCamelCase_      :     Tuple=None    ):
            a_    :     Any										=    comment + F'''\nclass {class_name}(nn.Module):\n''' + class_code
            if overwrite_result is not None:
                 a_    :     Any										=    comment + F'''\nclass {class_name}(nn.Module):\n''' + overwrite_result
            a_    :     Dict										=    black.Mode(target_versions={black.TargetVersion.PYaa}      ,							line_length=1_1_9    )
            a_    :     Optional[Any]										=    black.format_str(lowerCamelCase_      ,							mode=lowerCamelCase_    )
            a_    :     Optional[Any]										=    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 						UpperCAmelCase(   self      :     Dict    ):
            a_    :     Tuple										=    check_copies.find_code_in_transformers("""models.bert.modeling_bert.BertLMPredictionHead"""    )
            self.assertEqual(lowerCamelCase_      ,							lowerCamelCase_    )

       def 						UpperCAmelCase(   self      :     Optional[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
            a_    :     int										=    """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 						UpperCAmelCase(   self      :     int    ):
            a_    :     Optional[Any]										=    check_copies.LOCALIZED_READMES["""README_zh-hans.md"""]

            a_    :     Tuple										=    (
                """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."""
            )
            a_    :     Optional[Any]										=    (
                """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"""
            )
            a_    :     Any										=    (
                """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"""
            )

            a_			,			a_    :     Optional[int]										=    check_copies.convert_to_localized_md(
                lowerCamelCase_      ,							lowerCamelCase_      ,							localized_readme["""format_model_list"""]    )

            self.assertFalse(lowerCamelCase_    )
            self.assertEqual(lowerCamelCase_      ,							lowerCamelCase_    )

            a_			,			a_    :     Tuple										=    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_    )

            a_    :     Optional[int]										=    (
                """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."""
            )
            a_    :     Union[str, Any]										=    (
                """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"""
            )
            a_    :     str										=    (
                """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"""
            )

            a_			,			a_    :     Tuple										=    check_copies.convert_to_localized_md(
                lowerCamelCase_      ,							lowerCamelCase_      ,							localized_readme["""format_model_list"""]    )

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



