





'''simple docstring'''






import argparse
import json
import math
import os
import time
import traceback
import zipfile
from collections import Counter

import requests



def        UpperCamelCase__		(						__magic_name__  :   str		,       __magic_name__  :   List[Any]=None      )				->			Union[str, Any]:
 '''simple docstring'''






 snake_case__     :					str    =  None
 if token is not None:
  snake_case__     :					str    =  {"""Accept""": """application/vnd.github+json""", """Authorization""": f"Bearer {token}"}

 snake_case__     :					List[Any]    =  f"https://api.github.com/repos/huggingface/transformers/actions/runs/{workflow_run_id}/jobs?per_page=100"
 snake_case__     :					str    =  requests.get(__magic_name__		,       headers=__magic_name__      ).json()
 snake_case__     :					str    =  {}

 try:
  job_links.update({job["""name"""]: job["""html_url"""] for job in result["""jobs"""]}      )
  snake_case__     :					List[Any]    =  math.ceil((result["""total_count"""] - 1_00) / 1_00      )

  for i in range(__magic_name__      ):
   snake_case__     :					Tuple    =  requests.get(url + f"&page={i + 2}"		,       headers=__magic_name__      ).json()
   job_links.update({job["""name"""]: job["""html_url"""] for job in result["""jobs"""]}      )

  return job_links
 except Exception:
  print(f"Unknown error, could not fetch links:\n{traceback.format_exc()}"      )

 return {}



def        UpperCamelCase__		(						__magic_name__  :   Optional[int]		,       __magic_name__  :   Optional[Any]=None      )				->			List[str]:
 '''simple docstring'''






 snake_case__     :					Optional[Any]    =  None
 if token is not None:
  snake_case__     :					Any    =  {"""Accept""": """application/vnd.github+json""", """Authorization""": f"Bearer {token}"}

 snake_case__     :					Dict    =  f"https://api.github.com/repos/huggingface/transformers/actions/runs/{worflow_run_id}/artifacts?per_page=100"
 snake_case__     :					Union[str, Any]    =  requests.get(__magic_name__		,       headers=__magic_name__      ).json()
 snake_case__     :					Dict    =  {}

 try:
  artifacts.update({artifact["""name"""]: artifact["""archive_download_url"""] for artifact in result["""artifacts"""]}      )
  snake_case__     :					List[Any]    =  math.ceil((result["""total_count"""] - 1_00) / 1_00      )

  for i in range(__magic_name__      ):
   snake_case__     :					Dict    =  requests.get(url + f"&page={i + 2}"		,       headers=__magic_name__      ).json()
   artifacts.update({artifact["""name"""]: artifact["""archive_download_url"""] for artifact in result["""artifacts"""]}      )

  return artifacts
 except Exception:
  print(f"Unknown error, could not fetch links:\n{traceback.format_exc()}"      )

 return {}



def        UpperCamelCase__		(						__magic_name__  :   Optional[int]		,       __magic_name__  :   Optional[Any]		,       __magic_name__  :   Optional[int]		,       __magic_name__  :   Dict      )				->			Dict:
 '''simple docstring'''






 snake_case__     :					Optional[Any]    =  None
 if token is not None:
  snake_case__     :					Dict    =  {"""Accept""": """application/vnd.github+json""", """Authorization""": f"Bearer {token}"}

 snake_case__     :					str    =  requests.get(__magic_name__		,       headers=__magic_name__		,       allow_redirects=__magic_name__      )
 snake_case__     :					Any    =  result.headers["""Location"""]
 snake_case__     :					Tuple    =  requests.get(__magic_name__		,       allow_redirects=__magic_name__      )
 snake_case__     :					int    =  os.path.join(__magic_name__		,       f"{artifact_name}.zip"      )
 with open(__magic_name__		,       """wb"""      ) as fp:
  fp.write(response.content      )



def        UpperCamelCase__		(						__magic_name__  :   List[Any]		,       __magic_name__  :   str=None      )				->			Union[str, Any]:
 '''simple docstring'''






 snake_case__     :					Any    =  []
 snake_case__     :					Union[str, Any]    =  []
 snake_case__     :					Any    =  None

 with zipfile.ZipFile(__magic_name__      ) as z:
  for filename in z.namelist():
   if not os.path.isdir(__magic_name__      ):
    # read the file
    if filename in ["failures_line.txt", "summary_short.txt", "job_name.txt"]:
     with z.open(__magic_name__      ) as f:
      for line in f:
       snake_case__     :					Any    =  line.decode("""UTF-8"""      ).strip()
       if filename == "failures_line.txt":
        try:
         # `error_line` is the place where `error` occurs
         snake_case__     :					str    =  line[: line.index(""": """      )]
         snake_case__     :					Optional[int]    =  line[line.index(""": """      ) + len(""": """      ) :]
         errors.append([error_line, error]      )
        except Exception:
         # skip un-related lines
         pass
       elif filename == "summary_short.txt" and line.startswith("""FAILED """      ):
        # `test` is the test method that failed
        snake_case__     :					Dict    =  line[len("""FAILED """      ) :]
        failed_tests.append(__magic_name__      )
       elif filename == "job_name.txt":
        snake_case__     :					Optional[Any]    =  line

 if len(__magic_name__      ) != len(__magic_name__      ):
  raise ValueError(
      f"`errors` and `failed_tests` should have the same number of elements. Got {len(__magic_name__      )} for `errors` "
      f"and {len(__magic_name__      )} for `failed_tests` instead. The test reports in {artifact_zip_path} have some"
      """ problem."""      )

 snake_case__     :					Optional[Any]    =  None
 if job_name and job_links:
  snake_case__     :					Optional[Any]    =  job_links.get(__magic_name__		,       __magic_name__      )

 # A list with elements of the form (line of error, error, failed test)
 snake_case__     :					List[Any]    =  [x + [y] + [job_link] for x, y in zip(__magic_name__		,       __magic_name__      )]

 return result



def        UpperCamelCase__		(						__magic_name__  :   int		,       __magic_name__  :   Union[str, Any]=None      )				->			Union[str, Any]:
 '''simple docstring'''






 snake_case__     :					str    =  []

 snake_case__     :					Dict    =  [os.path.join(__magic_name__		,       __magic_name__      ) for p in os.listdir(__magic_name__      ) if p.endswith(""".zip"""      )]
 for p in paths:
  errors.extend(get_errors_from_single_artifact(__magic_name__		,       job_links=__magic_name__      )      )

 return errors



def        UpperCamelCase__		(						__magic_name__  :   Optional[Any]		,       __magic_name__  :   str=None      )				->			List[Any]:
 '''simple docstring'''






 snake_case__     :					Any    =  Counter()
 counter.update([x[1] for x in logs]      )
 snake_case__     :					Dict    =  counter.most_common()
 snake_case__     :					Any    =  {}
 for error, count in counts:
  if error_filter is None or error not in error_filter:
   snake_case__     :					int    =  {"""count""": count, """failed_tests""": [(x[2], x[0]) for x in logs if x[1] == error]}

 snake_case__     :					Union[str, Any]    =  dict(sorted(r.items()		,       key=lambda __magic_name__      : item[1]["count"]		,       reverse=__magic_name__      )      )
 return r



def        UpperCamelCase__		(						__magic_name__  :   List[Any]      )				->			List[Any]:
 '''simple docstring'''






 snake_case__     :					str    =  test.split("""::"""      )[0]
 if test.startswith("""tests/models/"""      ):
  snake_case__     :					Tuple    =  test.split("""/"""      )[2]
 else:
  snake_case__     :					Any    =  None

 return test



def        UpperCamelCase__		(						__magic_name__  :   str		,       __magic_name__  :   Union[str, Any]=None      )				->			List[str]:
 '''simple docstring'''






 snake_case__     :					List[str]    =  [(x[0], x[1], get_model(x[2]      )) for x in logs]
 snake_case__     :					List[Any]    =  [x for x in logs if x[2] is not None]
 snake_case__     :					Any    =  {x[2] for x in logs}

 snake_case__     :					Optional[Any]    =  {}
 for test in tests:
  snake_case__     :					str    =  Counter()
  # count by errors in `test`
  counter.update([x[1] for x in logs if x[2] == test]      )
  snake_case__     :					Optional[int]    =  counter.most_common()
  snake_case__     :					Optional[int]    =  {error: count for error, count in counts if (error_filter is None or error not in error_filter)}
  snake_case__     :					int    =  sum(error_counts.values()      )
  if n_errors > 0:
   snake_case__     :					str    =  {"""count""": n_errors, """errors""": error_counts}

 snake_case__     :					Union[str, Any]    =  dict(sorted(r.items()		,       key=lambda __magic_name__      : item[1]["count"]		,       reverse=__magic_name__      )      )
 return r



def        UpperCamelCase__		(						__magic_name__  :   int      )				->			Optional[int]:
 '''simple docstring'''






 snake_case__     :					Optional[Any]    =  """| no. | error | status |"""
 snake_case__     :					int    =  """|-:|:-|:-|"""
 snake_case__     :					int    =  [header, sep]
 for error in reduced_by_error:
  snake_case__     :					Union[str, Any]    =  reduced_by_error[error]["""count"""]
  snake_case__     :					Dict    =  f"| {count} | {error[:1_00]} |  |"
  lines.append(__magic_name__      )

 return "\n".join(__magic_name__      )



def        UpperCamelCase__		(						__magic_name__  :   Dict      )				->			List[Any]:
 '''simple docstring'''






 snake_case__     :					List[Any]    =  """| model | no. of errors | major error | count |"""
 snake_case__     :					Optional[int]    =  """|-:|-:|-:|-:|"""
 snake_case__     :					Dict    =  [header, sep]
 for model in reduced_by_model:
  snake_case__     :					Tuple    =  reduced_by_model[model]["""count"""]
  snake_case__  ,							snake_case__     :					Tuple    =  list(reduced_by_model[model]["""errors"""].items()      )[0]
  snake_case__     :					Optional[int]    =  f"| {model} | {count} | {error[:60]} | {_count} |"
  lines.append(__magic_name__      )

 return "\n".join(__magic_name__      )


if __name__ == "__main__":
    A_		:  Any		 =						argparse.ArgumentParser()
    # Required parameters
    parser.add_argument("--workflow_run_id", type=str, required=True, help="A GitHub Actions workflow run id.")
    parser.add_argument(
        "--output_dir",
        type=str,
        required=True,
        help="Where to store the downloaded artifacts and other result files.",
    )
    parser.add_argument("--token", default=None, type=str, help="A token that has actions:read permission.")
    A_		:  int		 =						parser.parse_args()

    os.makedirs(args.output_dir, exist_ok=True)

    A_		:  Optional[int]		 =						get_job_links(args.workflow_run_id, token=args.token)
    A_		:  Optional[Any]		 =						{}
    # To deal with `workflow_call` event, where a job name is the combination of the job names in the caller and callee.
    # For example, `PyTorch 1.11 / Model tests (models/albert, single-gpu)`.
    if _job_links:
        for k, v in _job_links.items():
            # This is how GitHub actions combine job names.
            if " / " in k:
                A_		:  int		 =						k.find(" / ")
                A_		:  List[Any]		 =						k[index + len(" / ") :]
            A_		:  List[str]		 =						v
    with open(os.path.join(args.output_dir, "job_links.json"), "w", encoding="UTF-8") as fp:
        json.dump(job_links, fp, ensure_ascii=False, indent=4)

    A_		:  int		 =						get_artifacts_links(args.workflow_run_id, token=args.token)
    with open(os.path.join(args.output_dir, "artifacts.json"), "w", encoding="UTF-8") as fp:
        json.dump(artifacts, fp, ensure_ascii=False, indent=4)

    for idx, (name, url) in enumerate(artifacts.items()):
        download_artifact(name, url, args.output_dir, args.token)
        # Be gentle to GitHub
        time.sleep(1)

    A_		:  str		 =						get_all_errors(args.output_dir, job_links=job_links)

    # `e[1]` is the error
    A_		:  List[str]		 =						Counter()
    counter.update([e[1] for e in errors])

    # print the top 30 most common test errors
    A_		:  Any		 =						counter.most_common(30)
    for item in most_common:
        print(item)

    with open(os.path.join(args.output_dir, "errors.json"), "w", encoding="UTF-8") as fp:
        json.dump(errors, fp, ensure_ascii=False, indent=4)

    A_		:  Any		 =						reduce_by_error(errors)
    A_		:  Union[str, Any]		 =						reduce_by_model(errors)

    A_		:  Any		 =						make_github_table(reduced_by_error)
    A_		:  Optional[Any]		 =						make_github_table_per_model(reduced_by_model)

    with open(os.path.join(args.output_dir, "reduced_by_error.txt"), "w", encoding="UTF-8") as fp:
        fp.write(sa)
    with open(os.path.join(args.output_dir, "reduced_by_model.txt"), "w", encoding="UTF-8") as fp:
        fp.write(sa)











"""simple docstring"""





import json
import os
import shutil
import tempfile
import unittest

from transformers import BatchEncoding, CanineTokenizer
from transformers.testing_utils import require_tokenizers, require_torch
from transformers.tokenization_utils import AddedToken
from transformers.utils import cached_property

from ...test_tokenization_common import TokenizerTesterMixin

class 						lowercase   (   _UpperCAmelCase	,    unittest.TestCase   ):
      _SCREAMING_SNAKE_CASE							      = CanineTokenizer
      _SCREAMING_SNAKE_CASE							      = False





      def        _snake_case     (			self					)						->	Any:
            super().setUp()
            lowerCAmelCase    		=			CanineTokenizer()
            tokenizer.save_pretrained(self.tmpdirname					)





      @cached_property
      def        _snake_case     (			self					)						->	Union[str, Any]:
            return CanineTokenizer.from_pretrained("""google/canine-s"""					)





      def        _snake_case     (			self ,		**lowercase					)						->	CanineTokenizer:
            lowerCAmelCase    		=			self.tokenizer_class.from_pretrained(self.tmpdirname ,		**lowercase					)
            lowerCAmelCase    		=			1_024
            return tokenizer





      @require_torch
      def        _snake_case     (			self					)						->	str:
            lowerCAmelCase    		=			self.canine_tokenizer
            lowerCAmelCase    		=			["""Life is like a box of chocolates.""", """You never know what you're gonna get."""]
            # fmt: off
            lowerCAmelCase    		=			[57_344, 76, 105, 102, 101, 32, 105, 115, 32, 108, 105, 107, 101, 32, 97, 32, 98, 111, 120, 32, 111, 102, 32, 99, 104, 111, 99, 111, 108, 97, 116, 101, 115, 46, 57_345, 0, 0, 0, 0]
            # fmt: on
            lowerCAmelCase    		=			tokenizer(lowercase ,		padding=lowercase ,		return_tensors="""pt"""					)
            self.assertIsInstance(lowercase ,		lowercase					)

            lowerCAmelCase    		=			list(batch.input_ids.numpy()[0]					)

            self.assertListEqual(lowercase ,		lowercase					)

            self.assertEqual((2, 39) ,		batch.input_ids.shape					)
            self.assertEqual((2, 39) ,		batch.attention_mask.shape					)





      @require_torch
      def        _snake_case     (			self					)						->	Optional[Any]:
            lowerCAmelCase    		=			self.canine_tokenizer
            lowerCAmelCase    		=			["""Once there was a man.""", """He wrote a test in HuggingFace Tranformers."""]
            lowerCAmelCase    		=			tokenizer(lowercase ,		padding=lowercase ,		return_tensors="""pt"""					)
            # check if input_ids, attention_mask and token_type_ids are returned
            self.assertIn("""input_ids""" ,		lowercase					)
            self.assertIn("""attention_mask""" ,		lowercase					)
            self.assertIn("""token_type_ids""" ,		lowercase					)





      @require_torch
      def        _snake_case     (			self					)						->	Optional[int]:
            lowerCAmelCase    		=			self.canine_tokenizer
            lowerCAmelCase    		=			[
                """What's the weater?""",
                """It's about 25 degrees.""",
            ]
            lowerCAmelCase    		=			tokenizer(
                text_target=lowercase ,		max_length=32 ,		padding="""max_length""" ,		truncation=lowercase ,		return_tensors="""pt"""					)
            self.assertEqual(32 ,		targets["""input_ids"""].shape[1]					)





      def        _snake_case     (			self					)						->	Tuple:
            # safety check on max_len default value so we are sure the test works
            lowerCAmelCase    		=			self.get_tokenizers()
            for tokenizer in tokenizers:
                  with self.subTest(f'{tokenizer.__class__.__name__}'					):
                        self.assertNotEqual(tokenizer.model_max_length ,		42					)

        # Now let's start the test
            lowerCAmelCase    		=			self.get_tokenizers()
            for tokenizer in tokenizers:
                  with self.subTest(f'{tokenizer.__class__.__name__}'					):
                        # Isolate this from the other tests because we save additional tokens/etc
                        lowerCAmelCase    		=			tempfile.mkdtemp()

                        lowerCAmelCase    		=			""" He is very happy, UNwant\u00E9d,running"""
                        lowerCAmelCase    		=			tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)
                        tokenizer.save_pretrained(lowercase					)

                        lowerCAmelCase    		=			tokenizer.__class__.from_pretrained(lowercase					)
                        lowerCAmelCase    		=			after_tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)
                        self.assertListEqual(lowercase ,		lowercase					)

                        shutil.rmtree(lowercase					)

            lowerCAmelCase    		=			self.get_tokenizers(model_max_length=42					)
            for tokenizer in tokenizers:
                  with self.subTest(f'{tokenizer.__class__.__name__}'					):
                        # Isolate this from the other tests because we save additional tokens/etc
                        lowerCAmelCase    		=			tempfile.mkdtemp()

                        lowerCAmelCase    		=			""" He is very happy, UNwant\u00E9d,running"""

                        lowerCAmelCase    		=			tokenizer.additional_special_tokens

                        # We can add a new special token for Canine as follows:
                        lowerCAmelCase    		=			chr(0XE_007					)
                        additional_special_tokens.append(lowercase					)
                        tokenizer.add_special_tokens({"""additional_special_tokens""": additional_special_tokens}					)
                        lowerCAmelCase    		=			tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)
                        tokenizer.save_pretrained(lowercase					)

                        lowerCAmelCase    		=			tokenizer.__class__.from_pretrained(lowercase					)
                        lowerCAmelCase    		=			after_tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)
                        self.assertListEqual(lowercase ,		lowercase					)
                        self.assertIn(lowercase ,		after_tokenizer.additional_special_tokens					)
                        self.assertEqual(after_tokenizer.model_max_length ,		42					)

                        lowerCAmelCase    		=			tokenizer.__class__.from_pretrained(lowercase ,		model_max_length=43					)
                        self.assertEqual(tokenizer.model_max_length ,		43					)

                        shutil.rmtree(lowercase					)





      def        _snake_case     (			self					)						->	Tuple:
            lowerCAmelCase    		=			self.get_tokenizers(do_lower_case=lowercase					)
            for tokenizer in tokenizers:
                  with self.subTest(f'{tokenizer.__class__.__name__}'					):
                        lowerCAmelCase		,						lowerCAmelCase    		=			self.get_clean_sequence(lowercase					)

                        # a special token for Canine can be defined as follows:
                        lowerCAmelCase    		=			0XE_005
                        lowerCAmelCase    		=			chr(lowercase					)

                        tokenizer.add_special_tokens({"""cls_token""": special_token}					)
                        lowerCAmelCase    		=			tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)
                        self.assertEqual(len(lowercase					) ,		1					)

                        lowerCAmelCase    		=			tokenizer.decode(ids + encoded_special_token ,		clean_up_tokenization_spaces=lowercase					)
                        lowerCAmelCase    		=			tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)

                        lowerCAmelCase    		=			tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)
                        lowerCAmelCase    		=			tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)
                        self.assertEqual(lowercase ,		input_encoded + special_token_id					)

                        lowerCAmelCase    		=			tokenizer.decode(lowercase ,		skip_special_tokens=lowercase					)
                        self.assertTrue(special_token not in decoded					)





      def        _snake_case     (			self					)						->	Union[str, Any]:
            lowerCAmelCase    		=			self.get_tokenizers(do_lower_case=lowercase					)
            for tokenizer in tokenizers:
                  with self.subTest(f'{tokenizer.__class__.__name__}'					):
                        lowerCAmelCase    		=			chr(0XE_005					)
                        lowerCAmelCase    		=			chr(0XE_006					)

                        # `add_tokens` method stores special tokens only in `tokenizer.unique_no_split_tokens`. (in tokenization_utils.py)
                        tokenizer.add_tokens([SPECIAL_TOKEN_1] ,		special_tokens=lowercase					)
                        # `add_special_tokens` method stores special tokens in `tokenizer.additional_special_tokens`,
                        # which also occur in `tokenizer.all_special_tokens`. (in tokenization_utils_base.py)
                        tokenizer.add_special_tokens({"""additional_special_tokens""": [SPECIAL_TOKEN_2]}					)

                        lowerCAmelCase    		=			tokenizer.tokenize(lowercase					)
                        lowerCAmelCase    		=			tokenizer.tokenize(lowercase					)

                        self.assertEqual(len(lowercase					) ,		1					)
                        self.assertEqual(len(lowercase					) ,		1					)
                        self.assertEqual(token_a[0] ,		lowercase					)
                        self.assertEqual(token_a[0] ,		lowercase					)





      @require_tokenizers
      def        _snake_case     (			self					)						->	Union[str, Any]:
            lowerCAmelCase    		=			self.get_tokenizers(do_lower_case=lowercase					)
            for tokenizer in tokenizers:
                  with self.subTest(f'{tokenizer.__class__.__name__}'					):
                        # a special token for Canine can be defined as follows:
                        lowerCAmelCase    		=			0XE_006
                        lowerCAmelCase    		=			chr(lowercase					)

                        lowerCAmelCase    		=			AddedToken(lowercase ,		lstrip=lowercase					)
                        tokenizer.add_special_tokens({"""additional_special_tokens""": [new_token]}					)

                        with tempfile.TemporaryDirectory() as tmp_dir_name:
                              tokenizer.save_pretrained(lowercase					)
                              tokenizer.from_pretrained(lowercase					)





      def        _snake_case     (			self					)						->	Dict:
            lowerCAmelCase    		=			[]
            if self.test_slow_tokenizer:
                  tokenizer_list.append((self.tokenizer_class, self.get_tokenizer())					)

            if self.test_rust_tokenizer:
                  tokenizer_list.append((self.rust_tokenizer_class, self.get_rust_tokenizer())					)

            for tokenizer_class, tokenizer_utils in tokenizer_list:
                  with tempfile.TemporaryDirectory() as tmp_dir:
                        tokenizer_utils.save_pretrained(lowercase					)

                        with open(os.path.join(lowercase ,		"""special_tokens_map.json"""					) ,		encoding="""utf-8"""					) as json_file:
                              lowerCAmelCase    		=			json.load(lowercase					)

                        with open(os.path.join(lowercase ,		"""tokenizer_config.json"""					) ,		encoding="""utf-8"""					) as json_file:
                              lowerCAmelCase    		=			json.load(lowercase					)

                        # a special token for Canine can be defined as follows:
                        lowerCAmelCase    		=			0XE_006
                        lowerCAmelCase    		=			chr(lowercase					)

                        lowerCAmelCase    		=			[new_token_a]
                        lowerCAmelCase    		=			[new_token_a]

                        with open(os.path.join(lowercase ,		"""special_tokens_map.json"""					) ,		"""w""" ,		encoding="""utf-8"""					) as outfile:
                              json.dump(lowercase ,		lowercase					)
                        with open(os.path.join(lowercase ,		"""tokenizer_config.json"""					) ,		"""w""" ,		encoding="""utf-8"""					) as outfile:
                              json.dump(lowercase ,		lowercase					)

                        # the following checks allow us to verify that our test works as expected, i.e. that the tokenizer takes
                        # into account the new value of additional_special_tokens given in the "tokenizer_config.json" and
                        # "special_tokens_map.json" files
                        lowerCAmelCase    		=			tokenizer_class.from_pretrained(lowercase ,		extra_ids=0					)
                        self.assertIn(lowercase ,		tokenizer_without_change_in_init.additional_special_tokens					)
                        # self.assertIn("an_additional_special_token",tokenizer_without_change_in_init.get_vocab()) # ByT5Tokenization no vocab
                        self.assertEqual(
                            [new_token_a] ,		tokenizer_without_change_in_init.convert_ids_to_tokens(
                                tokenizer_without_change_in_init.convert_tokens_to_ids([new_token_a]					)					) ,		)

                        lowerCAmelCase    		=			0XE_007
                        lowerCAmelCase    		=			chr(lowercase					)
                        # Now we test that we can change the value of additional_special_tokens in the from_pretrained
                        lowerCAmelCase    		=			[AddedToken(lowercase ,		lstrip=lowercase					)]
                        lowerCAmelCase    		=			tokenizer_class.from_pretrained(
                            lowercase ,		additional_special_tokens=lowercase ,		extra_ids=0					)

                        self.assertIn(lowercase ,		tokenizer.additional_special_tokens					)
                        # self.assertIn(new_token_2,tokenizer.get_vocab()) # ByT5Tokenization no vocab
                        self.assertEqual(
                            [new_token_a] ,		tokenizer.convert_ids_to_tokens(tokenizer.convert_tokens_to_ids([new_token_a]					)					)					)





      @require_tokenizers
      def        _snake_case     (			self					)						->	Tuple:
            lowerCAmelCase    		=			self.get_tokenizers(do_lower_case=lowercase					)
            for tokenizer in tokenizers:
                  with self.subTest(f'{tokenizer.__class__.__name__}'					):
                        lowerCAmelCase    		=			"""hello world"""
                        if self.space_between_special_tokens:
                              lowerCAmelCase    		=			"""[CLS] hello world [SEP]"""
                        else:
                              lowerCAmelCase    		=			input
                        lowerCAmelCase    		=			tokenizer.encode(lowercase ,		add_special_tokens=lowercase					)
                        lowerCAmelCase    		=			tokenizer.decode(lowercase ,		spaces_between_special_tokens=self.space_between_special_tokens					)
                        self.assertIn(lowercase ,		[output, output.lower()]					)





      def        _snake_case     (			self					)						->	List[str]:
            lowerCAmelCase    		=			self.get_tokenizers()
            for tokenizer in tokenizers:
                  with self.subTest(f'{tokenizer.__class__.__name__}'					):
                        lowerCAmelCase    		=			[
                            """bos_token""",
                            """eos_token""",
                            """unk_token""",
                            """sep_token""",
                            """pad_token""",
                            """cls_token""",
                            """mask_token""",
                        ]

            lowerCAmelCase    		=			"""a"""
            lowerCAmelCase    		=			ord(lowercase					)

            for attr in attributes_list:
                  setattr(lowercase ,		attr + """_id""" ,		lowercase					)
                  self.assertEqual(getattr(lowercase ,		lowercase					) ,		lowercase					)
                  self.assertEqual(getattr(lowercase ,		attr + """_id"""					) ,		lowercase					)

                  setattr(lowercase ,		attr + """_id""" ,		lowercase					)
                  self.assertEqual(getattr(lowercase ,		lowercase					) ,		lowercase					)
                  self.assertEqual(getattr(lowercase ,		attr + """_id"""					) ,		lowercase					)

            setattr(lowercase ,		"""additional_special_tokens_ids""" ,		[]					)
            self.assertListEqual(getattr(lowercase ,		"""additional_special_tokens"""					) ,		[]					)
            self.assertListEqual(getattr(lowercase ,		"""additional_special_tokens_ids"""					) ,		[]					)

            lowerCAmelCase    		=			0XE_006
            lowerCAmelCase    		=			chr(lowercase					)
            setattr(lowercase ,		"""additional_special_tokens_ids""" ,		[additional_special_token_id]					)
            self.assertListEqual(getattr(lowercase ,		"""additional_special_tokens"""					) ,		[additional_special_token]					)
            self.assertListEqual(getattr(lowercase ,		"""additional_special_tokens_ids"""					) ,		[additional_special_token_id]					)





      def        _snake_case     (			self					)						->	Tuple:
            pass





      def        _snake_case     (			self					)						->	Optional[Any]:
            pass





      def        _snake_case     (			self					)						->	Dict:
            pass





      def        _snake_case     (			self					)						->	str:
            pass





      def        _snake_case     (			self					)						->	Optional[int]:
            pass





      def        _snake_case     (			self					)						->	Optional[int]:
            pass





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





      def        _snake_case     (			self					)						->	Optional[Any]:
            pass






