





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 		UpperCamelCase__ (      lowerCAmelCase_							,      unittest.TestCase   ):



     '''simple docstring'''

     __snake_case    :	Tuple			=			CanineTokenizer
     __snake_case    :	Dict			=			False






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]       )     ->		str:




           '''simple docstring'''


           super().setUp()
           SCREAMING_SNAKE_CASE		=						CanineTokenizer()
           tokenizer.save_pretrained(self.tmpdirname       )






     @cached_property
     def 				SCREAMING_SNAKE_CASE__  (							self						:    str       )     ->		Union[str, Any]:




           '''simple docstring'''


           return CanineTokenizer.from_pretrained("""google/canine-s"""       )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]						,**lowerCamelCase__						:    List[Any]       )     ->		CanineTokenizer:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.tokenizer_class.from_pretrained(self.tmpdirname						,**lowerCamelCase__       )
           SCREAMING_SNAKE_CASE		=						1024
           return tokenizer






     @require_torch
     def 				SCREAMING_SNAKE_CASE__  (							self						:    List[str]       )     ->		Union[str, Any]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.canine_tokenizer
           SCREAMING_SNAKE_CASE		=						["""Life is like a box of chocolates.""", """You never know what you're gonna get."""]
           # fmt: off
           SCREAMING_SNAKE_CASE		=						[57344, 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, 57345, 0, 0, 0, 0]
           # fmt: on
           SCREAMING_SNAKE_CASE		=						tokenizer(lowerCamelCase__						,padding=lowerCamelCase__						,return_tensors="""pt"""       )
           self.assertIsInstance(lowerCamelCase__						,lowerCamelCase__       )

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

           self.assertListEqual(lowerCamelCase__						,lowerCamelCase__       )

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






     @require_torch
     def 				SCREAMING_SNAKE_CASE__  (							self						:    int       )     ->		Dict:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.canine_tokenizer
           SCREAMING_SNAKE_CASE		=						["""Once there was a man.""", """He wrote a test in HuggingFace Tranformers."""]
           SCREAMING_SNAKE_CASE		=						tokenizer(lowerCamelCase__						,padding=lowerCamelCase__						,return_tensors="""pt"""       )
           # check if input_ids, attention_mask and token_type_ids are returned
           self.assertIn("""input_ids"""						,lowerCamelCase__       )
           self.assertIn("""attention_mask"""						,lowerCamelCase__       )
           self.assertIn("""token_type_ids"""						,lowerCamelCase__       )






     @require_torch
     def 				SCREAMING_SNAKE_CASE__  (							self						:    str       )     ->		Optional[Any]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.canine_tokenizer
           SCREAMING_SNAKE_CASE		=						[
               """What's the weater?""",
               """It's about 25 degrees.""",
           ]
           SCREAMING_SNAKE_CASE		=						tokenizer(
               text_target=lowerCamelCase__						,max_length=32						,padding="""max_length"""						,truncation=lowerCamelCase__						,return_tensors="""pt"""       )
           self.assertEqual(32						,targets["""input_ids"""].shape[1]       )






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




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						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
           SCREAMING_SNAKE_CASE		=						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
                       SCREAMING_SNAKE_CASE		=						tempfile.mkdtemp()

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

                       SCREAMING_SNAKE_CASE		=						tokenizer.__class__.from_pretrained(lowerCamelCase__       )
                       SCREAMING_SNAKE_CASE		=						after_tokenizer.encode(lowerCamelCase__						,add_special_tokens=lowerCamelCase__       )
                       self.assertListEqual(lowerCamelCase__						,lowerCamelCase__       )

                       shutil.rmtree(lowerCamelCase__       )

           SCREAMING_SNAKE_CASE		=						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
                       SCREAMING_SNAKE_CASE		=						tempfile.mkdtemp()

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

                       SCREAMING_SNAKE_CASE		=						tokenizer.additional_special_tokens

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

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

                       SCREAMING_SNAKE_CASE		=						tokenizer.__class__.from_pretrained(lowerCamelCase__						,model_max_length=43       )
                       self.assertEqual(tokenizer.model_max_length						,43       )

                       shutil.rmtree(lowerCamelCase__       )






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




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.get_tokenizers(do_lower_case=lowerCamelCase__       )
           for tokenizer in tokenizers:
                 with self.subTest(F"""{tokenizer.__class__.__name__}"""       ):
                       SCREAMING_SNAKE_CASE,					SCREAMING_SNAKE_CASE		=						self.get_clean_sequence(lowerCamelCase__       )

                       # a special token for Canine can be defined as follows:
                       SCREAMING_SNAKE_CASE		=						0Xe_005
                       SCREAMING_SNAKE_CASE		=						chr(lowerCamelCase__       )

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

                       SCREAMING_SNAKE_CASE		=						tokenizer.decode(ids + encoded_special_token						,clean_up_tokenization_spaces=lowerCamelCase__       )
                       SCREAMING_SNAKE_CASE		=						tokenizer.encode(lowerCamelCase__						,add_special_tokens=lowerCamelCase__       )

                       SCREAMING_SNAKE_CASE		=						tokenizer.encode(lowerCamelCase__						,add_special_tokens=lowerCamelCase__       )
                       SCREAMING_SNAKE_CASE		=						tokenizer.encode(lowerCamelCase__						,add_special_tokens=lowerCamelCase__       )
                       self.assertEqual(lowerCamelCase__						,input_encoded + special_token_id       )

                       SCREAMING_SNAKE_CASE		=						tokenizer.decode(lowerCamelCase__						,skip_special_tokens=lowerCamelCase__       )
                       self.assertTrue(special_token not in decoded       )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Dict       )     ->		Optional[int]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.get_tokenizers(do_lower_case=lowerCamelCase__       )
           for tokenizer in tokenizers:
                 with self.subTest(F"""{tokenizer.__class__.__name__}"""       ):
                       SCREAMING_SNAKE_CASE		=						chr(0Xe_005       )
                       SCREAMING_SNAKE_CASE		=						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=lowerCamelCase__       )
                       # `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]}       )

                       SCREAMING_SNAKE_CASE		=						tokenizer.tokenize(lowerCamelCase__       )
                       SCREAMING_SNAKE_CASE		=						tokenizer.tokenize(lowerCamelCase__       )

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






     @require_tokenizers
     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]       )     ->		Any:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.get_tokenizers(do_lower_case=lowerCamelCase__       )
           for tokenizer in tokenizers:
                 with self.subTest(F"""{tokenizer.__class__.__name__}"""       ):
                       # a special token for Canine can be defined as follows:
                       SCREAMING_SNAKE_CASE		=						0Xe_006
                       SCREAMING_SNAKE_CASE		=						chr(lowerCamelCase__       )

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

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






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[int]       )     ->		List[str]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						[]
           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(lowerCamelCase__       )

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

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

                       # a special token for Canine can be defined as follows:
                       SCREAMING_SNAKE_CASE		=						0Xe_006
                       SCREAMING_SNAKE_CASE		=						chr(lowerCamelCase__       )

                       SCREAMING_SNAKE_CASE		=						[new_token_a]
                       SCREAMING_SNAKE_CASE		=						[new_token_a]

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

                       # 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
                       SCREAMING_SNAKE_CASE		=						tokenizer_class.from_pretrained(lowerCamelCase__						,extra_ids=0       )
                       self.assertIn(lowerCamelCase__						,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]       )       )						,)

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

                       self.assertIn(lowerCamelCase__						,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 				SCREAMING_SNAKE_CASE__  (							self						:    Union[str, Any]       )     ->		List[Any]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.get_tokenizers(do_lower_case=lowerCamelCase__       )
           for tokenizer in tokenizers:
                 with self.subTest(F"""{tokenizer.__class__.__name__}"""       ):
                       SCREAMING_SNAKE_CASE		=						"""hello world"""
                       if self.space_between_special_tokens:
                             SCREAMING_SNAKE_CASE		=						"""[CLS] hello world [SEP]"""
                       else:
                             SCREAMING_SNAKE_CASE		=						input
                       SCREAMING_SNAKE_CASE		=						tokenizer.encode(lowerCamelCase__						,add_special_tokens=lowerCamelCase__       )
                       SCREAMING_SNAKE_CASE		=						tokenizer.decode(lowerCamelCase__						,spaces_between_special_tokens=self.space_between_special_tokens       )
                       self.assertIn(lowerCamelCase__						,[output, output.lower()]       )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Any       )     ->		Optional[Any]:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE		=						self.get_tokenizers()
           for tokenizer in tokenizers:
                 with self.subTest(F"""{tokenizer.__class__.__name__}"""       ):
                       SCREAMING_SNAKE_CASE		=						[
                           """bos_token""",
                           """eos_token""",
                           """unk_token""",
                           """sep_token""",
                           """pad_token""",
                           """cls_token""",
                           """mask_token""",
                       ]

           SCREAMING_SNAKE_CASE		=						"""a"""
           SCREAMING_SNAKE_CASE		=						ord(lowerCamelCase__       )

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

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

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

           SCREAMING_SNAKE_CASE		=						0Xe_006
           SCREAMING_SNAKE_CASE		=						chr(lowerCamelCase__       )
           setattr(lowerCamelCase__						,"""additional_special_tokens_ids"""						,[additional_special_token_id]       )
           self.assertListEqual(getattr(lowerCamelCase__						,"""additional_special_tokens"""       )						,[additional_special_token]       )
           self.assertListEqual(getattr(lowerCamelCase__						,"""additional_special_tokens_ids"""       )						,[additional_special_token_id]       )






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Dict       )     ->		Any:




           '''simple docstring'''


           pass






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]       )     ->		Tuple:




           '''simple docstring'''


           pass






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]       )     ->		str:




           '''simple docstring'''


           pass






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




           '''simple docstring'''


           pass






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Tuple       )     ->		Any:




           '''simple docstring'''


           pass






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




           '''simple docstring'''


           pass






     def 				SCREAMING_SNAKE_CASE__  (							self						:    str       )     ->		List[str]:




           '''simple docstring'''


           pass






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




           '''simple docstring'''


           pass









import dataclasses
import json
import warnings
from dataclasses import dataclass, field
from time import time
from typing import List

from ..utils import logging


SCREAMING_SNAKE_CASE_						   =       logging.get_logger(__name__)



def    __lowercase   (      _SCREAMING_SNAKE_CASE=None ,						_SCREAMING_SNAKE_CASE=None	) ->   List[str]:


      '''simple docstring'''


      return field(default_factory=lambda: default ,						metadata=_SCREAMING_SNAKE_CASE	)



@dataclass
class 		UpperCamelCase__ :



     '''simple docstring'''

     __snake_case    :	List[str]			=			list_field(
         default=[]							,      metadata={
             "help": (
                 "Model checkpoints to be provided to the AutoModel classes. Leave blank to benchmark the base version"
                 " of all available models"
             )
         }							,      )

     __snake_case    :	List[int]			=			list_field(
         default=[8]							,      metadata={"help": "List of batch sizes for which memory and time performance will be evaluated"}   )

     __snake_case    :	List[int]			=			list_field(
         default=[8, 32, 128, 512]							,      metadata={"help": "List of sequence lengths for which memory and time performance will be evaluated"}							,      )

     __snake_case    :	bool			=			field(
         default=lowerCAmelCase_							,      metadata={"help": "Whether to benchmark inference of model. Inference can be disabled via --no-inference."}							,      )
     __snake_case    :	bool			=			field(
         default=lowerCAmelCase_							,      metadata={"help": "Whether to run on available cuda devices. Cuda can be disabled via --no-cuda."}							,      )
     __snake_case    :	bool			=			field(
         default=lowerCAmelCase_							,      metadata={"help": "Whether to run on available tpu devices. TPU can be disabled via --no-tpu."}   )
     __snake_case    :	bool			=			field(default=lowerCAmelCase_							,      metadata={"help": "Use FP16 to accelerate inference."}   )
     __snake_case    :	bool			=			field(default=lowerCAmelCase_							,      metadata={"help": "Benchmark training of model"}   )
     __snake_case    :	bool			=			field(default=lowerCAmelCase_							,      metadata={"help": "Verbose memory tracing"}   )
     __snake_case    :	bool			=			field(
         default=lowerCAmelCase_							,      metadata={"help": "Whether to perform speed measurements. Speed measurements can be disabled via --no-speed."}							,      )
     __snake_case    :	bool			=			field(
         default=lowerCAmelCase_							,      metadata={
             "help": "Whether to perform memory measurements. Memory measurements can be disabled via --no-memory"
         }							,      )
     __snake_case    :	bool			=			field(default=lowerCAmelCase_							,      metadata={"help": "Trace memory line by line"}   )
     __snake_case    :	bool			=			field(default=lowerCAmelCase_							,      metadata={"help": "Save result to a CSV file"}   )
     __snake_case    :	bool			=			field(default=lowerCAmelCase_							,      metadata={"help": "Save all print statements in a log file"}   )
     __snake_case    :	bool			=			field(default=lowerCAmelCase_							,      metadata={"help": "Whether to print environment information"}   )
     __snake_case    :	bool			=			field(
         default=lowerCAmelCase_							,      metadata={
             "help": (
                 "Whether to use multiprocessing for memory and speed measurement. It is highly recommended to use"
                 " multiprocessing for accurate CPU and GPU memory measurements. This option should only be disabled"
                 " for debugging / testing and on TPU."
             )
         }							,      )
     __snake_case    :	str			=			field(
         default=F"inference_time_{round(time()   )}.csv"							,      metadata={"help": "CSV filename used if saving time results to csv."}							,      )
     __snake_case    :	str			=			field(
         default=F"inference_memory_{round(time()   )}.csv"							,      metadata={"help": "CSV filename used if saving memory results to csv."}							,      )
     __snake_case    :	str			=			field(
         default=F"train_time_{round(time()   )}.csv"							,      metadata={"help": "CSV filename used if saving time results to csv for training."}							,      )
     __snake_case    :	str			=			field(
         default=F"train_memory_{round(time()   )}.csv"							,      metadata={"help": "CSV filename used if saving memory results to csv for training."}							,      )
     __snake_case    :	str			=			field(
         default=F"env_info_{round(time()   )}.csv"							,      metadata={"help": "CSV filename used if saving environment information."}							,      )
     __snake_case    :	str			=			field(
         default=F"log_{round(time()   )}.csv"							,      metadata={"help": "Log filename used if print statements are saved in log."}							,      )
     __snake_case    :	int			=			field(default=3							,      metadata={"help": "Times an experiment will be run."}   )
     __snake_case    :	bool			=			field(
         default=lowerCAmelCase_							,      metadata={
             "help": (
                 "Instead of loading the model as defined in `config.architectures` if exists, just load the pretrain"
                 " model weights."
             )
         }							,      )






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




           '''simple docstring'''


           warnings.warn(
               F"""The class {self.__class__} is deprecated. Hugging Face Benchmarking utils"""
               """ are deprecated in general and it is advised to use external Benchmarking libraries """
               """ to benchmark Transformer models."""						,lowerCamelCase__						,)






     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[int]       )     ->		Any:




           '''simple docstring'''


           return json.dumps(dataclasses.asdict(self       )						,indent=2       )






     @property
     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[Any]       )     ->		List[str]:




           '''simple docstring'''


           if len(self.models       ) <= 0:
                 raise ValueError(
                     """Please make sure you provide at least one model name / model identifier, *e.g.* `--models"""
                     """ bert-base-cased` or `args.models = ['bert-base-cased']."""       )
           return self.models






     @property
     def 				SCREAMING_SNAKE_CASE__  (							self						:    Optional[int]       )     ->		int:




           '''simple docstring'''


           if not self.multi_process:
                 return False
           elif self.is_tpu:
                 logger.info("""Multiprocessing is currently not possible on TPU."""       )
                 return False
           else:
                 return True


