






import argparse
import logging
import os
from pathlib import Path
from typing import Any, Dict

import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info

from transformers import (
    AdamW,
    AutoConfig,
    AutoModel,
    AutoModelForPreTraining,
    AutoModelForQuestionAnswering,
    AutoModelForSeqaSeqLM,
    AutoModelForSequenceClassification,
    AutoModelForTokenClassification,
    AutoModelWithLMHead,
    AutoTokenizer,
    PretrainedConfig,
    PreTrainedTokenizer,
)
from transformers.optimization import (
    Adafactor,
    get_cosine_schedule_with_warmup,
    get_cosine_with_hard_restarts_schedule_with_warmup,
    get_linear_schedule_with_warmup,
    get_polynomial_decay_schedule_with_warmup,
)
from transformers.utils.versions import require_version


A										=      logging.getLogger(__name__)

require_version('pytorch_lightning>=1.0.4')

A										=      {
    'base': AutoModel,
    'sequence-classification': AutoModelForSequenceClassification,
    'question-answering': AutoModelForQuestionAnswering,
    'pretraining': AutoModelForPreTraining,
    'token-classification': AutoModelForTokenClassification,
    'language-modeling': AutoModelWithLMHead,
    'summarization': AutoModelForSeqaSeqLM,
    'translation': AutoModelForSeqaSeqLM,
}


# update this and the import above to support new schedulers from transformers.optimization
A										=      {
    'linear': get_linear_schedule_with_warmup,
    'cosine': get_cosine_schedule_with_warmup,
    'cosine_w_restarts': get_cosine_with_hard_restarts_schedule_with_warmup,
    'polynomial': get_polynomial_decay_schedule_with_warmup,
    # '': get_constant_schedule,             # not supported for now
    # '': get_constant_schedule_with_warmup, # not supported for now
}
A										=      sorted(arg_to_scheduler.keys())
A										=      '{' + ', '.join(arg_to_scheduler_choices) + '}'


class 				__a				(	pl.LightningModule    ):





		'''simple docstring'''



		def __init__(    self			,     UpperCamelCase__			,     UpperCamelCase__=None			,     UpperCamelCase__="base"			,     UpperCamelCase__=None			,     UpperCamelCase__=None			,     UpperCamelCase__=None			,     **UpperCamelCase__			,     ):
						super().__init__()
						# TODO: move to self.save_hyperparameters()
						# self.save_hyperparameters()
						# can also expand arguments into trainer signature for easier reading

						self.save_hyperparameters(UpperCamelCase__							)
						SCREAMING_SNAKE_CASE_ :						List[str]    				= 0
						SCREAMING_SNAKE_CASE_ :						Optional[Any]    				= Path(self.hparams.output_dir							)
						SCREAMING_SNAKE_CASE_ :						Any    				= self.hparams.cache_dir if self.hparams.cache_dir else None
						if config is None:
										SCREAMING_SNAKE_CASE_ :						Optional[int]    				= AutoConfig.from_pretrained(
										    self.hparams.config_name if self.hparams.config_name else self.hparams.model_name_or_path			,     **({'num_labels': num_labels} if num_labels is not None else {})			,     cache_dir=UpperCamelCase__			,     **UpperCamelCase__			,     )
						else:
										SCREAMING_SNAKE_CASE_ :						PretrainedConfig    				= config

						SCREAMING_SNAKE_CASE_ :						Tuple    				= ('encoder_layerdrop', 'decoder_layerdrop', 'dropout', 'attention_dropout')
						for p in extra_model_params:
										if getattr(self.hparams			,     UpperCamelCase__			,     UpperCamelCase__							):
														assert hasattr(self.config			,     UpperCamelCase__							), F'''model config doesn\'t have a `{p}` attribute'''
														setattr(self.config			,     UpperCamelCase__			,     getattr(self.hparams			,     UpperCamelCase__							)							)

						if tokenizer is None:
										SCREAMING_SNAKE_CASE_ :						int    				= AutoTokenizer.from_pretrained(
										    self.hparams.tokenizer_name if self.hparams.tokenizer_name else self.hparams.model_name_or_path			,     cache_dir=UpperCamelCase__			,     )
						else:
										SCREAMING_SNAKE_CASE_ :						PreTrainedTokenizer    				= tokenizer
						SCREAMING_SNAKE_CASE_ :						Tuple    				= MODEL_MODES[mode]
						if model is None:
										SCREAMING_SNAKE_CASE_ :						int    				= self.model_type.from_pretrained(
										    self.hparams.model_name_or_path			,     from_tf=bool('.ckpt' in self.hparams.model_name_or_path							)			,     config=self.config			,     cache_dir=UpperCamelCase__			,     )
						else:
										SCREAMING_SNAKE_CASE_ :						int    				= model


		def 	__snake_case      (    self			,     *UpperCamelCase__			,     **UpperCamelCase__							):
						SCREAMING_SNAKE_CASE_ :						Union[str, Any]    				= self.model_type.from_pretrained(*UpperCamelCase__			,     **UpperCamelCase__							)


		def 	__snake_case      (    self							):
						SCREAMING_SNAKE_CASE_ :						Optional[int]    				= arg_to_scheduler[self.hparams.lr_scheduler]
						SCREAMING_SNAKE_CASE_ :						Tuple    				= get_schedule_func(
						    self.opt			,     num_warmup_steps=self.hparams.warmup_steps			,     num_training_steps=self.total_steps()							)
						SCREAMING_SNAKE_CASE_ :						int    				= {'scheduler': scheduler, 'interval': 'step', 'frequency': 1}
						return scheduler


		def 	__snake_case      (    self							):
						SCREAMING_SNAKE_CASE_ :						List[Any]    				= self.model
						SCREAMING_SNAKE_CASE_ :						List[Any]    				= ['bias', 'LayerNorm.weight']
						SCREAMING_SNAKE_CASE_ :						str    				= [
						    {
						        'params': [p for n, p in model.named_parameters() if not any(nd in n for nd in no_decay							)],
						        'weight_decay': self.hparams.weight_decay,
						    },
						    {
						        'params': [p for n, p in model.named_parameters() if any(nd in n for nd in no_decay							)],
						        'weight_decay': 0.0,
						    },
						]
						if self.hparams.adafactor:
										SCREAMING_SNAKE_CASE_ :						str    				= Adafactor(
										    UpperCamelCase__			,     lr=self.hparams.learning_rate			,     scale_parameter=UpperCamelCase__			,     relative_step=UpperCamelCase__							)

						else:
										SCREAMING_SNAKE_CASE_ :						Optional[int]    				= AdamW(
										    UpperCamelCase__			,     lr=self.hparams.learning_rate			,     eps=self.hparams.adam_epsilon							)
						SCREAMING_SNAKE_CASE_ :						List[str]    				= optimizer

						SCREAMING_SNAKE_CASE_ :						Optional[Any]    				= self.get_lr_scheduler()

						return [optimizer], [scheduler]


		def 	__snake_case      (    self			,     UpperCamelCase__			,     UpperCamelCase__							):
						return self.validation_step(UpperCamelCase__			,     UpperCamelCase__							)


		def 	__snake_case      (    self			,     UpperCamelCase__							):
						return self.validation_end(UpperCamelCase__							)


		def 	__snake_case      (    self							):
						SCREAMING_SNAKE_CASE_ :						Optional[Any]    				= max(1			,     self.hparams.gpus							)  # TODO: consider num_tpu_cores
						SCREAMING_SNAKE_CASE_ :						str    				= self.hparams.train_batch_size * self.hparams.accumulate_grad_batches * num_devices
						return (self.dataset_size / effective_batch_size) * self.hparams.max_epochs


		def 	__snake_case      (    self			,     UpperCamelCase__							):
						if mode == "test":
										SCREAMING_SNAKE_CASE_ :						str    				= len(self.test_dataloader().dataset							)
						else:
										SCREAMING_SNAKE_CASE_ :						Any    				= self.get_dataloader('train'			,     self.hparams.train_batch_size			,     shuffle=UpperCamelCase__							)
										SCREAMING_SNAKE_CASE_ :						int    				= len(self.train_dataloader().dataset							)


		def 	__snake_case      (    self			,     UpperCamelCase__			,     UpperCamelCase__			,     UpperCamelCase__ = False							):
						raise NotImplementedError('You must implement this for your task'							)


		def 	__snake_case      (    self							):
						return self.train_loader


		def 	__snake_case      (    self							):
						return self.get_dataloader('dev'			,     self.hparams.eval_batch_size			,     shuffle=UpperCamelCase__							)


		def 	__snake_case      (    self							):
						return self.get_dataloader('test'			,     self.hparams.eval_batch_size			,     shuffle=UpperCamelCase__							)


		def 	__snake_case      (    self			,     UpperCamelCase__							):
						return os.path.join(
						    self.hparams.data_dir			,     'cached_{}_{}_{}'.format(
						        UpperCamelCase__			,     list(filter(UpperCamelCase__			,     self.hparams.model_name_or_path.split('/'							)							)							).pop()			,     str(self.hparams.max_seq_length							)			,     )			,     )


		@pl.utilities.rank_zero_only
		def 	__snake_case      (    self			,     UpperCamelCase__							):
						SCREAMING_SNAKE_CASE_ :						List[str]    				= self.output_dir.joinpath('best_tfmr'							)
						SCREAMING_SNAKE_CASE_ :						Dict    				= self.step_count
						self.model.save_pretrained(UpperCamelCase__							)
						self.tokenizer.save_pretrained(UpperCamelCase__							)






		@staticmethod
		def 	__snake_case      (    UpperCamelCase__			,     UpperCamelCase__							):
						parser.add_argument(
						    '--model_name_or_path'			,     default=UpperCamelCase__			,     type=UpperCamelCase__			,     required=UpperCamelCase__			,     help='Path to pretrained model or model identifier from huggingface.co/models'			,     )
						parser.add_argument(
						    '--config_name'			,     default=''			,     type=UpperCamelCase__			,     help='Pretrained config name or path if not the same as model_name'							)
						parser.add_argument(
						    '--tokenizer_name'			,     default=UpperCamelCase__			,     type=UpperCamelCase__			,     help='Pretrained tokenizer name or path if not the same as model_name'			,     )
						parser.add_argument(
						    '--cache_dir'			,     default=''			,     type=UpperCamelCase__			,     help='Where do you want to store the pre-trained models downloaded from huggingface.co'			,     )
						parser.add_argument(
						    '--encoder_layerdrop'			,     type=UpperCamelCase__			,     help='Encoder layer dropout probability (Optional). Goes into model.config'			,     )
						parser.add_argument(
						    '--decoder_layerdrop'			,     type=UpperCamelCase__			,     help='Decoder layer dropout probability (Optional). Goes into model.config'			,     )
						parser.add_argument(
						    '--dropout'			,     type=UpperCamelCase__			,     help='Dropout probability (Optional). Goes into model.config'			,     )
						parser.add_argument(
						    '--attention_dropout'			,     type=UpperCamelCase__			,     help='Attention dropout probability (Optional). Goes into model.config'			,     )
						parser.add_argument('--learning_rate'			,     default=5E-5			,     type=UpperCamelCase__			,     help='The initial learning rate for Adam.'							)
						parser.add_argument(
						    '--lr_scheduler'			,     default='linear'			,     choices=UpperCamelCase__			,     metavar=UpperCamelCase__			,     type=UpperCamelCase__			,     help='Learning rate scheduler'			,     )
						parser.add_argument('--weight_decay'			,     default=0.0			,     type=UpperCamelCase__			,     help='Weight decay if we apply some.'							)
						parser.add_argument('--adam_epsilon'			,     default=1E-8			,     type=UpperCamelCase__			,     help='Epsilon for Adam optimizer.'							)
						parser.add_argument('--warmup_steps'			,     default=0			,     type=UpperCamelCase__			,     help='Linear warmup over warmup_steps.'							)
						parser.add_argument('--num_workers'			,     default=4			,     type=UpperCamelCase__			,     help='kwarg passed to DataLoader'							)
						parser.add_argument('--num_train_epochs'			,     dest='max_epochs'			,     default=3			,     type=UpperCamelCase__							)
						parser.add_argument('--train_batch_size'			,     default=32			,     type=UpperCamelCase__							)
						parser.add_argument('--eval_batch_size'			,     default=32			,     type=UpperCamelCase__							)
						parser.add_argument('--adafactor'			,     action='store_true'							)






class 				__a				(	pl.Callback    ):





		'''simple docstring'''



		def 	__snake_case      (    self			,     UpperCamelCase__			,     UpperCamelCase__							):
						SCREAMING_SNAKE_CASE_ :						Tuple    				= trainer.lr_schedulers[0]['scheduler']
						SCREAMING_SNAKE_CASE_ :						Union[str, Any]    				= {F'''lr_group_{i}''': lr for i, lr in enumerate(lr_scheduler.get_lr()							)}
						pl_module.logger.log_metrics(UpperCamelCase__							)


		def 	__snake_case      (    self			,     UpperCamelCase__			,     UpperCamelCase__							):
						rank_zero_info('***** Validation results *****'							)
						SCREAMING_SNAKE_CASE_ :						str    				= trainer.callback_metrics
						# Log results
						for key in sorted(UpperCamelCase__							):
										if key not in ["log", "progress_bar"]:
														rank_zero_info('{} = {}\n'.format(UpperCamelCase__			,     str(metrics[key]							)							)							)






		def 	__snake_case      (    self			,     UpperCamelCase__			,     UpperCamelCase__							):
						rank_zero_info('***** Test results *****'							)
						SCREAMING_SNAKE_CASE_ :						Dict    				= trainer.callback_metrics
						# Log and save results to file
						SCREAMING_SNAKE_CASE_ :						Union[str, Any]    				= os.path.join(pl_module.hparams.output_dir			,     'test_results.txt'							)
						with open(UpperCamelCase__			,     'w'							) as writer:
										for key in sorted(UpperCamelCase__							):
														if key not in ["log", "progress_bar"]:
																		rank_zero_info('{} = {}\n'.format(UpperCamelCase__			,     str(metrics[key]							)							)							)
																		writer.write('{} = {}\n'.format(UpperCamelCase__			,     str(metrics[key]							)							)							)






def        _lowerCamelCase(      lowerCAmelCase__					:		Union[str, Any]     ,     lowerCAmelCase__					:		Tuple   ):





				'''simple docstring'''







				parser.add_argument(
				    '--output_dir'     ,     default=lowerCAmelCase__     ,     type=lowerCAmelCase__     ,     required=lowerCAmelCase__     ,     help='The output directory where the model predictions and checkpoints will be written.'     ,     )
				parser.add_argument(
				    '--fp16'     ,     action='store_true'     ,     help='Whether to use 16-bit (mixed) precision (through NVIDIA apex) instead of 32-bit'     ,     )

				parser.add_argument(
				    '--fp16_opt_level'     ,     type=lowerCAmelCase__     ,     default='O2'     ,     help=(
				        'For fp16: Apex AMP optimization level selected in [\'O0\', \'O1\', \'O2\', and \'O3\'].'
				        'See details at https://nvidia.github.io/apex/amp.html'
				    )     ,     )
				parser.add_argument('--n_tpu_cores'     ,     dest='tpu_cores'     ,     type=lowerCAmelCase__   )
				parser.add_argument('--max_grad_norm'     ,     dest='gradient_clip_val'     ,     default=1.0     ,     type=lowerCAmelCase__     ,     help='Max gradient norm'   )
				parser.add_argument('--do_train'     ,     action='store_true'     ,     help='Whether to run training.'   )
				parser.add_argument('--do_predict'     ,     action='store_true'     ,     help='Whether to run predictions on the test set.'   )
				parser.add_argument(
				    '--gradient_accumulation_steps'     ,     dest='accumulate_grad_batches'     ,     type=lowerCAmelCase__     ,     default=1     ,     help='Number of updates steps to accumulate before performing a backward/update pass.'     ,     )
				parser.add_argument('--seed'     ,     type=lowerCAmelCase__     ,     default=42     ,     help='random seed for initialization'   )
				parser.add_argument(
				    '--data_dir'     ,     default=lowerCAmelCase__     ,     type=lowerCAmelCase__     ,     required=lowerCAmelCase__     ,     help='The input data dir. Should contain the training files for the CoNLL-2003 NER task.'     ,     )



def        _lowerCamelCase(      lowerCAmelCase__					:		BaseTransformer     ,     lowerCAmelCase__					:		argparse.Namespace     ,     lowerCAmelCase__					:		str=None     ,     lowerCAmelCase__					:		Optional[int]=True     ,     lowerCAmelCase__					:		Tuple=[]     ,     lowerCAmelCase__					:		Tuple=None     ,     lowerCAmelCase__					:		int=None     ,     **lowerCAmelCase__					:		Optional[int]     ,     ):





				'''simple docstring'''







				pl.seed_everything(args.seed   )

				# init model
				SCREAMING_SNAKE_CASE_ :						List[Any]    				= Path(model.hparams.output_dir   )
				odir.mkdir(exist_ok=lowerCAmelCase__   )

				# add custom checkpoints
				if checkpoint_callback is None:
								SCREAMING_SNAKE_CASE_ :						int    				= pl.callbacks.ModelCheckpoint(
								    filepath=args.output_dir     ,     prefix='checkpoint'     ,     monitor='val_loss'     ,     mode='min'     ,     save_top_k=1   )
				if early_stopping_callback:
								extra_callbacks.append(lowerCAmelCase__   )
				if logging_callback is None:
								SCREAMING_SNAKE_CASE_ :						Any    				= LoggingCallback()

				SCREAMING_SNAKE_CASE_ :						List[str]    				= {}

				# TODO: remove with PyTorch 1.6 since pl uses native amp
				if args.fpaa:
								SCREAMING_SNAKE_CASE_ :						List[Any]    				= 16
								SCREAMING_SNAKE_CASE_ :						str    				= args.fpaa_opt_level

				if args.gpus > 1:
								SCREAMING_SNAKE_CASE_ :						Dict    				= 'ddp'

				SCREAMING_SNAKE_CASE_ :						Optional[int]    				= args.accumulate_grad_batches
				SCREAMING_SNAKE_CASE_ :						Optional[Any]    				= extra_train_kwargs.get('accelerator'     ,     lowerCAmelCase__   )
				SCREAMING_SNAKE_CASE_ :						List[Any]    				= extra_train_kwargs.get('profiler'     ,     lowerCAmelCase__   )

				SCREAMING_SNAKE_CASE_ :						str    				= pl.Trainer.from_argparse_args(
				    lowerCAmelCase__     ,     weights_summary=lowerCAmelCase__     ,     callbacks=[logging_callback] + extra_callbacks     ,     logger=lowerCAmelCase__     ,     checkpoint_callback=lowerCAmelCase__     ,     **lowerCAmelCase__     ,     )

				if args.do_train:
								trainer.fit(lowerCAmelCase__   )

				return trainer







import json
import os
import unittest

from transformers import HerbertTokenizer, HerbertTokenizerFast
from transformers.models.herbert.tokenization_herbert import VOCAB_FILES_NAMES
from transformers.testing_utils import get_tests_dir, require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin


@require_tokenizers
class 				__a				(	__A			,						unittest.TestCase    ):





		'''simple docstring'''



		UpperCAmelCase__   :					Optional[Any]					     =    HerbertTokenizer
		UpperCAmelCase__   :					List[Any]					     =    HerbertTokenizerFast
		UpperCAmelCase__   :					Optional[Any]					     =    True


		def 	__snake_case      (    self							):
						super().setUp()

						# Use a simpler test file without japanese/chinese characters
						with open(F'''{get_tests_dir()}/fixtures/sample_text_no_unicode.txt'''			,     encoding='utf-8'							) as f_data:
										SCREAMING_SNAKE_CASE_ :						Dict    				= f_data.read().replace('\n\n'			,     '\n'							).strip()

						SCREAMING_SNAKE_CASE_ :						str    				= [
						    '<s>',
						    '</s>',
						    'l',
						    'o',
						    'w',
						    'e',
						    'r',
						    's',
						    't',
						    'i',
						    'd',
						    'n',
						    'w</w>',
						    'r</w>',
						    't</w>',
						    'lo',
						    'low',
						    'er</w>',
						    'low</w>',
						    'lowest</w>',
						    'newer</w>',
						    'wider</w>',
						    ',</w>',
						    '<unk>',
						]
						SCREAMING_SNAKE_CASE_ :						str    				= dict(zip(UpperCamelCase__			,     range(len(UpperCamelCase__							)							)							)							)
						SCREAMING_SNAKE_CASE_ :						Optional[int]    				= ['l o 123', 'lo w 1456', 'e r</w> 1789', '']

						SCREAMING_SNAKE_CASE_ :						int    				= os.path.join(self.tmpdirname			,     VOCAB_FILES_NAMES['vocab_file']							)
						SCREAMING_SNAKE_CASE_ :						int    				= os.path.join(self.tmpdirname			,     VOCAB_FILES_NAMES['merges_file']							)
						with open(self.vocab_file			,     'w'							) as fp:
										fp.write(json.dumps(UpperCamelCase__							)							)
						with open(self.merges_file			,     'w'							) as fp:
										fp.write('\n'.join(UpperCamelCase__							)							)


		def 	__snake_case      (    self			,     UpperCamelCase__							):
						SCREAMING_SNAKE_CASE_ :						Union[str, Any]    				= 'lower newer'
						SCREAMING_SNAKE_CASE_ :						int    				= 'lower newer'
						return input_text, output_text


		def 	__snake_case      (    self							):
						SCREAMING_SNAKE_CASE_ :						List[Any]    				= self.tokenizer_class(vocab_file=self.vocab_file			,     merges_file=self.merges_file							)

						SCREAMING_SNAKE_CASE_ :						Optional[int]    				= 'lower'
						SCREAMING_SNAKE_CASE_ :						Optional[Any]    				= ['low', 'er</w>']
						SCREAMING_SNAKE_CASE_ :						int    				= tokenizer.tokenize(UpperCamelCase__							)
						self.assertListEqual(UpperCamelCase__			,     UpperCamelCase__							)

						SCREAMING_SNAKE_CASE_ :						Union[str, Any]    				= tokens + ['<unk>']
						SCREAMING_SNAKE_CASE_ :						List[Any]    				= [16, 17, 23]
						self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCamelCase__							)			,     UpperCamelCase__							)


		def 	__snake_case      (    self							):
						if not self.test_rust_tokenizer:
										return

						SCREAMING_SNAKE_CASE_ :						Optional[Any]    				= self.get_tokenizer()
						SCREAMING_SNAKE_CASE_ :						Optional[Any]    				= self.get_rust_tokenizer()

						SCREAMING_SNAKE_CASE_ :						List[str]    				= 'lower,newer'

						SCREAMING_SNAKE_CASE_ :						Optional[int]    				= tokenizer.tokenize(UpperCamelCase__							)
						SCREAMING_SNAKE_CASE_ :						Tuple    				= rust_tokenizer.tokenize(UpperCamelCase__							)
						self.assertListEqual(UpperCamelCase__			,     UpperCamelCase__							)

						SCREAMING_SNAKE_CASE_ :						Optional[Any]    				= tokenizer.encode(UpperCamelCase__			,     add_special_tokens=UpperCamelCase__							)
						SCREAMING_SNAKE_CASE_ :						Any    				= rust_tokenizer.encode(UpperCamelCase__			,     add_special_tokens=UpperCamelCase__							)
						self.assertListEqual(UpperCamelCase__			,     UpperCamelCase__							)

						SCREAMING_SNAKE_CASE_ :						Union[str, Any]    				= self.get_rust_tokenizer()
						SCREAMING_SNAKE_CASE_ :						Dict    				= tokenizer.encode(UpperCamelCase__							)
						SCREAMING_SNAKE_CASE_ :						Optional[int]    				= rust_tokenizer.encode(UpperCamelCase__							)
						self.assertListEqual(UpperCamelCase__			,     UpperCamelCase__							)






		@slow
		def 	__snake_case      (    self							):
						SCREAMING_SNAKE_CASE_ :						Optional[int]    				= self.tokenizer_class.from_pretrained('allegro/herbert-base-cased'							)

						SCREAMING_SNAKE_CASE_ :						List[str]    				= tokenizer.encode('konstruowanie sekwencji'			,     add_special_tokens=UpperCamelCase__							)
						SCREAMING_SNAKE_CASE_ :						Optional[int]    				= tokenizer.encode('konstruowanie wielu sekwencji'			,     add_special_tokens=UpperCamelCase__							)

						SCREAMING_SNAKE_CASE_ :						Any    				= tokenizer.build_inputs_with_special_tokens(UpperCamelCase__							)
						SCREAMING_SNAKE_CASE_ :						Dict    				= tokenizer.build_inputs_with_special_tokens(UpperCamelCase__			,     UpperCamelCase__							)

						assert encoded_sentence == [0] + text + [2]
						assert encoded_pair == [0] + text + [2] + text_a + [2]