import csv
import json
import logging
import os
import re
import subprocess
import tempfile
import unittest
import zipfile
from pathlib import Path
from typing import Optional
from unittest import mock

import torch

# We use TF to parse the logs
from accelerate import Accelerator
from accelerate.test_utils.testing import (
    MockingTestCase,
    TempDirTestCase,
    require_comet_ml,
    require_tensorboard,
    require_wandb,
    skip,
)
from accelerate.tracking import CometMLTracker, GeneralTracker
from accelerate.utils import ProjectConfiguration, is_comet_ml_available, is_tensorboard_available


if is_comet_ml_available():
				from comet_ml import OfflineExperiment

if is_tensorboard_available():
				import struct

				import tensorboard.compat.proto.event_pba as event_pba

lowerCAmelCase__	:  Dict						=  logging.getLogger(__name__)





@require_tensorboard
class 					__snake_case    (     unittest.TestCase      ):




					def      __a     (  self						)	->    Any:



									'''simple docstring'''







									snake_case__   :      str   				= "test_project_with_config"
									with tempfile.TemporaryDirectory() as dirpath:
													snake_case__   :      Optional[Any]   				= Accelerator(log_with='tensorboard'       ,			project_dir=_A						)
													snake_case__   :      Tuple   				= {"num_iterations": 12, "learning_rate": 1E-2, "some_boolean": False, "some_string": "some_value"}
													accelerator.init_trackers(_A       ,			_A						)
													accelerator.end_training()
													for child in Path(F"""{dirpath}/{project_name}"""						).glob('*/**'						):
																	snake_case__   :      Dict   				= list(filter(lambda __UpperCamelCase						: x.is_file()       ,			child.iterdir()						)						)[0]
													self.assertNotEqual(str(_A						)       ,			''						)




					def      __a     (  self						)	->    Tuple:



									'''simple docstring'''







									snake_case__   :      List[str]   				= "test_project_with_log"
									with tempfile.TemporaryDirectory() as dirpath:
													snake_case__   :      Optional[int]   				= Accelerator(log_with='tensorboard'       ,			project_dir=_A						)
													accelerator.init_trackers(_A						)
													snake_case__   :      int   				= {"total_loss": 0.1, "iteration": 1, "my_text": "some_value"}
													accelerator.log(_A       ,			step=0						)
													accelerator.end_training()
													# Logged values are stored in the outermost-tfevents file and can be read in as a TFRecord
													# Names are randomly generated each time
													snake_case__   :      Dict   				= list(filter(lambda __UpperCamelCase						: x.is_file()       ,			Path(F"""{dirpath}/{project_name}"""						).iterdir()						)						)[0]
													self.assertNotEqual(str(_A						)       ,			''						)




					def      __a     (  self						)	->    List[Any]:



									'''simple docstring'''







									snake_case__   :      Optional[int]   				= "test_project_with_log"
									with tempfile.TemporaryDirectory() as dirpath:
													snake_case__   :      Optional[Any]   				= Accelerator(log_with='tensorboard'       ,			project_dir=_A						)
													accelerator.init_trackers(_A						)
													snake_case__   :      Dict   				= {"tensor": torch.tensor(1						)}
													accelerator.log(_A       ,			step=0						)
													accelerator.end_training()
													# Logged values are stored in the outermost-tfevents file and can be read in as a TFRecord
													# Names are randomly generated each time
													snake_case__   :      Optional[Any]   				= list(filter(lambda __UpperCamelCase						: x.is_file()       ,			Path(F"""{dirpath}/{project_name}"""						).iterdir()						)						)[0]
													# Reading implementation based on https://github.com/pytorch/pytorch/issues/45327#issuecomment-703757685
													with open(_A       ,			'rb'						) as f:
																	snake_case__   :      List[Any]   				= f.read()
													snake_case__   :      List[str]   				= False
													while data:
																	snake_case__   :      Union[str, Any]   				= struct.unpack('Q'       ,			data[:8]						)

																	snake_case__   :      Optional[int]   				= data[12 : 12 + int(header[0]						)]  # 8+4
																	snake_case__   :      str   				= data[12 + int(header[0]						) + 4 :]
																	snake_case__   :      Dict   				= event_pba.Event()

																	event.ParseFromString(_A						)
																	if event.HasField('summary'						):
																					for value in event.summary.value:
																									if value.simple_value == 1.0 and value.tag == "tensor":
																													snake_case__   :      Tuple   				= True
													self.assertTrue(_A       ,			'Converted tensor was not found in the log file!'						)




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



									'''simple docstring'''







									with self.assertRaisesRegex(_A       ,			'Logging with `tensorboard` requires a `logging_dir`'						):
													snake_case__   :      int   				= Accelerator(log_with='tensorboard'						)
									with tempfile.TemporaryDirectory() as dirpath:
													snake_case__   :      Optional[int]   				= Accelerator(log_with='tensorboard'       ,			project_dir=_A						)




					def      __a     (  self						)	->    Any:



									'''simple docstring'''







									snake_case__   :      int   				= ProjectConfiguration(total_limit=30						)
									with tempfile.TemporaryDirectory() as dirpath:
													snake_case__   :      List[Any]   				= Accelerator(log_with='tensorboard'       ,			project_dir=_A       ,			project_config=_A						)





@require_wandb
@mock.patch.dict(os.environ       ,{"""WANDB_MODE""": """offline"""}      )
class 					__snake_case    (     _lowerCamelCase       ,_lowerCamelCase      ):




					def      __a     (  self						)	->    Tuple:



									'''simple docstring'''







									super().setUp()
									# wandb let's us override where logs are stored to via the WANDB_DIR env var
									self.add_mocks(mock.patch.dict(os.environ       ,			{'WANDB_DIR': self.tmpdir}						)						)




					@staticmethod
					def      __a     (  __UpperCamelCase       ,			__UpperCamelCase       ,			__UpperCamelCase = True						)	->    Dict:



									'''simple docstring'''







									snake_case__   :      int   				= rF"""{section} ([\S\s]*?)\n\n"""
									if record:
													snake_case__   :      List[str]   				= rF"""Record: {pattern}"""
									snake_case__   :      List[Any]   				= re.findall(_A       ,			_A						)[0]
									# A config
									if section == "config" or section == "history":
													snake_case__   :      str   				= re.findall(r'\"([a-zA-Z0-9_.,]+)'       ,			_A						)
													return {key: val for key, val in zip(cleaned_record[0::2]       ,			cleaned_record[1::2]						)}
									# Everything else
									else:
													return dict(re.findall(r'(\w+): \"([^\s]+)\"'       ,			_A						)						)




					@skip
					def      __a     (  self						)	->    Any:



									'''simple docstring'''







									snake_case__   :      List[str]   				= "test_project_with_config"
									snake_case__   :      List[str]   				= Accelerator(log_with='wandb'						)
									snake_case__   :      Optional[Any]   				= {"num_iterations": 12, "learning_rate": 1E-2, "some_boolean": False, "some_string": "some_value"}
									snake_case__   :      Optional[int]   				= {"wandb": {"tags": ["my_tag"]}}
									accelerator.init_trackers(_A       ,			_A       ,			_A						)
									snake_case__   :      Dict   				= {"total_loss": 0.1, "iteration": 1, "my_text": "some_value"}
									accelerator.log(_A       ,			step=0						)
									accelerator.end_training()
									# The latest offline log is stored at wandb/latest-run/*.wandb
									for child in Path(F"""{self.tmpdir}/wandb/latest-run"""						).glob('*'						):
													if child.is_file() and child.suffix == ".wandb":
																	snake_case__   :      List[str]   				= subprocess.check_output(
																	    ['wandb', 'sync', '--view', '--verbose', str(_A						)]       ,			env=os.environ.copy()						).decode('utf8'       ,			'ignore'						)
																	break

        # Check HPS through careful parsing and cleaning
									snake_case__   :      Optional[Any]   				= self.parse_log(_A       ,			'config'						)
									self.assertEqual(logged_items['num_iterations']       ,			'12'						)
									self.assertEqual(logged_items['learning_rate']       ,			'0.01'						)
									self.assertEqual(logged_items['some_boolean']       ,			'false'						)
									self.assertEqual(logged_items['some_string']       ,			'some_value'						)
									self.assertEqual(logged_items['some_string']       ,			'some_value'						)

									# Run tags
									snake_case__   :      str   				= self.parse_log(_A       ,			'run'       ,			_A						)
									self.assertEqual(logged_items['tags']       ,			'my_tag'						)

									# Actual logging
									snake_case__   :      List[Any]   				= self.parse_log(_A       ,			'history'						)
									self.assertEqual(logged_items['total_loss']       ,			'0.1'						)
									self.assertEqual(logged_items['iteration']       ,			'1'						)
									self.assertEqual(logged_items['my_text']       ,			'some_value'						)
									self.assertEqual(logged_items['_step']       ,			'0'						)




def 					UpperCamelCase__		(							self     ,					A__     ,					A__       )  ->   Optional[Any]:
				snake_case__   :      List[str]   				= run_name
				snake_case__   :      Tuple   				= OfflineExperiment(project_name=__lowercase     ,					offline_directory=__lowercase       )
				logger.info(F"""Initialized offline CometML project {self.run_name}"""       )
				logger.info('Make sure to log any initial configurations with `self.store_init_configuration` before training!'       )





@require_comet_ml
@mock.patch.object(_lowerCamelCase       ,"""__init__"""       ,_lowerCamelCase      )
class 					__snake_case    (     unittest.TestCase      ):




					@staticmethod
					def      __a     (  __UpperCamelCase       ,			__UpperCamelCase       ,			__UpperCamelCase = False						)	->    Dict:



									'''simple docstring'''







									for log in log_list:
													snake_case__   :      Optional[Any]   				= json.loads(_A						)["payload"]
													if is_param and "param" in j.keys():
																	if j["param"]["paramName"] == key:
																					return j["param"]["paramValue"]
													if "log_other" in j.keys():
																	if j["log_other"]["key"] == key:
																					return j["log_other"]["val"]
													if "metric" in j.keys():
																	if j["metric"]["metricName"] == key:
																					return j["metric"]["metricValue"]




					def      __a     (  self						)	->    Tuple:



									'''simple docstring'''







									with tempfile.TemporaryDirectory() as d:
													snake_case__   :      Optional[Any]   				= CometMLTracker('test_project_with_config'       ,			_A						)
													snake_case__   :      str   				= Accelerator(log_with=_A						)
													snake_case__   :      Union[str, Any]   				= {"num_iterations": 12, "learning_rate": 1E-2, "some_boolean": False, "some_string": "some_value"}
													accelerator.init_trackers(_A       ,			_A						)
													accelerator.end_training()
													snake_case__   :      List[str]   				= os.listdir(_A						)[0]  # Comet is nice, it's just a zip file here
													# We parse the raw logs
													snake_case__   :      Optional[int]   				= os.path.join(_A       ,			_A						)
													snake_case__   :      Tuple   				= zipfile.ZipFile(_A       ,			'r'						)
													snake_case__   :      Optional[int]   				= archive.open('messages.json'						).read().decode('utf-8'						)
									snake_case__   :      Dict   				= log.split('\n'						)[:-1]
									self.assertEqual(self.get_value_from_key(_A       ,			'num_iterations'       ,			_A						)       ,			12						)
									self.assertEqual(self.get_value_from_key(_A       ,			'learning_rate'       ,			_A						)       ,			0.0_1						)
									self.assertEqual(self.get_value_from_key(_A       ,			'some_boolean'       ,			_A						)       ,			_A						)
									self.assertEqual(self.get_value_from_key(_A       ,			'some_string'       ,			_A						)       ,			'some_value'						)




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



									'''simple docstring'''







									with tempfile.TemporaryDirectory() as d:
													snake_case__   :      str   				= CometMLTracker('test_project_with_config'       ,			_A						)
													snake_case__   :      Any   				= Accelerator(log_with=_A						)
													accelerator.init_trackers(_A						)
													snake_case__   :      Tuple   				= {"total_loss": 0.1, "iteration": 1, "my_text": "some_value"}
													accelerator.log(_A       ,			step=0						)
													accelerator.end_training()
													snake_case__   :      Any   				= os.listdir(_A						)[0]  # Comet is nice, it's just a zip file here
													# We parse the raw logs
													snake_case__   :      Optional[Any]   				= os.path.join(_A       ,			_A						)
													snake_case__   :      Tuple   				= zipfile.ZipFile(_A       ,			'r'						)
													snake_case__   :      Union[str, Any]   				= archive.open('messages.json'						).read().decode('utf-8'						)
									snake_case__   :      List[Any]   				= log.split('\n'						)[:-1]
									self.assertEqual(self.get_value_from_key(_A       ,			'curr_step'       ,			_A						)       ,			0						)
									self.assertEqual(self.get_value_from_key(_A       ,			'total_loss'						)       ,			0.1						)
									self.assertEqual(self.get_value_from_key(_A       ,			'iteration'						)       ,			1						)
									self.assertEqual(self.get_value_from_key(_A       ,			'my_text'						)       ,			'some_value'						)





class 					__snake_case    (     _lowerCamelCase      ):
					__lowerCamelCase			   =  [
					    'total_loss',
					    'iteration',
					    'my_text',
					    'learning_rate',
					    'num_iterations',
					    'some_boolean',
					    'some_string',
					]

					__lowerCamelCase			   =  'my_custom_tracker'
					__lowerCamelCase			   =  False




					def __init__(  self       ,			__UpperCamelCase						)	->    Optional[Any]:



									'''simple docstring'''







									snake_case__   :      Optional[int]   				= open(F"""{dir}/log.csv"""       ,			'w+'						)
									snake_case__   :      Any   				= csv.DictWriter(self.f       ,			fieldnames=self._col_names						)
									self.writer.writeheader()




					@property
					def      __a     (  self						)	->    Optional[Any]:



									'''simple docstring'''







									return self.writer




					def      __a     (  self       ,			__UpperCamelCase						)	->    Dict:



									'''simple docstring'''







									logger.info('Call init'						)
									self.writer.writerow(_A						)




					def      __a     (  self       ,			__UpperCamelCase       ,			__UpperCamelCase						)	->    Optional[int]:



									'''simple docstring'''







									logger.info('Call log'						)
									self.writer.writerow(_A						)




					def      __a     (  self						)	->    Optional[int]:



									'''simple docstring'''







									self.f.close()





class 					__snake_case    (     unittest.TestCase      ):




					def      __a     (  self						)	->    Dict:



									'''simple docstring'''







									with tempfile.TemporaryDirectory() as d:
													snake_case__   :      Any   				= MyCustomTracker(_A						)
													snake_case__   :      Union[str, Any]   				= Accelerator(log_with=_A						)
													snake_case__   :      Optional[Any]   				= {"num_iterations": 12, "learning_rate": 1E-2, "some_boolean": False, "some_string": "some_value"}
													accelerator.init_trackers('Some name'       ,			_A						)
													accelerator.end_training()
													with open(F"""{d}/log.csv"""       ,			'r'						) as f:
																	snake_case__   :      Optional[Any]   				= csv.DictReader(_A						)
																	snake_case__   :      Dict   				= next(_A						)
																	snake_case__   :      Optional[int]   				= {
																	    "total_loss": "",
																	    "iteration": "",
																	    "my_text": "",
																	    "learning_rate": "0.01",
																	    "num_iterations": "12",
																	    "some_boolean": "False",
																	    "some_string": "some_value",
																	}
																	self.assertDictEqual(_A       ,			_A						)




					def      __a     (  self						)	->    str:



									'''simple docstring'''







									with tempfile.TemporaryDirectory() as d:
													snake_case__   :      Tuple   				= MyCustomTracker(_A						)
													snake_case__   :      Optional[Any]   				= Accelerator(log_with=_A						)
													accelerator.init_trackers('Some name'						)
													snake_case__   :      Union[str, Any]   				= {"total_loss": 0.1, "iteration": 1, "my_text": "some_value"}
													accelerator.log(_A       ,			step=0						)
													accelerator.end_training()
													with open(F"""{d}/log.csv"""       ,			'r'						) as f:
																	snake_case__   :      int   				= csv.DictReader(_A						)
																	snake_case__   :      Any   				= next(_A						)
																	snake_case__   :      Optional[Any]   				= {
																	    "total_loss": "0.1",
																	    "iteration": "1",
																	    "my_text": "some_value",
																	    "learning_rate": "",
																	    "num_iterations": "",
																	    "some_boolean": "",
																	    "some_string": "",
																	}
																	self.assertDictEqual(_A       ,			_A						)







import json
import os
import unittest

from transformers import BartTokenizer, BartTokenizerFast, BatchEncoding
from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers, require_torch
from transformers.utils import cached_property

from ...test_tokenization_common import TokenizerTesterMixin, filter_roberta_detectors




@require_tokenizers
class 				lowerCAmelCase__	(						UpperCamelCase       ,				unittest.TestCase    ):
					__A  :     Any     =    BartTokenizer
					__A  :     str     =    BartTokenizerFast
					__A  :     Optional[int]     =    True
					__A  :     Optional[int]     =    filter_roberta_detectors







					def 			_lowercase      (							self   :  Dict):
											super().setUp()
											A__						:				Union[str, Any]         =			[
											    "l",
											    "o",
											    "w",
											    "e",
											    "r",
											    "s",
											    "t",
											    "i",
											    "d",
											    "n",
											    "\u0120",
											    "\u0120l",
											    "\u0120n",
											    "\u0120lo",
											    "\u0120low",
											    "er",
											    "\u0120lowest",
											    "\u0120newer",
											    "\u0120wider",
											    "<unk>",
											]
											A__						:				List[str]         =			dict(zip(_A      ,		range(len(_A))))
											A__						:				List[str]         =			["#version: 0.2", "\u0120 l", "\u0120l o", "\u0120lo w", "e r", ""]
											A__						:				str         =			{"unk_token": "<unk>"}

											A__						:				Dict         =			os.path.join(self.tmpdirname      ,		VOCAB_FILES_NAMES["vocab_file"])
											A__						:				Optional[Any]         =			os.path.join(self.tmpdirname      ,		VOCAB_FILES_NAMES["merges_file"])
											with open(self.vocab_file      ,		"w"      ,		encoding="utf-8") as fp:
																	fp.write(json.dumps(_A) + "\n")
											with open(self.merges_file      ,		"w"      ,		encoding="utf-8") as fp:
																	fp.write("\n".join(_A))







					def 			_lowercase      (							self   :  Union[str, Any]      ,		**_A   :  str):
											kwargs.update(self.special_tokens_map)
											return self.tokenizer_class.from_pretrained(self.tmpdirname      ,		**_A)







					def 			_lowercase      (							self   :  Union[str, Any]      ,		**_A   :  List[Any]):
											kwargs.update(self.special_tokens_map)
											return self.rust_tokenizer_class.from_pretrained(self.tmpdirname      ,		**_A)







					def 			_lowercase      (							self   :  Tuple      ,		_A   :  Union[str, Any]):
											return "lower newer", "lower newer"







					@cached_property
					def 			_lowercase      (							self   :  Optional[int]):
											return BartTokenizer.from_pretrained("facebook/bart-large")







					@cached_property
					def 			_lowercase      (							self   :  Optional[int]):
											return BartTokenizerFast.from_pretrained("facebook/bart-large")







					@require_torch
					def 			_lowercase      (							self   :  Dict):
											A__						:				Optional[int]         =			["A long paragraph for summarization.", "Another paragraph for summarization."]
											A__						:				List[Any]         =			[0, 250, 251, 1_7818, 13, 3_9186, 1938, 4, 2]

											for tokenizer in [self.default_tokenizer, self.default_tokenizer_fast]:
																	A__						:				Tuple         =			tokenizer(_A      ,		max_length=len(_A)      ,		padding=_A      ,		return_tensors="pt")
																	self.assertIsInstance(_A      ,		_A)

																	self.assertEqual((2, 9)      ,		batch.input_ids.shape)
																	self.assertEqual((2, 9)      ,		batch.attention_mask.shape)
																	A__						:				Dict         =			batch.input_ids.tolist()[0]
																	self.assertListEqual(_A      ,		_A)
																	# Test that special tokens are reset







					@require_torch
					def 			_lowercase      (							self   :  List[Any]):
											A__						:				Optional[Any]         =			["A long paragraph for summarization.", "Another paragraph for summarization."]
											for tokenizer in [self.default_tokenizer, self.default_tokenizer_fast]:
																	A__						:				Tuple         =			tokenizer(_A      ,		padding=_A      ,		return_tensors="pt")
																	# check if input_ids are returned and no labels
																	self.assertIn("input_ids"      ,		_A)
																	self.assertIn("attention_mask"      ,		_A)
																	self.assertNotIn("labels"      ,		_A)
																	self.assertNotIn("decoder_attention_mask"      ,		_A)







					@require_torch
					def 			_lowercase      (							self   :  int):
											A__						:				Optional[Any]         =			[
											    "Summary of the text.",
											    "Another summary.",
											]
											for tokenizer in [self.default_tokenizer, self.default_tokenizer_fast]:
																	A__						:				int         =			tokenizer(text_target=_A      ,		max_length=32      ,		padding="max_length"      ,		return_tensors="pt")
																	self.assertEqual(32      ,		targets["input_ids"].shape[1])







					@require_torch
					def 			_lowercase      (							self   :  List[str]):
											for tokenizer in [self.default_tokenizer, self.default_tokenizer_fast]:
																	A__						:				List[str]         =			tokenizer(
																	    ["I am a small frog" * 1024, "I am a small frog"]      ,		padding=_A      ,		truncation=_A      ,		return_tensors="pt")
																	self.assertIsInstance(_A      ,		_A)
																	self.assertEqual(batch.input_ids.shape      ,		(2, 1024))







					@require_torch
					def 			_lowercase      (							self   :  List[str]):
											A__						:				int         =			["A long paragraph for summarization."]
											A__						:				List[str]         =			[
											    "Summary of the text.",
											]
											for tokenizer in [self.default_tokenizer, self.default_tokenizer_fast]:
																	A__						:				Optional[Any]         =			tokenizer(_A      ,		return_tensors="pt")
																	A__						:				Union[str, Any]         =			tokenizer(text_target=_A      ,		return_tensors="pt")
																	A__						:				Tuple         =			inputs["input_ids"]
																	A__						:				str         =			targets["input_ids"]
																	self.assertTrue((input_ids[:, 0] == tokenizer.bos_token_id).all().item())
																	self.assertTrue((labels[:, 0] == tokenizer.bos_token_id).all().item())
																	self.assertTrue((input_ids[:, -1] == tokenizer.eos_token_id).all().item())
																	self.assertTrue((labels[:, -1] == tokenizer.eos_token_id).all().item())







					def 			_lowercase      (							self   :  Optional[int]):
											pass







					def 			_lowercase      (							self   :  Any):
											for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
																	with self.subTest(F'{tokenizer.__class__.__name__} ({pretrained_name})'):
																							A__						:				Union[str, Any]         =			self.rust_tokenizer_class.from_pretrained(_A      ,		**_A)
																							A__						:				int         =			self.tokenizer_class.from_pretrained(_A      ,		**_A)
																							A__						:				Union[str, Any]         =			"A, <mask> AllenNLP sentence."
																							A__						:				Dict         =			tokenizer_r.encode_plus(_A      ,		add_special_tokens=_A      ,		return_token_type_ids=_A)
																							A__						:				Optional[Any]         =			tokenizer_p.encode_plus(_A      ,		add_special_tokens=_A      ,		return_token_type_ids=_A)

																							# token_type_ids should put 0 everywhere
																							self.assertEqual(sum(tokens_r["token_type_ids"])      ,		sum(tokens_p["token_type_ids"]))

																							# attention_mask should put 1 everywhere, so sum over length should be 1
																							self.assertEqual(
																							    sum(tokens_r["attention_mask"]) / len(tokens_r["attention_mask"])      ,		sum(tokens_p["attention_mask"]) / len(tokens_p["attention_mask"])      ,		)

																							A__						:				Optional[int]         =			tokenizer_r.convert_ids_to_tokens(tokens_r["input_ids"])
																							A__						:				Dict         =			tokenizer_p.convert_ids_to_tokens(tokens_p["input_ids"])

																							# Rust correctly handles the space before the mask while python doesnt
																							self.assertSequenceEqual(tokens_p["input_ids"]      ,		[0, 250, 6, 5_0264, 3823, 487, 2_1992, 3645, 4, 2])
																							self.assertSequenceEqual(tokens_r["input_ids"]      ,		[0, 250, 6, 5_0264, 3823, 487, 2_1992, 3645, 4, 2])

																							self.assertSequenceEqual(
																							    _A      ,		["<s>", "A", ",", "<mask>", "ĠAllen", "N", "LP", "Ġsentence", ".", "</s>"])
																							self.assertSequenceEqual(
																							    _A      ,		["<s>", "A", ",", "<mask>", "ĠAllen", "N", "LP", "Ġsentence", ".", "</s>"])