




# Note: if you intend to run this script make sure you look under scripts/fsmt/
# to locate the appropriate script to do the work correctly. There is a set of scripts to:
# - download and prepare data and run the conversion script
# - perform eval to get the best hparam into the config
# - generate model_cards - useful if you have multiple models from the same paper

import argparse
import json
import os
import re
from collections import OrderedDict
from os.path import basename, dirname

import fairseq
import torch
from fairseq import hub_utils
from fairseq.data.dictionary import Dictionary

from transformers import FSMTConfig, FSMTForConditionalGeneration
from transformers.models.fsmt.tokenization_fsmt import VOCAB_FILES_NAMES
from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE
from transformers.utils import WEIGHTS_NAME, logging


logging.set_verbosity_warning()

_snake_case            = 2

# based on the results of a search on a range of `num_beams`, `length_penalty` and `early_stopping`
# values against wmt19 test data to obtain the best BLEU scores, we will use the following defaults:
#
# * `num_beams`: 5 (higher scores better, but requires more memory/is slower, can be adjusted by users)
# * `early_stopping`: `False` consistently scored better
# * `length_penalty` varied, so will assign the best one depending on the model
_snake_case            = {
    # fairseq:
    "wmt19-ru-en": {"length_penalty": 1.1},
    "wmt19-en-ru": {"length_penalty": 1.1_5},
    "wmt19-en-de": {"length_penalty": 1.0},
    "wmt19-de-en": {"length_penalty": 1.1},
    # allenai:
    "wmt16-en-de-dist-12-1": {"length_penalty": 0.6},
    "wmt16-en-de-dist-6-1": {"length_penalty": 0.6},
    "wmt16-en-de-12-1": {"length_penalty": 0.8},
    "wmt19-de-en-6-6-base": {"length_penalty": 0.6},
    "wmt19-de-en-6-6-big": {"length_penalty": 0.6},
}

# this remaps the different models to their organization names
_snake_case            = {}
for m in ["wmt19-ru-en", "wmt19-en-ru", "wmt19-en-de", "wmt19-de-en"]:
  _snake_case            = "facebook"
for m in [
    "wmt16-en-de-dist-12-1",
    "wmt16-en-de-dist-6-1",
    "wmt16-en-de-12-1",
    "wmt19-de-en-6-6-base",
    "wmt19-de-en-6-6-big",
]:
  _snake_case            = "allenai"







def        lowerCAmelCase_			(  snake_case_  ):
      # (1) remove word breaking symbol, (2) add word ending symbol where the word is not broken up,
      # e.g.: d = {'le@@': 5, 'tt@@': 6, 'er': 7} => {'le': 5, 'tt': 6, 'er</w>': 7}
      _A							:  Union[str, Any]    =		dict((re.sub(r"""@@$""","""""",snake_case_  ), v) if k.endswith("""@@"""  ) else (re.sub(r"""$""","""</w>""",snake_case_  ), v) for k, v in d.items()  )
      _A							:  Optional[int]    =		"""<s> <pad> </s> <unk>""".split()
      # restore the special tokens
      for k in keep_keys:
            del da[f'''{k}</w>''']
            _A							:  Union[str, Any]    =		d[k]  # restore
      return da







def        lowerCAmelCase_			(  snake_case_,snake_case_  ):
      # prep
      assert os.path.exists(snake_case_  )
      os.makedirs(snake_case_,exist_ok=snake_case_  )
      print(f'''Writing results to {pytorch_dump_folder_path}'''  )

      # handle various types of models

      _A							:  Any    =		basename(snake_case_  )
      _A							:  Dict    =		dirname(snake_case_  )

      _A							:  str    =		fairseq.model_parallel.models.transformer.ModelParallelTransformerModel
      _A							:  Tuple    =		cls.hub_models()
      _A							:  str    =		{"""bpe""": """fastbpe""", """tokenizer""": """moses"""}
      _A							:  Tuple    =		"""."""
      # note: since the model dump is old, fairseq has upgraded its model some
      # time later, and it does a whole lot of rewrites and splits on the saved
      # weights, therefore we can't use torch.load() directly on the model file.
      # see: upgrade_state_dict(state_dict) in fairseq_model.py
      print(f'''using checkpoint {checkpoint_file}'''  )
      _A							:  List[str]    =		hub_utils.from_pretrained(
          snake_case_,snake_case_,snake_case_,archive_map=snake_case_,**snake_case_  )

      _A							:  Tuple    =		vars(chkpt["""args"""]["""model"""]  )

      _A							:  List[Any]    =		args["""source_lang"""]
      _A							:  Optional[Any]    =		args["""target_lang"""]

      _A							:  List[str]    =		dirname(snake_case_  )
      _A							:  Optional[Any]    =		basename(snake_case_  )

      # dicts
      _A							:  List[Any]    =		os.path.join(snake_case_,f'''dict.{src_lang}.txt'''  )
      _A							:  List[Any]    =		os.path.join(snake_case_,f'''dict.{tgt_lang}.txt'''  )

      _A							:  Optional[int]    =		Dictionary.load(snake_case_  )
      _A							:  Any    =		rewrite_dict_keys(src_dict.indices  )
      _A							:  int    =		len(snake_case_  )
      _A							:  int    =		os.path.join(snake_case_,"""vocab-src.json"""  )
      print(f'''Generating {src_vocab_file} of {src_vocab_size} of {src_lang} records'''  )
      with open(snake_case_,"""w""",encoding="""utf-8"""  ) as f:
            f.write(json.dumps(snake_case_,ensure_ascii=snake_case_,indent=snake_case_  )  )

      # detect whether this is a do_lower_case situation, which can be derived by checking whether we
      # have at least one uppercase letter in the source vocab
      _A							:  int    =		True
      for k in src_vocab.keys():
            if not k.islower():
                  _A							:  str    =		False
                  break

      _A							:  List[str]    =		Dictionary.load(snake_case_  )
      _A							:  Tuple    =		rewrite_dict_keys(tgt_dict.indices  )
      _A							:  Union[str, Any]    =		len(snake_case_  )
      _A							:  str    =		os.path.join(snake_case_,"""vocab-tgt.json"""  )
      print(f'''Generating {tgt_vocab_file} of {tgt_vocab_size} of {tgt_lang} records'''  )
      with open(snake_case_,"""w""",encoding="""utf-8"""  ) as f:
            f.write(json.dumps(snake_case_,ensure_ascii=snake_case_,indent=snake_case_  )  )

      # merges_file (bpecodes)
      _A							:  Optional[int]    =		os.path.join(snake_case_,VOCAB_FILES_NAMES["""merges_file"""]  )
      for fn in ["bpecodes", "code"]:  # older fairseq called the merges file "code"
            _A							:  Union[str, Any]    =		os.path.join(snake_case_,snake_case_  )
            if os.path.exists(snake_case_  ):
                  break
      with open(snake_case_,encoding="""utf-8"""  ) as fin:
            _A							:  Any    =		fin.read()
      _A							:  Optional[int]    =		re.sub(r""" \d+$""","""""",snake_case_,0,re.M  )  # remove frequency number
      print(f'''Generating {merges_file}'''  )
      with open(snake_case_,"""w""",encoding="""utf-8"""  ) as fout:
            fout.write(snake_case_  )

      # model config
      _A							:  List[Any]    =		os.path.join(snake_case_,"""config.json"""  )

      # validate bpe/tokenizer config, as currently it's hardcoded to moses+fastbpe -
      # may have to modify the tokenizer if a different type is used by a future model
      assert args["bpe"] == "fastbpe", f'''need to extend tokenizer to support bpe={args["bpe"]}'''
      assert args["tokenizer"] == "moses", f'''need to extend tokenizer to support bpe={args["tokenizer"]}'''

      _A							:  Tuple    =		{
          """architectures""": ["""FSMTForConditionalGeneration"""],
          """model_type""": """fsmt""",
          """activation_dropout""": args["""activation_dropout"""],
          """activation_function""": """relu""",
          """attention_dropout""": args["""attention_dropout"""],
          """d_model""": args["""decoder_embed_dim"""],
          """dropout""": args["""dropout"""],
          """init_std""": 0.02,
          """max_position_embeddings""": args["""max_source_positions"""],
          """num_hidden_layers""": args["""encoder_layers"""],
          """src_vocab_size""": src_vocab_size,
          """tgt_vocab_size""": tgt_vocab_size,
          """langs""": [src_lang, tgt_lang],
          """encoder_attention_heads""": args["""encoder_attention_heads"""],
          """encoder_ffn_dim""": args["""encoder_ffn_embed_dim"""],
          """encoder_layerdrop""": args["""encoder_layerdrop"""],
          """encoder_layers""": args["""encoder_layers"""],
          """decoder_attention_heads""": args["""decoder_attention_heads"""],
          """decoder_ffn_dim""": args["""decoder_ffn_embed_dim"""],
          """decoder_layerdrop""": args["""decoder_layerdrop"""],
          """decoder_layers""": args["""decoder_layers"""],
          """bos_token_id""": 0,
          """pad_token_id""": 1,
          """eos_token_id""": 2,
          """is_encoder_decoder""": True,
          """scale_embedding""": not args["""no_scale_embedding"""],
          """tie_word_embeddings""": args["""share_all_embeddings"""],
      }

      # good hparam defaults to start with
      _A							:  int    =		5
      _A							:  int    =		False
      if model_dir in best_score_hparams and "length_penalty" in best_score_hparams[model_dir]:
            _A							:  Tuple    =		best_score_hparams[model_dir]["""length_penalty"""]
      else:
            _A							:  Optional[Any]    =		1.0

      print(f'''Generating {fsmt_model_config_file}'''  )
      with open(snake_case_,"""w""",encoding="""utf-8"""  ) as f:
            f.write(json.dumps(snake_case_,ensure_ascii=snake_case_,indent=snake_case_  )  )

      # tokenizer config
      _A							:  Dict    =		os.path.join(snake_case_,snake_case_  )

      _A							:  Any    =		{
          """langs""": [src_lang, tgt_lang],
          """model_max_length""": 1024,
          """do_lower_case""": do_lower_case,
      }

      print(f'''Generating {fsmt_tokenizer_config_file}'''  )
      with open(snake_case_,"""w""",encoding="""utf-8"""  ) as f:
            f.write(json.dumps(snake_case_,ensure_ascii=snake_case_,indent=snake_case_  )  )

      # model
      _A							:  Tuple    =		chkpt["""models"""][0]
      _A							:  Union[str, Any]    =		model.state_dict()

      # rename keys to start with 'model.'
      _A							:  Union[str, Any]    =		OrderedDict(("""model.""" + k, v) for k, v in model_state_dict.items()  )

      # remove unneeded keys
      _A							:  Optional[int]    =		[
          """model.model""",
          """model.encoder.version""",
          """model.decoder.version""",
          """model.encoder_embed_tokens.weight""",
          """model.decoder_embed_tokens.weight""",
          """model.encoder.embed_positions._float_tensor""",
          """model.decoder.embed_positions._float_tensor""",
      ]
      for k in ignore_keys:
            model_state_dict.pop(snake_case_,snake_case_  )

      _A							:  Union[str, Any]    =		FSMTConfig.from_pretrained(snake_case_  )
      _A							:  Any    =		FSMTForConditionalGeneration(snake_case_  )

      # check that it loads ok
      model_new.load_state_dict(snake_case_,strict=snake_case_  )

      # save
      _A							:  str    =		os.path.join(snake_case_,snake_case_  )
      print(f'''Generating {pytorch_weights_dump_path}'''  )
      torch.save(snake_case_,snake_case_  )

      print("""Conversion is done!"""  )
      print("""\nLast step is to upload the files to s3"""  )
      print(f'''cd {data_root}'''  )
      print(f'''transformers-cli upload {model_dir}'''  )


if __name__ == "__main__":
  _snake_case            = argparse.ArgumentParser()
  # Required parameters
  parser.add_argument(
      "--fsmt_checkpoint_path",
      default=None,
      type=str,
      required=True,
      help=(
          "Path to the official PyTorch checkpoint file which is expected to reside in the dump dir with dicts,"
          " bpecodes, etc."
      ),
  )
  parser.add_argument(
      "--pytorch_dump_folder_path", default=None, type=str, required=True, help="Path to the output PyTorch model."
  )
  _snake_case            = parser.parse_args()
  convert_fsmt_checkpoint_to_pytorch(args.fsmt_checkpoint_path, args.pytorch_dump_folder_path)







import unittest

from transformers import PegasusTokenizer, PegasusTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow
from transformers.utils import cached_property

from ...test_tokenization_common import TokenizerTesterMixin


_snake_case            = get_tests_dir("fixtures/test_sentencepiece_no_bos.model")







@require_sentencepiece
@require_tokenizers
class 		lowercase							(     UpperCamelCase__,unittest.TestCase	):
     _a											=		PegasusTokenizer
     _a											=		PegasusTokenizerFast
     _a											=		True
     _a											=		True

     def       a__			(						self       )		->							int:
           super().setUp()

           # We have a SentencePiece fixture for testing
           _A							:  List[Any]    =		PegasusTokenizer(_a       )
           tokenizer.save_pretrained(self.tmpdirname       )

     @cached_property
     def       a__			(						self       )		->							int:
           return PegasusTokenizer.from_pretrained("""google/pegasus-large"""       )

     def       a__			(						self	,  **_a       )		->							PegasusTokenizer:
           return PegasusTokenizer.from_pretrained(self.tmpdirname	,  **_a       )

     def       a__			(						self	,  _a       )		->							List[Any]:
           return ("This is a test", "This is a test")

     def       a__			(						self       )		->							int:
           _A							:  Dict    =		"""</s>"""
           _A							:  Dict    =		1

           self.assertEqual(self.get_tokenizer()._convert_token_to_id(_a       )	,  _a       )
           self.assertEqual(self.get_tokenizer()._convert_id_to_token(_a       )	,  _a       )

     def       a__			(						self       )		->							Dict:
           _A							:  List[str]    =		list(self.get_tokenizer().get_vocab().keys()       )

           self.assertEqual(vocab_keys[0]	,  """<pad>"""       )
           self.assertEqual(vocab_keys[1]	,  """</s>"""       )
           self.assertEqual(vocab_keys[-1]	,  """v"""       )
           self.assertEqual(len(_a       )	,  1103       )

     def       a__			(						self       )		->							Optional[int]:
           self.assertEqual(self.get_tokenizer().vocab_size	,  1103       )

     def       a__			(						self       )		->							Tuple:
           _A							:  Any    =		self.rust_tokenizer_class.from_pretrained(self.tmpdirname       )
           _A							:  Optional[int]    =		self.tokenizer_class.from_pretrained(self.tmpdirname       )
           _A							:  int    =		(
               """Let's see which <unk> is the better <unk_token_11> one <mask_1> It seems like this <mask_2> was important"""
               """ </s> <pad> <pad> <pad>"""
           )
           _A							:  Optional[int]    =		rust_tokenizer([raw_input_str]	,  return_tensors=_a	,  add_special_tokens=_a       ).input_ids[0]
           _A							:  List[Any]    =		py_tokenizer([raw_input_str]	,  return_tensors=_a	,  add_special_tokens=_a       ).input_ids[0]
           self.assertListEqual(_a	,  _a       )

     def       a__			(						self       )		->							Any:
           _A							:  str    =		self._large_tokenizer
           # <mask_1> masks whole sentence while <mask_2> masks single word
           _A							:  Optional[int]    =		"""<mask_1> To ensure a <mask_2> flow of bank resolutions."""
           _A							:  Union[str, Any]    =		[2, 413, 615, 114, 3, 1971, 113, 1679, 1_0710, 107, 1]
           _A							:  Union[str, Any]    =		tokenizer([raw_input_str]	,  return_tensors=_a       ).input_ids[0]
           self.assertListEqual(_a	,  _a       )

     def       a__			(						self       )		->							List[str]:
           _A							:  Optional[int]    =		self._large_tokenizer
           # The tracebacks for the following asserts are **better** without messages or self.assertEqual
           assert tokenizer.vocab_size == 9_6103
           assert tokenizer.pad_token_id == 0
           assert tokenizer.eos_token_id == 1
           assert tokenizer.offset == 103
           assert tokenizer.unk_token_id == tokenizer.offset + 2 == 105
           assert tokenizer.unk_token == "<unk>"
           assert tokenizer.model_max_length == 1024
           _A							:  Any    =		"""To ensure a smooth flow of bank resolutions."""
           _A							:  Optional[int]    =		[413, 615, 114, 2291, 1971, 113, 1679, 1_0710, 107, 1]
           _A							:  Optional[Any]    =		tokenizer([raw_input_str]	,  return_tensors=_a       ).input_ids[0]
           self.assertListEqual(_a	,  _a       )
           assert tokenizer.convert_ids_to_tokens([0, 1, 2, 3]       ) == ["<pad>", "</s>", "<mask_1>", "<mask_2>"]

     @require_torch
     def       a__			(						self       )		->							List[str]:
           _A							:  Union[str, Any]    =		["""This is going to be way too long.""" * 150, """short example"""]
           _A							:  Optional[Any]    =		["""not super long but more than 5 tokens""", """tiny"""]
           _A							:  Union[str, Any]    =		self._large_tokenizer(_a	,  padding=_a	,  truncation=_a	,  return_tensors="""pt"""       )
           _A							:  Tuple    =		self._large_tokenizer(
               text_target=_a	,  max_length=5	,  padding=_a	,  truncation=_a	,  return_tensors="""pt"""       )

           assert batch.input_ids.shape == (2, 1024)
           assert batch.attention_mask.shape == (2, 1024)
           assert targets["input_ids"].shape == (2, 5)
           assert len(_a       ) == 2  # input_ids, attention_mask.



     @slow
     def       a__			(						self       )		->							Optional[Any]:
           # fmt: off
           _A							:  List[Any]    =		{"""input_ids""": [[3_8979, 143, 1_8485, 606, 130, 2_6669, 8_7686, 121, 5_4189, 1129, 111, 2_6669, 8_7686, 121, 9114, 1_4787, 121, 1_3249, 158, 592, 956, 121, 1_4621, 3_1576, 143, 6_2613, 108, 9688, 930, 4_3430, 1_1562, 6_2613, 304, 108, 1_1443, 897, 108, 9314, 1_7415, 6_3399, 108, 1_1443, 7614, 1_8316, 118, 4284, 7148, 1_2430, 143, 1400, 2_5703, 158, 111, 4284, 7148, 1_1772, 143, 2_1297, 1064, 158, 122, 204, 3506, 1754, 1133, 1_4787, 1581, 115, 3_3224, 4482, 111, 1355, 110, 2_9173, 317, 5_0833, 108, 2_0147, 9_4665, 111, 7_7198, 107, 1], [110, 6_2613, 117, 638, 112, 1133, 121, 2_0098, 1355, 7_9050, 1_3872, 135, 1596, 5_3541, 1352, 141, 1_3039, 5542, 124, 302, 518, 111, 268, 2956, 115, 149, 4427, 107, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [139, 1235, 2799, 1_8289, 1_7780, 204, 109, 9474, 1296, 107, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], """attention_mask""": [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]}  # noqa: E501
           # fmt: on

           self.tokenizer_integration_test_util(
               expected_encoding=_a	,  model_name="""google/bigbird-pegasus-large-arxiv"""	,  revision="""ba85d0851d708441f91440d509690f1ab6353415"""	,  )







@require_sentencepiece
@require_tokenizers
class 		lowercase							(     UpperCamelCase__,unittest.TestCase	):
     _a											=		PegasusTokenizer
     _a											=		PegasusTokenizerFast
     _a											=		True
     _a											=		True

     def       a__			(						self       )		->							Optional[Any]:
           super().setUp()

           # We have a SentencePiece fixture for testing
           _A							:  Tuple    =		PegasusTokenizer(_a	,  offset=0	,  mask_token_sent=_a	,  mask_token="""[MASK]"""       )
           tokenizer.save_pretrained(self.tmpdirname       )

     @cached_property
     def       a__			(						self       )		->							Optional[Any]:
           return PegasusTokenizer.from_pretrained("""google/bigbird-pegasus-large-arxiv"""       )

     def       a__			(						self	,  **_a       )		->							PegasusTokenizer:
           return PegasusTokenizer.from_pretrained(self.tmpdirname	,  **_a       )

     def       a__			(						self	,  _a       )		->							List[str]:
           return ("This is a test", "This is a test")

     def       a__			(						self       )		->							List[Any]:
           _A							:  List[Any]    =		self.rust_tokenizer_class.from_pretrained(self.tmpdirname       )
           _A							:  Dict    =		self.tokenizer_class.from_pretrained(self.tmpdirname       )
           _A							:  Dict    =		(
               """Let's see which <unk> is the better <unk_token> one [MASK] It seems like this [MASK] was important </s>"""
               """ <pad> <pad> <pad>"""
           )
           _A							:  Optional[Any]    =		rust_tokenizer([raw_input_str]	,  return_tensors=_a	,  add_special_tokens=_a       ).input_ids[0]
           _A							:  int    =		py_tokenizer([raw_input_str]	,  return_tensors=_a	,  add_special_tokens=_a       ).input_ids[0]
           self.assertListEqual(_a	,  _a       )

     @require_torch
     def       a__			(						self       )		->							Optional[int]:
           _A							:  Tuple    =		["""This is going to be way too long.""" * 1000, """short example"""]
           _A							:  Optional[Any]    =		["""not super long but more than 5 tokens""", """tiny"""]
           _A							:  Tuple    =		self._large_tokenizer(_a	,  padding=_a	,  truncation=_a	,  return_tensors="""pt"""       )
           _A							:  str    =		self._large_tokenizer(
               text_target=_a	,  max_length=5	,  padding=_a	,  truncation=_a	,  return_tensors="""pt"""       )

           assert batch.input_ids.shape == (2, 4096)
           assert batch.attention_mask.shape == (2, 4096)
           assert targets["input_ids"].shape == (2, 5)
           assert len(_a       ) == 2  # input_ids, attention_mask.



     def       a__			(						self       )		->							Dict:
           _A							:  Optional[int]    =		(
               """This is an example string that is used to test the original TF implementation against the HF"""
               """ implementation"""
           )

           _A							:  Any    =		self._large_tokenizer(_a       ).input_ids

           self.assertListEqual(
               _a	,  [182, 117, 142, 587, 4211, 120, 117, 263, 112, 804, 109, 856, 2_5016, 3137, 464, 109, 2_6955, 3137, 1]	,  )

