




import json
import os
import unittest

from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import (
    VOCAB_FILES_NAMES,
    GPTNeoXJapaneseTokenizer,
)
from transformers.testing_utils import require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin




@require_tokenizers
class       UpperCAmelCase_   ( A		,   unittest.TestCase							):




							'''simple docstring'''



							a__    	=  GPTNeoXJapaneseTokenizer
							a__    	=  False
							a__    	=  {'''do_clean_text''': False, '''add_prefix_space''': False}





							def  _UpperCAmelCase  (       self							:						List[Any]      )      ->       List[Any]:
										super().setUp()

										SCREAMING_SNAKE_CASE     =       [
										    """こん""",
										    """こんに""",
										    """にちは""",
										    """ばんは""",
										    """世界,㔺界""",
										    """、""",
										    """。""",
										    """<BR>""",
										    """<SP>""",
										    """<TAB>""",
										    """<URL>""",
										    """<EMAIL>""",
										    """<TEL>""",
										    """<DATE>""",
										    """<PRICE>""",
										    """<BLOCK>""",
										    """<KIGOU>""",
										    """<U2000U2BFF>""",
										    """<|emoji1|>""",
										    """<unk>""",
										    """<|startoftext|>""",
										    """<|endoftext|>""",
										]
										SCREAMING_SNAKE_CASE     =       {"""emoji""": {"""\ud83d\ude00""": """<|emoji1|>"""}, """emoji_inv""": {"""<|emoji1|>""": """\ud83d\ude00"""}}  # 😀
										SCREAMING_SNAKE_CASE     =       {"""unk_token""": """<unk>"""}

										SCREAMING_SNAKE_CASE     =       os.path.join(self.tmpdirname							,  VOCAB_FILES_NAMES["""vocab_file"""]      )
										SCREAMING_SNAKE_CASE     =       os.path.join(self.tmpdirname							,  VOCAB_FILES_NAMES["""emoji_file"""]      )
										with open(self.vocab_file							,  """w"""							,  encoding="""utf-8"""      ) as vocab_writer:
													vocab_writer.write("""""".join([x + """\n""" for x in vocab_tokens]      )      )
										with open(self.emoji_file							,  """w"""      ) as emoji_writer:
													emoji_writer.write(json.dumps(a      )      )





							def  _UpperCAmelCase  (       self							:						Optional[Any]							,  **a							:						Any      )      ->       List[str]:
										kwargs.update(self.special_tokens_map      )
										return GPTNeoXJapaneseTokenizer.from_pretrained(self.tmpdirname							,  **a      )





							def  _UpperCAmelCase  (       self							:						Optional[Any]							,  a							:						Optional[int]      )      ->       List[Any]:
										SCREAMING_SNAKE_CASE     =       """こんにちは、世界。 \nこんばんは、㔺界。😀"""
										SCREAMING_SNAKE_CASE     =       """こんにちは、世界。 \nこんばんは、世界。😀"""
										return input_text, output_text





							def  _UpperCAmelCase  (       self							:						Optional[Any]							,  a							:						List[Any]      )      ->       int:
										SCREAMING_SNAKE_CASE  ,	SCREAMING_SNAKE_CASE     =       self.get_input_output_texts(a      )
										SCREAMING_SNAKE_CASE     =       tokenizer.encode(a							,  add_special_tokens=a      )
										SCREAMING_SNAKE_CASE     =       tokenizer.decode(a							,  clean_up_tokenization_spaces=a      )
										return text, ids





							def  _UpperCAmelCase  (       self							:						Tuple      )      ->       int:
										pass  # TODO add if relevant





							def  _UpperCAmelCase  (       self							:						Any      )      ->       List[Any]:
										pass  # TODO add if relevant





							def  _UpperCAmelCase  (       self							:						List[str]      )      ->       Union[str, Any]:
										pass  # TODO add if relevant





							def  _UpperCAmelCase  (       self							:						Union[str, Any]      )      ->       List[Any]:
										SCREAMING_SNAKE_CASE     =       self.get_tokenizer()

										# Testing tokenization
										SCREAMING_SNAKE_CASE     =       """こんにちは、世界。　こんばんは、㔺界。"""
										SCREAMING_SNAKE_CASE     =       ["""こん""", """にちは""", """、""", """世界""", """。""", """<SP>""", """こん""", """ばんは""", """、""", """㔺界""", """。"""]
										SCREAMING_SNAKE_CASE     =       tokenizer.tokenize(a      )
										self.assertListEqual(a							,  a      )

										# Testing conversion to ids without special tokens
										SCREAMING_SNAKE_CASE     =       [0, 2, 5, 4, 6, 8, 0, 3, 5, 4, 6]
										SCREAMING_SNAKE_CASE     =       tokenizer.convert_tokens_to_ids(a      )
										self.assertListEqual(a							,  a      )

										# Testing conversion to ids with special tokens
										SCREAMING_SNAKE_CASE     =       tokens + [tokenizer.unk_token]
										SCREAMING_SNAKE_CASE     =       [0, 2, 5, 4, 6, 8, 0, 3, 5, 4, 6, 19]
										SCREAMING_SNAKE_CASE     =       tokenizer.convert_tokens_to_ids(a      )
										self.assertListEqual(a							,  a      )





							@slow
							def  _UpperCAmelCase  (       self							:						Union[str, Any]      )      ->       List[str]:
										SCREAMING_SNAKE_CASE     =       self.tokenizer_class.from_pretrained("""abeja/gpt-neox-japanese-2.7b"""      )

										SCREAMING_SNAKE_CASE     =       tokenizer.encode("""ありがとう。"""							,  add_special_tokens=a      )
										SCREAMING_SNAKE_CASE     =       tokenizer.encode("""どういたしまして。"""							,  add_special_tokens=a      )

										SCREAMING_SNAKE_CASE     =       tokenizer.build_inputs_with_special_tokens(a      )
										SCREAMING_SNAKE_CASE     =       tokenizer.build_inputs_with_special_tokens(a							,  a      )

										assert encoded_sentence == ids_a
										assert encoded_pair == ids_a + ids_a





							def  _UpperCAmelCase  (       self							:						Union[str, Any]      )      ->       Union[str, Any]:
										# Intentionally convert some words to accommodate character fluctuations unique to Japanese
										pass







							def  _UpperCAmelCase  (       self							:						Union[str, Any]      )      ->       Tuple:
										# tokenizer has no padding token
										pass












def        lowerCamelCase_     (     SCREAMING_SNAKE_CASE       ,						SCREAMING_SNAKE_CASE ):
			'''simple docstring'''
			if n == 0:
						return 1

			elif n % 2 == 1:
						return binary_exponentiation(SCREAMING_SNAKE_CASE       ,						n - 1 ) * a

			else:
						SCREAMING_SNAKE_CASE     =       binary_exponentiation(SCREAMING_SNAKE_CASE       ,						n / 2 )
						return b * b


if __name__ == "__main__":
		try:
				__A    :				Tuple    						=	int(input("""Enter Base : """).strip())
				__A    :				Any    						=	int(input("""Enter Power : """).strip())
		except ValueError:
				print("""Invalid literal for integer""")

		__A    :				Union[str, Any]    						=	binary_exponentiation(BASE, POWER)
		print(f'''{BASE}^({POWER}) : {RESULT}''')






