




import unittest

import numpy as np

from transformers import is_flax_available
from transformers.testing_utils import require_flax

from ..test_modeling_flax_common import ids_tensor


if is_flax_available():
  import jax
  import jax.numpy as jnp

  from transformers.generation import (
      FlaxForcedBOSTokenLogitsProcessor,
      FlaxForcedEOSTokenLogitsProcessor,
      FlaxLogitsProcessorList,
      FlaxMinLengthLogitsProcessor,
      FlaxTemperatureLogitsWarper,
      FlaxTopKLogitsWarper,
      FlaxTopPLogitsWarper,
  )







@require_flax
class 		lowercase							(     unittest.TestCase	):

     def       a__			(						self	,  _a	,  _a       )		->							str:
           _A							:  List[str]    =		jnp.ones((batch_size, length)       ) / length
           return scores

     def       a__			(						self       )		->							Optional[int]:
           _A							:  List[Any]    =		None
           _A							:  Union[str, Any]    =		20

           _A							:  List[str]    =		self._get_uniform_logits(batch_size=2	,  length=_a       )

           # tweak scores to not be uniform anymore
           _A							:  str    =		scores.at[1, 5].set((1 / length) + 0.1       )  # peak, 1st batch
           _A							:  str    =		scores.at[1, 10].set((1 / length) - 0.4       )  # valley, 1st batch

           # compute softmax
           _A							:  str    =		jax.nn.softmax(_a	,  axis=-1       )

           _A							:  Union[str, Any]    =		FlaxTemperatureLogitsWarper(temperature=0.5       )
           _A							:  Tuple    =		FlaxTemperatureLogitsWarper(temperature=1.3       )

           _A							:  Union[str, Any]    =		jax.nn.softmax(temp_dist_warper_sharper(_a	,  scores.copy()	,  cur_len=_a       )	,  axis=-1       )
           _A							:  Optional[int]    =		jax.nn.softmax(temp_dist_warper_smoother(_a	,  scores.copy()	,  cur_len=_a       )	,  axis=-1       )

           # uniform distribution stays uniform
           self.assertTrue(jnp.allclose(probs[0, :]	,  warped_prob_sharp[0, :]	,  atol=1e-3       )       )
           self.assertTrue(jnp.allclose(probs[0, :]	,  warped_prob_smooth[0, :]	,  atol=1e-3       )       )

           # sharp peaks get higher, valleys get lower
           self.assertLess(probs[1, :].max()	,  warped_prob_sharp[1, :].max()       )
           self.assertGreater(probs[1, :].min()	,  warped_prob_sharp[1, :].min()       )

           # smooth peaks get lower, valleys get higher
           self.assertGreater(probs[1, :].max()	,  warped_prob_smooth[1, :].max()       )
           self.assertLess(probs[1, :].min()	,  warped_prob_smooth[1, :].min()       )

     def       a__			(						self       )		->							Tuple:
           _A							:  int    =		None
           _A							:  List[Any]    =		10
           _A							:  int    =		2

           # create ramp distribution
           _A							:  Optional[int]    =		np.broadcast_to(np.arange(_a       )[None, :]	,  (batch_size, vocab_size)       ).copy()
           _A							:  List[Any]    =		ramp_logits[1:, : vocab_size // 2] + vocab_size

           _A							:  int    =		FlaxTopKLogitsWarper(3       )

           _A							:  Optional[int]    =		top_k_warp(_a	,  _a	,  cur_len=_a       )

           # check that correct tokens are filtered
           self.assertListEqual(jnp.isinf(scores[0]       ).tolist()	,  7 * [True] + 3 * [False]       )
           self.assertListEqual(jnp.isinf(scores[1]       ).tolist()	,  2 * [True] + 3 * [False] + 5 * [True]       )

           # check special case
           _A							:  Optional[Any]    =		5
           _A							:  Any    =		FlaxTopKLogitsWarper(top_k=1	,  filter_value=0.0	,  min_tokens_to_keep=3       )

           _A							:  Any    =		np.broadcast_to(np.arange(_a       )[None, :]	,  (batch_size, length)       ).copy()
           _A							:  Dict    =		top_k_warp_safety_check(_a	,  _a	,  cur_len=_a       )

           # min_tokens overwrites k: 3 tokens are kept => 2 tokens are nullified
           self.assertListEqual((scores == 0.0).sum(axis=-1       ).tolist()	,  [2, 2]       )

     def       a__			(						self       )		->							Optional[Any]:
           _A							:  Union[str, Any]    =		None
           _A							:  Optional[int]    =		10
           _A							:  Optional[Any]    =		2

           # create distribution and take log (inverse to Softmax as taken in TopPLogitsWarper)
           _A							:  Union[str, Any]    =		np.log(np.array([[0.3, 0.1, 0.1, 0.5], [0.15, 0.3, 0.3, 0.25]]       )       )

           _A							:  Any    =		FlaxTopPLogitsWarper(0.8       )
           _A							:  Union[str, Any]    =		np.exp(top_p_warp(_a	,  _a	,  cur_len=_a       )       )

           # dist should be filtered to keep min num values so that sum is >= top_p
           # exp (-inf) => 0
           _A							:  List[Any]    =		np.array([[0.3, 0.0, 0.0, 0.5], [0.0, 0.3, 0.3, 0.25]]       )
           self.assertTrue(np.allclose(_a	,  _a	,  atol=1e-3       )       )

           # check edge cases with negative and extreme logits
           _A							:  List[str]    =		np.broadcast_to(np.arange(_a       )[None, :]	,  (batch_size, vocab_size)       ).copy() - (
               vocab_size // 2
           )

           # make ramp_logits more extreme
           _A							:  List[Any]    =		ramp_logits[1] * 100.0

           # make sure at least 2 tokens are kept
           _A							:  Tuple    =		FlaxTopPLogitsWarper(0.9	,  min_tokens_to_keep=2	,  filter_value=0.0       )
           _A							:  int    =		top_p_warp(_a	,  _a	,  cur_len=_a       )

           # first batch should keep three tokens, second batch would keep only 1, but due to `min_tokens_to_keep=2` keeps 2.
           self.assertListEqual((filtered_dist != 0.0).sum(axis=-1       ).tolist()	,  [3, 2]       )

     def       a__			(						self       )		->							int:
           _A							:  Tuple    =		20
           _A							:  str    =		4
           _A							:  Optional[Any]    =		0

           _A							:  str    =		FlaxMinLengthLogitsProcessor(min_length=10	,  eos_token_id=_a       )

           # check that min length is applied at length 5
           _A							:  Dict    =		ids_tensor((batch_size, 20)	,  vocab_size=20       )
           _A							:  Optional[Any]    =		5
           _A							:  Tuple    =		self._get_uniform_logits(_a	,  _a       )
           _A							:  List[str]    =		min_dist_processor(_a	,  _a	,  cur_len=_a       )
           self.assertListEqual(scores_before_min_length[:, eos_token_id].tolist()	,  4 * [-float("""inf"""       )]       )

           # check that min length is not applied anymore at length 15
           _A							:  Optional[Any]    =		self._get_uniform_logits(_a	,  _a       )
           _A							:  Tuple    =		15
           _A							:  Optional[int]    =		min_dist_processor(_a	,  _a	,  cur_len=_a       )
           self.assertFalse(jnp.isinf(_a       ).any()       )

     def       a__			(						self       )		->							Union[str, Any]:
           _A							:  Optional[Any]    =		20
           _A							:  Any    =		4
           _A							:  str    =		0

           _A							:  Any    =		FlaxForcedBOSTokenLogitsProcessor(bos_token_id=_a       )

           # check that all scores are -inf except the bos_token_id score
           _A							:  Dict    =		ids_tensor((batch_size, 1)	,  vocab_size=20       )
           _A							:  Tuple    =		1
           _A							:  List[Any]    =		self._get_uniform_logits(_a	,  _a       )
           _A							:  int    =		logits_processor(_a	,  _a	,  cur_len=_a       )
           self.assertTrue(jnp.isneginf(scores[:, bos_token_id + 1 :]       ).all()       )
           self.assertListEqual(scores[:, bos_token_id].tolist()	,  4 * [0]       )  # score for bos_token_id shold be zero

           # check that bos_token_id is not forced if current length is greater than 1
           _A							:  Any    =		3
           _A							:  Dict    =		self._get_uniform_logits(_a	,  _a       )
           _A							:  List[str]    =		logits_processor(_a	,  _a	,  cur_len=_a       )
           self.assertFalse(jnp.isinf(_a       ).any()       )

     def       a__			(						self       )		->							Union[str, Any]:
           _A							:  Optional[int]    =		20
           _A							:  Optional[int]    =		4
           _A							:  Any    =		0
           _A							:  Dict    =		5

           _A							:  List[Any]    =		FlaxForcedEOSTokenLogitsProcessor(max_length=_a	,  eos_token_id=_a       )

           # check that all scores are -inf except the eos_token_id when max_length is reached
           _A							:  List[Any]    =		ids_tensor((batch_size, 4)	,  vocab_size=20       )
           _A							:  Optional[Any]    =		4
           _A							:  str    =		self._get_uniform_logits(_a	,  _a       )
           _A							:  Any    =		logits_processor(_a	,  _a	,  cur_len=_a       )
           self.assertTrue(jnp.isneginf(scores[:, eos_token_id + 1 :]       ).all()       )
           self.assertListEqual(scores[:, eos_token_id].tolist()	,  4 * [0]       )  # score for eos_token_id should be zero

           # check that eos_token_id is not forced if max_length is not reached
           _A							:  Any    =		3
           _A							:  int    =		self._get_uniform_logits(_a	,  _a       )
           _A							:  List[str]    =		logits_processor(_a	,  _a	,  cur_len=_a       )
           self.assertFalse(jnp.isinf(_a       ).any()       )

     def       a__			(						self       )		->							List[Any]:
           _A							:  Dict    =		4
           _A							:  Tuple    =		10
           _A							:  int    =		15
           _A							:  int    =		2
           _A							:  Any    =		1
           _A							:  Tuple    =		15

           # dummy input_ids and scores
           _A							:  List[Any]    =		ids_tensor((batch_size, sequence_length)	,  _a       )
           _A							:  Optional[int]    =		input_ids.copy()

           _A							:  Union[str, Any]    =		self._get_uniform_logits(_a	,  _a       )
           _A							:  Optional[int]    =		scores.copy()

           # instantiate all dist processors
           _A							:  Tuple    =		FlaxTemperatureLogitsWarper(temperature=0.5       )
           _A							:  List[str]    =		FlaxTopKLogitsWarper(3       )
           _A							:  Optional[int]    =		FlaxTopPLogitsWarper(0.8       )

           # instantiate all logits processors
           _A							:  Union[str, Any]    =		FlaxMinLengthLogitsProcessor(min_length=10	,  eos_token_id=_a       )
           _A							:  List[str]    =		FlaxForcedBOSTokenLogitsProcessor(bos_token_id=_a       )
           _A							:  List[str]    =		FlaxForcedEOSTokenLogitsProcessor(max_length=_a	,  eos_token_id=_a       )

           _A							:  Union[str, Any]    =		10

           # no processor list
           _A							:  Optional[int]    =		temp_dist_warp(_a	,  _a	,  cur_len=_a       )
           _A							:  Tuple    =		top_k_warp(_a	,  _a	,  cur_len=_a       )
           _A							:  List[str]    =		top_p_warp(_a	,  _a	,  cur_len=_a       )
           _A							:  str    =		min_dist_proc(_a	,  _a	,  cur_len=_a       )
           _A							:  Union[str, Any]    =		bos_dist_proc(_a	,  _a	,  cur_len=_a       )
           _A							:  Optional[int]    =		eos_dist_proc(_a	,  _a	,  cur_len=_a       )

           # with processor list
           _A							:  Tuple    =		FlaxLogitsProcessorList(
               [temp_dist_warp, top_k_warp, top_p_warp, min_dist_proc, bos_dist_proc, eos_dist_proc]       )
           _A							:  str    =		processor(_a	,  _a	,  cur_len=_a       )

           # scores should be equal
           self.assertTrue(jnp.allclose(_a	,  _a	,  atol=1e-3       )       )

           # input_ids should never be changed
           self.assertListEqual(input_ids.tolist()	,  input_ids_comp.tolist()       )



     def       a__			(						self       )		->							str:
           _A							:  int    =		4
           _A							:  Tuple    =		10
           _A							:  Optional[Any]    =		15
           _A							:  str    =		2
           _A							:  str    =		1
           _A							:  Dict    =		15

           # dummy input_ids and scores
           _A							:  int    =		ids_tensor((batch_size, sequence_length)	,  _a       )
           _A							:  List[Any]    =		input_ids.copy()

           _A							:  int    =		self._get_uniform_logits(_a	,  _a       )
           _A							:  Optional[int]    =		scores.copy()

           # instantiate all dist processors
           _A							:  Any    =		FlaxTemperatureLogitsWarper(temperature=0.5       )
           _A							:  Any    =		FlaxTopKLogitsWarper(3       )
           _A							:  Any    =		FlaxTopPLogitsWarper(0.8       )

           # instantiate all logits processors
           _A							:  int    =		FlaxMinLengthLogitsProcessor(min_length=10	,  eos_token_id=_a       )
           _A							:  Union[str, Any]    =		FlaxForcedBOSTokenLogitsProcessor(bos_token_id=_a       )
           _A							:  Union[str, Any]    =		FlaxForcedEOSTokenLogitsProcessor(max_length=_a	,  eos_token_id=_a       )

           _A							:  List[str]    =		10

           # no processor list
           def run_no_processor_list(_a	,  _a	,  _a       ):
                 _A							:  List[str]    =		temp_dist_warp(_a	,  _a	,  cur_len=_a       )
                 _A							:  Any    =		top_k_warp(_a	,  _a	,  cur_len=_a       )
                 _A							:  str    =		top_p_warp(_a	,  _a	,  cur_len=_a       )
                 _A							:  Optional[Any]    =		min_dist_proc(_a	,  _a	,  cur_len=_a       )
                 _A							:  Optional[int]    =		bos_dist_proc(_a	,  _a	,  cur_len=_a       )
                 _A							:  List[str]    =		eos_dist_proc(_a	,  _a	,  cur_len=_a       )
                 return scores

           # with processor list
           def run_processor_list(_a	,  _a	,  _a       ):
                 _A							:  Optional[int]    =		FlaxLogitsProcessorList(
                     [temp_dist_warp, top_k_warp, top_p_warp, min_dist_proc, bos_dist_proc, eos_dist_proc]       )
                 _A							:  Optional[Any]    =		processor(_a	,  _a	,  cur_len=_a       )
                 return scores

           _A							:  int    =		jax.jit(_a       )
           _A							:  str    =		jax.jit(_a       )

           _A							:  Tuple    =		jitted_run_no_processor_list(_a	,  _a	,  _a       )
           _A							:  str    =		jitted_run_processor_list(_a	,  _a	,  _a       )

           # scores should be equal
           self.assertTrue(jnp.allclose(_a	,  _a	,  atol=1e-3       )       )

           # input_ids should never be changed
           self.assertListEqual(input_ids.tolist()	,  input_ids_comp.tolist()       )







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

import black


_snake_case            = 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.
_snake_case            = "    def __init__(self, config):\n        super().__init__()\n        self.transform = BertPredictionHeadTransform(config)\n\n        # The output weights are the same as the input embeddings, but there is\n        # an output-only bias for each token.\n        self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)\n\n        self.bias = nn.Parameter(torch.zeros(config.vocab_size))\n\n        # Need a link between the two variables so that the bias is correctly resized with `resize_token_embeddings`\n        self.decoder.bias = self.bias\n\n    def forward(self, hidden_states):\n        hidden_states = self.transform(hidden_states)\n        hidden_states = self.decoder(hidden_states)\n        return hidden_states\n"







class 		lowercase							(     unittest.TestCase	):

     def       a__			(						self       )		->							Union[str, Any]:
           _A							:  List[str]    =		tempfile.mkdtemp()
           os.makedirs(os.path.join(self.transformer_dir	,  """models/bert/"""       )       )
           _A							:  str    =		self.transformer_dir
           shutil.copy(
               os.path.join(_a	,  """src/transformers/models/bert/modeling_bert.py"""       )	,  os.path.join(self.transformer_dir	,  """models/bert/modeling_bert.py"""       )	,  )

     def       a__			(						self       )		->							Optional[int]:
           _A							:  List[str]    =		"""src/transformers"""
           shutil.rmtree(self.transformer_dir       )

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

     def       a__			(						self       )		->							str:
           _A							:  Union[str, Any]    =		check_copies.find_code_in_transformers("""models.bert.modeling_bert.BertLMPredictionHead"""       )
           self.assertEqual(_a	,  _a       )

     def       a__			(						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"""	,  _a	,  )

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

           # Copy consistency with a really long name
           _A							:  List[str]    =		"""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"""	,  _a	,  _a       )	,  )

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



     def       a__			(						self       )		->							Tuple:
           _A							:  Union[str, Any]    =		check_copies.LOCALIZED_READMES["""README_zh-hans.md"""]

           _A							:  str    =		(
               """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							:  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							:  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							:  Tuple    =		check_copies.convert_to_localized_md(
               _a	,  _a	,  localized_readme["""format_model_list"""]       )

           self.assertFalse(_a       )
           self.assertEqual(_a	,  _a       )

           _A    ,     _A							:  List[str]    =		check_copies.convert_to_localized_md(
               _a	,  _a	,  localized_readme["""format_model_list"""]       )

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

           _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."""
           )
           _A							:  Dict    =		(
               """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							:  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    ,     _A							:  Optional[int]    =		check_copies.convert_to_localized_md(
               _a	,  _a	,  localized_readme["""format_model_list"""]       )

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

