





from typing import List, Optional, Tuple, Union

import torch
from torch import nn
from torch.nn import CrossEntropyLoss

from ... import AutoBackbone
from ...modeling_outputs import SemanticSegmenterOutput
from ...modeling_utils import PreTrainedModel
from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, replace_return_docstrings
from ...utils.backbone_utils import BackboneMixin
from .configuration_upernet import UperNetConfig


A   : Any			=			[
    '''openmmlab/upernet-convnext-tiny''',
    # See all UperNet models at https://huggingface.co/models?filter=upernet
]

# General docstring
A   : Tuple			=			'''UperNetConfig'''


class   A      (nn.Module   ):
			'''simple docstring'''




			def __init__(      self       :   Dict							,     __lowerCAmelCase       :   int							,     __lowerCAmelCase       :   int							,     __lowerCAmelCase       :   Union[int, Tuple[int, int]]							,     __lowerCAmelCase       :   Union[int, Tuple[int, int], str] = 0							,     __lowerCAmelCase       :   bool = False							,     __lowerCAmelCase       :   Union[int, Tuple[int, int]] = 1							,     )     ->     None:







					"""simple docstring"""






					super().__init__()
					A__  				=       nn.Convad(
					    in_channels=__lowerCAmelCase							,     out_channels=__lowerCAmelCase							,     kernel_size=__lowerCAmelCase							,     padding=__lowerCAmelCase							,     bias=__lowerCAmelCase							,     dilation=__lowerCAmelCase							,     )
					A__  				=       nn.BatchNormad(__lowerCAmelCase       )
					A__  				=       nn.ReLU()







			def        a_	(      self       :   Dict							,     __lowerCAmelCase       :   torch.Tensor       )     ->     torch.Tensor:







					"""simple docstring"""






					A__  				=       self.conv(__lowerCAmelCase       )
					A__  				=       self.batch_norm(__lowerCAmelCase       )
					A__  				=       self.activation(__lowerCAmelCase       )

					return output


class   A      (nn.Module   ):
			'''simple docstring'''




			def __init__(      self       :   Any							,     __lowerCAmelCase       :   int							,     __lowerCAmelCase       :   int							,     __lowerCAmelCase       :   int       )     ->     None:







					"""simple docstring"""






					super().__init__()
					A__  				=       [
					    nn.AdaptiveAvgPoolad(__lowerCAmelCase       ),
					    UperNetConvModule(__lowerCAmelCase							,     __lowerCAmelCase							,     kernel_size=1       ),
					]
					for i, layer in enumerate(self.layers       ):
							self.add_module(str(__lowerCAmelCase       )							,     __lowerCAmelCase       )







			def        a_	(      self       :   Any							,     __lowerCAmelCase       :   torch.Tensor       )     ->     torch.Tensor:







					"""simple docstring"""






					A__  				=       input
					for layer in self.layers:
							A__  				=       layer(__lowerCAmelCase       )
					return hidden_state


class   A      (nn.Module   ):
			'''simple docstring'''




			def __init__(      self       :   int							,     __lowerCAmelCase       :   Tuple[int, ...]							,     __lowerCAmelCase       :   int							,     __lowerCAmelCase       :   int							,     __lowerCAmelCase       :   bool       )     ->     None:







					"""simple docstring"""






					super().__init__()
					A__  				=       pool_scales
					A__  				=       align_corners
					A__  				=       in_channels
					A__  				=       channels
					A__  				=       []
					for i, pool_scale in enumerate(__lowerCAmelCase       ):
							A__  				=       UperNetPyramidPoolingBlock(pool_scale=__lowerCAmelCase							,     in_channels=__lowerCAmelCase							,     channels=__lowerCAmelCase       )
							self.blocks.append(__lowerCAmelCase       )
							self.add_module(str(__lowerCAmelCase       )							,     __lowerCAmelCase       )







			def        a_	(      self       :   str							,     __lowerCAmelCase       :   torch.Tensor       )     ->     List[torch.Tensor]:







					"""simple docstring"""






					A__  				=       []
					for ppm in self.blocks:
							A__  				=       ppm(__lowerCAmelCase       )
							A__  				=       nn.functional.interpolate(
							    __lowerCAmelCase							,     size=x.size()[2:]							,     mode="""bilinear"""							,     align_corners=self.align_corners       )
							ppm_outs.append(__lowerCAmelCase       )
					return ppm_outs


class   A      (nn.Module   ):
			'''simple docstring'''




			def __init__(      self       :   Tuple							,     __lowerCAmelCase       :   Union[str, Any]							,     __lowerCAmelCase       :   List[Any]       )     ->     int:







					"""simple docstring"""






					super().__init__()

					A__  				=       config
					A__  				=       config.pool_scales  # e.g. (1, 2, 3, 6)
					A__  				=       in_channels
					A__  				=       config.hidden_size
					A__  				=       False
					A__  				=       nn.Convad(self.channels							,     config.num_labels							,     kernel_size=1       )

					# PSP Module
					A__  				=       UperNetPyramidPoolingModule(
					    self.pool_scales							,     self.in_channels[-1]							,     self.channels							,     align_corners=self.align_corners							,     )
					A__  				=       UperNetConvModule(
					    self.in_channels[-1] + len(self.pool_scales       ) * self.channels							,     self.channels							,     kernel_size=3							,     padding=1							,     )
					# FPN Module
					A__  				=       nn.ModuleList()
					A__  				=       nn.ModuleList()
					for in_channels in self.in_channels[:-1]:  # skip the top layer
							A__  				=       UperNetConvModule(__lowerCAmelCase							,     self.channels							,     kernel_size=1       )
							A__  				=       UperNetConvModule(self.channels							,     self.channels							,     kernel_size=3							,     padding=1       )
							self.lateral_convs.append(__lowerCAmelCase       )
							self.fpn_convs.append(__lowerCAmelCase       )

					A__  				=       UperNetConvModule(
					    len(self.in_channels       ) * self.channels							,     self.channels							,     kernel_size=3							,     padding=1							,     )






			def        a_	(      self       :   str       )     ->     str:







					"""simple docstring"""






					self.apply(self._init_weights       )






			def        a_	(      self       :   Optional[Any]							,     __lowerCAmelCase       :   Tuple       )     ->     List[Any]:







					"""simple docstring"""






					if isinstance(__lowerCAmelCase							,     nn.Convad       ):
							module.weight.data.normal_(mean=0.0							,     std=self.config.initializer_range       )
							if module.bias is not None:
									module.bias.data.zero_()






			def        a_	(      self       :   Any							,     __lowerCAmelCase       :   Tuple       )     ->     Optional[Any]:







					"""simple docstring"""






					A__  				=       inputs[-1]
					A__  				=       [x]
					psp_outs.extend(self.psp_modules(__lowerCAmelCase       )       )
					A__  				=       torch.cat(__lowerCAmelCase							,     dim=1       )
					A__  				=       self.bottleneck(__lowerCAmelCase       )

					return output







			def        a_	(      self       :   Dict							,     __lowerCAmelCase       :   torch.Tensor       )     ->     torch.Tensor:







					"""simple docstring"""






					A__  				=       [lateral_conv(encoder_hidden_states[i]       ) for i, lateral_conv in enumerate(self.lateral_convs       )]

					laterals.append(self.psp_forward(__lowerCAmelCase       )       )

					# build top-down path
					A__  				=       len(__lowerCAmelCase       )
					for i in range(used_backbone_levels - 1							,     0							,     -1       ):
							A__  				=       laterals[i - 1].shape[2:]
							A__  				=       laterals[i - 1] + nn.functional.interpolate(
							    laterals[i]							,     size=__lowerCAmelCase							,     mode="""bilinear"""							,     align_corners=self.align_corners       )

					# build outputs
					A__  				=       [self.fpn_convs[i](laterals[i]       ) for i in range(used_backbone_levels - 1       )]
					# append psp feature
					fpn_outs.append(laterals[-1]       )

					for i in range(used_backbone_levels - 1							,     0							,     -1       ):
							A__  				=       nn.functional.interpolate(
							    fpn_outs[i]							,     size=fpn_outs[0].shape[2:]							,     mode="""bilinear"""							,     align_corners=self.align_corners       )
					A__  				=       torch.cat(__lowerCAmelCase							,     dim=1       )
					A__  				=       self.fpn_bottleneck(__lowerCAmelCase       )
					A__  				=       self.classifier(__lowerCAmelCase       )

					return output


class   A      (nn.Module   ):
			'''simple docstring'''




			def __init__(      self       :   Optional[Any]							,     __lowerCAmelCase       :   int							,     __lowerCAmelCase       :   int = 2							,     __lowerCAmelCase       :   int = 3							,     __lowerCAmelCase       :   Union[int, Tuple[int, int]] = 1       )     ->     None:







					"""simple docstring"""






					super().__init__()

					A__  				=       config
					A__  				=       config.auxiliary_in_channels
					A__  				=       config.auxiliary_channels
					A__  				=       config.auxiliary_num_convs
					A__  				=       config.auxiliary_concat_input
					A__  				=       in_index

					A__  				=       (kernel_size // 2) * dilation
					A__  				=       []
					convs.append(
					    UperNetConvModule(
					        self.in_channels							,     self.channels							,     kernel_size=__lowerCAmelCase							,     padding=__lowerCAmelCase							,     dilation=__lowerCAmelCase       )       )
					for i in range(self.num_convs - 1       ):
							convs.append(
							    UperNetConvModule(
							        self.channels							,     self.channels							,     kernel_size=__lowerCAmelCase							,     padding=__lowerCAmelCase							,     dilation=__lowerCAmelCase       )       )
					if self.num_convs == 0:
							A__  				=       nn.Identity()
					else:
							A__  				=       nn.Sequential(*__lowerCAmelCase       )
					if self.concat_input:
							A__  				=       UperNetConvModule(
							    self.in_channels + self.channels							,     self.channels							,     kernel_size=__lowerCAmelCase							,     padding=kernel_size // 2       )

					A__  				=       nn.Convad(self.channels							,     config.num_labels							,     kernel_size=1       )






			def        a_	(      self       :   Union[str, Any]       )     ->     Union[str, Any]:







					"""simple docstring"""






					self.apply(self._init_weights       )






			def        a_	(      self       :   Union[str, Any]							,     __lowerCAmelCase       :   int       )     ->     List[Any]:







					"""simple docstring"""






					if isinstance(__lowerCAmelCase							,     nn.Convad       ):
							module.weight.data.normal_(mean=0.0							,     std=self.config.initializer_range       )
							if module.bias is not None:
									module.bias.data.zero_()







			def        a_	(      self       :   List[str]							,     __lowerCAmelCase       :   torch.Tensor       )     ->     torch.Tensor:







					"""simple docstring"""






					A__  				=       encoder_hidden_states[self.in_index]
					A__  				=       self.convs(__lowerCAmelCase       )
					if self.concat_input:
							A__  				=       self.conv_cat(torch.cat([hidden_states, output]							,     dim=1       )       )
					A__  				=       self.classifier(__lowerCAmelCase       )
					return output


class   A      (SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''




			__lowerCamelCase     :	Tuple          =   UperNetConfig
			__lowerCamelCase     :	Union[str, Any]          =   '''pixel_values'''
			__lowerCamelCase     :	List[Any]          =   True






			def        a_	(      self       :   str							,     __lowerCAmelCase       :   List[str]       )     ->     Any:







					"""simple docstring"""






					if isinstance(__lowerCAmelCase							,     __lowerCAmelCase       ):
							module.backbone.init_weights()
							module.decode_head.init_weights()
							module.auxiliary_head.init_weights()






			def        a_	(      self       :   str       )     ->     List[Any]:







					"""simple docstring"""






					self.backbone.init_weights()
					self.decode_head.init_weights()
					self.auxiliary_head.init_weights()







			def        a_	(      self       :   List[str]							,     __lowerCAmelCase       :   str							,     __lowerCAmelCase       :   Dict=False       )     ->     Dict:







					"""simple docstring"""






					if isinstance(__lowerCAmelCase							,     __lowerCAmelCase       ):
							A__  				=       value

A   : str			=			R'''
    Parameters:
    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use
    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
    behavior.
        config ([`UperNetConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
'''

A   : List[str]			=			R'''
    Args:
        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):
            Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
            [`AutoImageProcessor`]. See [`SegformerImageProcessor.__call__`] for details.
        output_attentions (`bool`, *optional*):
            Whether or not to return the attentions tensors of all attention layers in case the backbone has them. See
            `attentions` under returned tensors for more detail.
        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers of the backbone. See `hidden_states` under
            returned tensors for more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
'''


@add_start_docstrings(
    '''UperNet framework leveraging any vision backbone e.g. for ADE20k, CityScapes.'''       ,					SCREAMING_SNAKE_CASE       ,					)
class   A      (SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''




			def __init__(      self       :   List[str]							,     __lowerCAmelCase       :   Optional[Any]       )     ->     List[str]:







					"""simple docstring"""






					super().__init__(__lowerCAmelCase       )

					A__  				=       AutoBackbone.from_config(config.backbone_config       )

					# Semantic segmentation head(s)
					A__  				=       UperNetHead(__lowerCAmelCase							,     in_channels=self.backbone.channels       )
					A__  				=       UperNetFCNHead(__lowerCAmelCase       ) if config.use_auxiliary_head else None

					# Initialize weights and apply final processing
					self.post_init()







			@add_start_docstrings_to_model_forward(UPERNET_INPUTS_DOCSTRING.format("""batch_size, sequence_length"""       )       )
			@replace_return_docstrings(output_type=__lowerCAmelCase							,     config_class=_CONFIG_FOR_DOC       )
			def        a_	(      self       :   Any							,     __lowerCAmelCase       :   Optional[torch.Tensor] = None							,     __lowerCAmelCase       :   Optional[bool] = None							,     __lowerCAmelCase       :   Optional[bool] = None							,     __lowerCAmelCase       :   Optional[torch.Tensor] = None							,     __lowerCAmelCase       :   Optional[bool] = None							,     )     ->     Union[tuple, SemanticSegmenterOutput]:







					"""simple docstring"""






					A__  				=       return_dict if return_dict is not None else self.config.use_return_dict
					A__  				=       (
					    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
					)
					A__  				=       output_attentions if output_attentions is not None else self.config.output_attentions

					A__  				=       self.backbone.forward_with_filtered_kwargs(
					    __lowerCAmelCase							,     output_hidden_states=__lowerCAmelCase							,     output_attentions=__lowerCAmelCase       )
					A__  				=       outputs.feature_maps

					A__  				=       self.decode_head(__lowerCAmelCase       )
					A__  				=       nn.functional.interpolate(__lowerCAmelCase							,     size=pixel_values.shape[2:]							,     mode="""bilinear"""							,     align_corners=__lowerCAmelCase       )

					A__  				=       None
					if self.auxiliary_head is not None:
							A__  				=       self.auxiliary_head(__lowerCAmelCase       )
							A__  				=       nn.functional.interpolate(
							    __lowerCAmelCase							,     size=pixel_values.shape[2:]							,     mode="""bilinear"""							,     align_corners=__lowerCAmelCase       )

					A__  				=       None
					if labels is not None:
							if self.config.num_labels == 1:
									raise ValueError("""The number of labels should be greater than one"""       )
							else:
									# compute weighted loss
									A__  				=       CrossEntropyLoss(ignore_index=self.config.loss_ignore_index       )
									A__  				=       loss_fct(__lowerCAmelCase							,     __lowerCAmelCase       )
									A__  				=       loss_fct(__lowerCAmelCase							,     __lowerCAmelCase       )
									A__  				=       main_loss + self.config.auxiliary_loss_weight * auxiliary_loss

					if not return_dict:
							if output_hidden_states:
									A__  				=       (logits,) + outputs[1:]
							else:
									A__  				=       (logits,) + outputs[2:]
							return ((loss,) + output) if loss is not None else output

					return SemanticSegmenterOutput(
					    loss=__lowerCAmelCase							,     logits=__lowerCAmelCase							,     hidden_states=outputs.hidden_states							,     attentions=outputs.attentions							,     )










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

import black


A   : Dict			=				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   : Optional[int]			=				'''    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   ):
			'''simple docstring'''




			def        a_	(      self       :   Union[str, Any]       )     ->     List[str]:







					"""simple docstring"""






					A__  				=       tempfile.mkdtemp()
					os.makedirs(os.path.join(self.transformer_dir							,     """models/bert/"""       )       )
					A__  				=       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       :   str       )     ->     Optional[int]:







					"""simple docstring"""






					A__  				=       """src/transformers"""
					shutil.rmtree(self.transformer_dir       )






			def        a_	(      self       :   List[str]							,     __lowerCAmelCase       :   List[Any]							,     __lowerCAmelCase       :   Optional[int]							,     __lowerCAmelCase       :   int							,     __lowerCAmelCase       :   Tuple=None       )     ->     Dict:







					"""simple docstring"""






					A__  				=       comment + f'\nclass {class_name}(nn.Module):\n' + class_code
					if overwrite_result is not None:
							A__  				=       comment + f'\nclass {class_name}(nn.Module):\n' + overwrite_result
					A__  				=       black.Mode(target_versions={black.TargetVersion.PYaa}							,     line_length=1_19       )
					A__  				=       black.format_str(__lowerCAmelCase							,     mode=__lowerCAmelCase       )
					A__  				=       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       :   Tuple       )     ->     List[Any]:







					"""simple docstring"""






					A__  				=       check_copies.find_code_in_transformers("""models.bert.modeling_bert.BertLMPredictionHead"""       )
					self.assertEqual(__lowerCAmelCase							,     __lowerCAmelCase       )






			def        a_	(      self       :   Tuple       )     ->     Any:







					"""simple docstring"""






					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__  				=       """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       :   Optional[int]       )     ->     Optional[int]:







					"""simple docstring"""






					A__  				=       check_copies.LOCALIZED_READMES["""README_zh-hans.md"""]

					A__  				=       (
					    """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__  				=       (
					    """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__  				=       (
					    """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__  				=       check_copies.convert_to_localized_md(
					    __lowerCAmelCase							,     __lowerCAmelCase							,     localized_readme["""format_model_list"""]       )

					self.assertFalse(__lowerCAmelCase       )
					self.assertEqual(__lowerCAmelCase							,     __lowerCAmelCase       )

					A__				,      A__  				=       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__  				=       (
					    """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__  				=       (
					    """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__  				=       (
					    """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__  				=       check_copies.convert_to_localized_md(
					    __lowerCAmelCase							,     __lowerCAmelCase							,     localized_readme["""format_model_list"""]       )

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



