


'''simple docstring'''
import logging
import os
import sys
import warnings
from dataclasses import dataclass, field
from random import randint
from typing import Optional

import datasets
import evaluate
import numpy as np
from datasets import DatasetDict, load_dataset

import transformers
from transformers import (
    AutoConfig,
    AutoFeatureExtractor,
    AutoModelForAudioClassification,
    HfArgumentParser,
    Trainer,
    TrainingArguments,
    set_seed,
)
from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version


__snake_case				 =	logging.getLogger(__name__)

# Will error if the minimal version of Transformers is not installed. Remove at your own risks.
check_min_version('''4.31.0''')

require_version('''datasets>=1.14.0''', '''To fix: pip install -r examples/pytorch/audio-classification/requirements.txt''')


def      a (     __a					,   __a					,   __a = 16000  )    ->      str:



					'''simple docstring'''






					UpperCamelCase__  :int				   =					int(round(sample_rate * max_length  )  )
					if len(lowercase_  ) <= sample_length:
										return wav
					UpperCamelCase__  :Any				   =					randint(0					,   len(lowercase_  ) - sample_length - 1  )
					return wav[random_offset : random_offset + sample_length]
@dataclass
class   lowercase      :

		"""simple docstring"""

		_a       					=							field(default=A__      ,						metadata={'help': 'Name of a dataset from the datasets package'}   )
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'The configuration name of the dataset to use (via the datasets library).'}   )
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'A file containing the training audio paths and labels.'}   )
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'A file containing the validation audio paths and labels.'}   )
		_a       					=							field(
		    default='train'      ,						metadata={
		        'help': 'The name of the training data set split to use (via the datasets library). Defaults to \'train\''
		    }      ,						)
		_a       					=							field(
		    default='validation'      ,						metadata={
		        'help': (
		            'The name of the training data set split to use (via the datasets library). Defaults to \'validation\''
		        )
		    }      ,						)
		_a       					=							field(
		    default='audio'      ,						metadata={'help': 'The name of the dataset column containing the audio data. Defaults to \'audio\''}      ,						)
		_a       					=							field(
		    default='label'      ,						metadata={'help': 'The name of the dataset column containing the labels. Defaults to \'label\''}   )
		_a       					=							field(
		    default=A__      ,						metadata={
		        'help': (
		            'For debugging purposes or quicker training, truncate the number of training examples to this '
		            'value if set.'
		        )
		    }      ,						)
		_a       					=							field(
		    default=A__      ,						metadata={
		        'help': (
		            'For debugging purposes or quicker training, truncate the number of evaluation examples to this '
		            'value if set.'
		        )
		    }      ,						)
		_a       					=							field(
		    default=20      ,						metadata={'help': 'Audio clips will be randomly cut to this length during training if the value is set.'}      ,						)



@dataclass
class   lowercase      :

		"""simple docstring"""

		_a       					=							field(
		    default='facebook/wav2vec2-base'      ,						metadata={'help': 'Path to pretrained model or model identifier from huggingface.co/models'}      ,						)
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'Pretrained config name or path if not the same as model_name'}   )
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'Where do you want to store the pretrained models downloaded from the Hub'}   )
		_a       					=							field(
		    default='main'      ,						metadata={'help': 'The specific model version to use (can be a branch name, tag name or commit id).'}      ,						)
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'Name or path of preprocessor config.'}   )
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'Whether to freeze the feature encoder layers of the model.'}   )
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'Whether to generate an attention mask in the feature extractor.'}   )
		_a       					=							field(
		    default=A__      ,						metadata={
		        'help': (
		            'Will use the token generated when running `huggingface-cli login` (necessary to use this script '
		            'with private models).'
		        )
		    }      ,						)
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'Whether to freeze the feature extractor layers of the model.'}   )
		_a       					=							field(
		    default=A__      ,						metadata={'help': 'Will enable to load a pretrained model whose head dimensions are different.'}      ,						)




		def        lowerCAmelCase__							(						self				):

							'''simple docstring'''


							if not self.freeze_feature_extractor and self.freeze_feature_encoder:
												warnings.warn(
												    '''The argument `--freeze_feature_extractor` is deprecated and '''
												    '''will be removed in a future version. Use `--freeze_feature_encoder`'''
												    '''instead. Setting `freeze_feature_encoder==True`.'''       ,  A__       ,  )
							if self.freeze_feature_extractor and not self.freeze_feature_encoder:
												raise ValueError(
												    '''The argument `--freeze_feature_extractor` is deprecated and '''
												    '''should not be used in combination with `--freeze_feature_encoder`.'''
												    '''Only make use of `--freeze_feature_encoder`.'''				)



def      a (     )    ->      int:



					'''simple docstring'''






					UpperCamelCase__  :List[str]				   =					HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments)  )
					if len(sys.argv  ) == 2 and sys.argv[1].endswith('''.json'''  ):
										# If we pass only one argument to the script and it's the path to a json file,
										# let's parse it to get our arguments.
										UpperCamelCase__  :List[Any]				   =					parser.parse_json_file(json_file=os.path.abspath(sys.argv[1]  )  )
					else:
										UpperCamelCase__  :Union[str, Any]				   =					parser.parse_args_into_dataclasses()

					# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
					# information sent is the one passed as arguments along with your Python/PyTorch versions.
					send_example_telemetry('''run_audio_classification'''					,   lowercase_					,   lowercase_  )

					# Setup logging
					logging.basicConfig(
					    format='''%(asctime)s - %(levelname)s - %(name)s - %(message)s'''					,   datefmt='''%m/%d/%Y %H:%M:%S'''					,   handlers=[logging.StreamHandler(sys.stdout  )]					,   )

					if training_args.should_log:
										# The default of training_args.log_level is passive, so we set log level at info here to have that default.
										transformers.utils.logging.set_verbosity_info()

					UpperCamelCase__  :Tuple				   =					training_args.get_process_log_level()
					logger.setLevel(lowercase_  )
					transformers.utils.logging.set_verbosity(lowercase_  )
					transformers.utils.logging.enable_default_handler()
					transformers.utils.logging.enable_explicit_format()

					# Log on each process the small summary:
					logger.warning(
					    f'''Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu} '''
					    + f'''distributed training: {bool(training_args.local_rank != -1  )}, 16-bits training: {training_args.fpaa}'''  )
					logger.info(f'''Training/evaluation parameters {training_args}'''  )

					# Set seed before initializing model.
					set_seed(training_args.seed  )

					# Detecting last checkpoint.
					UpperCamelCase__  :Tuple				   =					None
					if os.path.isdir(training_args.output_dir  ) and training_args.do_train and not training_args.overwrite_output_dir:
										UpperCamelCase__  :Optional[Any]				   =					get_last_checkpoint(training_args.output_dir  )
										if last_checkpoint is None and len(os.listdir(training_args.output_dir  )  ) > 0:
															raise ValueError(
															    f'''Output directory ({training_args.output_dir}) already exists and is not empty. '''
															    '''Use --overwrite_output_dir to train from scratch.'''  )
										elif last_checkpoint is not None and training_args.resume_from_checkpoint is None:
															logger.info(
															    f'''Checkpoint detected, resuming training at {last_checkpoint}. To avoid this behavior, change '''
															    '''the `--output_dir` or add `--overwrite_output_dir` to train from scratch.'''  )

    # Initialize our dataset and prepare it for the audio classification task.
					UpperCamelCase__  :Tuple				   =					DatasetDict()
					UpperCamelCase__  :Optional[int]				   =					load_dataset(
					    data_args.dataset_name					,   data_args.dataset_config_name					,   split=data_args.train_split_name					,   use_auth_token=True if model_args.use_auth_token else None					,   )
					UpperCamelCase__  :Dict				   =					load_dataset(
					    data_args.dataset_name					,   data_args.dataset_config_name					,   split=data_args.eval_split_name					,   use_auth_token=True if model_args.use_auth_token else None					,   )

					if data_args.audio_column_name not in raw_datasets["train"].column_names:
										raise ValueError(
										    f'''--audio_column_name {data_args.audio_column_name} not found in dataset \'{data_args.dataset_name}\'. '''
										    '''Make sure to set `--audio_column_name` to the correct audio column - one of '''
										    f'''{", ".join(raw_datasets["train"].column_names  )}.'''  )

					if data_args.label_column_name not in raw_datasets["train"].column_names:
										raise ValueError(
										    f'''--label_column_name {data_args.label_column_name} not found in dataset \'{data_args.dataset_name}\'. '''
										    '''Make sure to set `--label_column_name` to the correct text column - one of '''
										    f'''{", ".join(raw_datasets["train"].column_names  )}.'''  )

					# Setting `return_attention_mask=True` is the way to get a correctly masked mean-pooling over
					# transformer outputs in the classifier, but it doesn't always lead to better accuracy
					UpperCamelCase__  :Optional[int]				   =					AutoFeatureExtractor.from_pretrained(
					    model_args.feature_extractor_name or model_args.model_name_or_path					,   return_attention_mask=model_args.attention_mask					,   cache_dir=model_args.cache_dir					,   revision=model_args.model_revision					,   use_auth_token=True if model_args.use_auth_token else None					,   )

					# `datasets` takes care of automatically loading and resampling the audio,
					# so we just need to set the correct target sampling rate.
					UpperCamelCase__  :Union[str, Any]				   =					raw_datasets.cast_column(
					    data_args.audio_column_name					,   datasets.features.Audio(sampling_rate=feature_extractor.sampling_rate  )  )

					UpperCamelCase__  :List[Any]				   =					feature_extractor.model_input_names[0]

					def train_transforms(__a  ):
										UpperCamelCase__  :Optional[int]				   =					[]
										for audio in batch[data_args.audio_column_name]:
															UpperCamelCase__  :List[str]				   =					random_subsample(
															    audio['''array''']					,   max_length=data_args.max_length_seconds					,   sample_rate=feature_extractor.sampling_rate  )
															subsampled_wavs.append(lowercase_  )
										UpperCamelCase__  :Tuple				   =					feature_extractor(lowercase_					,   sampling_rate=feature_extractor.sampling_rate  )
										UpperCamelCase__  :Tuple				   =					{model_input_name: inputs.get(lowercase_  )}
										UpperCamelCase__  :List[Any]				   =					list(batch[data_args.label_column_name]  )

										return output_batch

					def val_transforms(__a  ):
										UpperCamelCase__  :int				   =					[audio["""array"""] for audio in batch[data_args.audio_column_name]]
										UpperCamelCase__  :List[Any]				   =					feature_extractor(lowercase_					,   sampling_rate=feature_extractor.sampling_rate  )
										UpperCamelCase__  :int				   =					{model_input_name: inputs.get(lowercase_  )}
										UpperCamelCase__  :str				   =					list(batch[data_args.label_column_name]  )

										return output_batch

					# Prepare label mappings.
					# We'll include these in the model's config to get human readable labels in the Inference API.
					UpperCamelCase__  :Dict				   =					raw_datasets["""train"""].features[data_args.label_column_name].names
					UpperCamelCase__  :int				   =					{}, {}
					for i, label in enumerate(lowercase_  ):
										UpperCamelCase__  :Optional[int]				   =					str(lowercase_  )
										UpperCamelCase__  :int				   =					label

					# Load the accuracy metric from the datasets package
					UpperCamelCase__  :Union[str, Any]				   =					evaluate.load('''accuracy'''  )

					# Define our compute_metrics function. It takes an `EvalPrediction` object (a namedtuple with
					# `predictions` and `label_ids` fields) and has to return a dictionary string to float.
					def compute_metrics(__a  ):
										UpperCamelCase__  :str				   =					np.argmax(eval_pred.predictions					,   axis=1  )
										return metric.compute(predictions=lowercase_					,   references=eval_pred.label_ids  )

					UpperCamelCase__  :Optional[Any]				   =					AutoConfig.from_pretrained(
					    model_args.config_name or model_args.model_name_or_path					,   num_labels=len(lowercase_  )					,   labelaid=lowercase_					,   idalabel=lowercase_					,   finetuning_task='''audio-classification'''					,   cache_dir=model_args.cache_dir					,   revision=model_args.model_revision					,   use_auth_token=True if model_args.use_auth_token else None					,   )
					UpperCamelCase__  :Dict				   =					AutoModelForAudioClassification.from_pretrained(
					    model_args.model_name_or_path					,   from_tf=bool('''.ckpt''' in model_args.model_name_or_path  )					,   config=lowercase_					,   cache_dir=model_args.cache_dir					,   revision=model_args.model_revision					,   use_auth_token=True if model_args.use_auth_token else None					,   ignore_mismatched_sizes=model_args.ignore_mismatched_sizes					,   )

					# freeze the convolutional waveform encoder
					if model_args.freeze_feature_encoder:
										model.freeze_feature_encoder()

					if training_args.do_train:
										if data_args.max_train_samples is not None:
															UpperCamelCase__  :List[Any]				   =					(
															    raw_datasets["""train"""].shuffle(seed=training_args.seed  ).select(range(data_args.max_train_samples  )  )
															)
										# Set the training transforms
										raw_datasets["train"].set_transform(lowercase_					,   output_all_columns=lowercase_  )

					if training_args.do_eval:
										if data_args.max_eval_samples is not None:
															UpperCamelCase__  :Optional[Any]				   =					(
															    raw_datasets["""eval"""].shuffle(seed=training_args.seed  ).select(range(data_args.max_eval_samples  )  )
															)
										# Set the validation transforms
										raw_datasets["eval"].set_transform(lowercase_					,   output_all_columns=lowercase_  )

					# Initialize our trainer
					UpperCamelCase__  :Any				   =					Trainer(
					    model=lowercase_					,   args=lowercase_					,   train_dataset=raw_datasets['''train'''] if training_args.do_train else None					,   eval_dataset=raw_datasets['''eval'''] if training_args.do_eval else None					,   compute_metrics=lowercase_					,   tokenizer=lowercase_					,   )

					# Training
					if training_args.do_train:
										UpperCamelCase__  :int				   =					None
										if training_args.resume_from_checkpoint is not None:
															UpperCamelCase__  :Optional[int]				   =					training_args.resume_from_checkpoint
										elif last_checkpoint is not None:
															UpperCamelCase__  :Optional[int]				   =					last_checkpoint
										UpperCamelCase__  :Any				   =					trainer.train(resume_from_checkpoint=lowercase_  )
										trainer.save_model()
										trainer.log_metrics('''train'''					,   train_result.metrics  )
										trainer.save_metrics('''train'''					,   train_result.metrics  )
										trainer.save_state()

					# Evaluation
					if training_args.do_eval:
										UpperCamelCase__  :str				   =					trainer.evaluate()
										trainer.log_metrics('''eval'''					,   lowercase_  )
										trainer.save_metrics('''eval'''					,   lowercase_  )

					# Write model card and (optionally) push to hub
					UpperCamelCase__  :Optional[int]				   =					{
					    """finetuned_from""": model_args.model_name_or_path,
					    """tasks""": """audio-classification""",
					    """dataset""": data_args.dataset_name,
					    """tags""": ["""audio-classification"""],
					}
					if training_args.push_to_hub:
										trainer.push_to_hub(**lowercase_  )
					else:
										trainer.create_model_card(**lowercase_  )


if __name__ == "__main__":
		main()


import os
import re
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple

import sentencepiece as spm

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


A_			:					Tuple    			=     logging.get_logger(__name__)

A_			:					Tuple    			=     {'vocab_file': 'spiece.model'}

A_			:					Optional[Any]    			=     {
    'vocab_file': {
        'google/bigbird-roberta-base': 'https://huggingface.co/google/bigbird-roberta-base/resolve/main/spiece.model',
        'google/bigbird-roberta-large': (
            'https://huggingface.co/google/bigbird-roberta-large/resolve/main/spiece.model'
        ),
        'google/bigbird-base-trivia-itc': (
            'https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/spiece.model'
        ),
    }
}

A_			:					Tuple    			=     {
    'google/bigbird-roberta-base': 4096,
    'google/bigbird-roberta-large': 4096,
    'google/bigbird-base-trivia-itc': 4096,
}



class        _a		(__magic_name__							):


					'''simple docstring'''






					UpperCAmelCase__:  Optional[int]    				=			VOCAB_FILES_NAMES
					UpperCAmelCase__:  str    				=			PRETRAINED_VOCAB_FILES_MAP
					UpperCAmelCase__:  List[str]    				=			PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
					UpperCAmelCase__:  str    				=			['''input_ids''', '''attention_mask''']
					UpperCAmelCase__:  List[int]    				=			[]






					def __init__(					self       ,			A__       ,			A__="<unk>"       ,			A__="<s>"       ,			A__="</s>"       ,			A__="<pad>"       ,			A__="[SEP]"       ,			A__="[MASK]"       ,			A__="[CLS]"       ,			A__ = None       ,			**A__       ,			):
						A__				:       Tuple	  =						AddedToken(A__       ,			lstrip=A__       ,			rstrip=A__     ) if isinstance(A__       ,			A__     ) else bos_token
						A__				:       int	  =						AddedToken(A__       ,			lstrip=A__       ,			rstrip=A__     ) if isinstance(A__       ,			A__     ) else eos_token
						A__				:       Tuple	  =						AddedToken(A__       ,			lstrip=A__       ,			rstrip=A__     ) if isinstance(A__       ,			A__     ) else unk_token
						A__				:       str	  =						AddedToken(A__       ,			lstrip=A__       ,			rstrip=A__     ) if isinstance(A__       ,			A__     ) else pad_token
						A__				:       Dict	  =						AddedToken(A__       ,			lstrip=A__       ,			rstrip=A__     ) if isinstance(A__       ,			A__     ) else cls_token
						A__				:       Any	  =						AddedToken(A__       ,			lstrip=A__       ,			rstrip=A__     ) if isinstance(A__       ,			A__     ) else sep_token

						# Mask token behave like a normal word, i.e. include the space before it
						A__				:       Optional[Any]	  =						AddedToken(A__       ,			lstrip=A__       ,			rstrip=A__     ) if isinstance(A__       ,			A__     ) else mask_token

						A__				:       Optional[Any]	  =						{} if sp_model_kwargs is None else sp_model_kwargs

						super().__init__(
						    bos_token=A__       ,			eos_token=A__       ,			unk_token=A__       ,			pad_token=A__       ,			sep_token=A__       ,			mask_token=A__       ,			cls_token=A__       ,			sp_model_kwargs=self.sp_model_kwargs       ,			**A__       ,			)

						A__				:       Any	  =						vocab_file

						A__				:       Optional[int]	  =						spm.SentencePieceProcessor(**self.sp_model_kwargs     )
						self.sp_model.Load(A__     )






					@property
					def     __A     (					self     ):
						return self.sp_model.get_piece_size()






					def     __A     (					self     ):
						A__				:       List[str]	  =						{self.convert_ids_to_tokens(A__     ): i for i in range(self.vocab_size     )}
						vocab.update(self.added_tokens_encoder     )
						return vocab






					def __getstate__(					self     ):
						A__				:       Optional[Any]	  =						self.__dict__.copy()
						A__				:       Optional[Any]	  =						None
						return state






					def __setstate__(					self       ,			A__     ):
						A__				:       Dict	  =						d

						# for backward compatibility
						if not hasattr(self       ,			"""sp_model_kwargs"""     ):
							A__				:       str	  =						{}

						A__				:       Tuple	  =						spm.SentencePieceProcessor(**self.sp_model_kwargs     )
						self.sp_model.Load(self.vocab_file     )






					def     __A     (					self       ,			A__     ):
						return self.sp_model.encode(A__       ,			out_type=A__     )






					def     __A     (					self       ,			A__     ):
						return self.sp_model.piece_to_id(A__     )






					def     __A     (					self       ,			A__     ):
						A__				:       Dict	  =						self.sp_model.IdToPiece(A__     )
						return token






					def     __A     (					self       ,			A__     ):
						A__				:       str	  =						[]
						A__				:       Optional[int]	  =						""""""
						A__				:       Any	  =						False
						for token in tokens:
							# make sure that special tokens are not decoded using sentencepiece model
							if token in self.all_special_tokens:
								if not prev_is_special:
									out_string += " "
								out_string += self.sp_model.decode(A__     ) + token
								A__				:       Union[str, Any]	  =						True
								A__				:       Union[str, Any]	  =						[]
							else:
								current_sub_tokens.append(A__     )
								A__				:       Any	  =						False
						out_string += self.sp_model.decode(A__     )
						return out_string.strip()






					def     __A     (					self       ,			A__       ,			A__ = False       ,			A__ = None       ,			A__ = True       ,			**A__       ,			):
						A__				:       List[str]	  =						kwargs.pop("""use_source_tokenizer"""       ,			A__     )

						A__				:       Union[str, Any]	  =						self.convert_ids_to_tokens(A__       ,			skip_special_tokens=A__     )

						# To avoid mixing byte-level and unicode for byte-level BPT
						# we need to build string separately for added tokens and byte-level tokens
						# cf. https://github.com/huggingface/transformers/issues/1133
						A__				:       Dict	  =						[]
						A__				:       List[Any]	  =						[]
						for token in filtered_tokens:
							if skip_special_tokens and token in self.all_special_ids:
								continue
							if token in self.added_tokens_encoder:
								if current_sub_text:
									sub_texts.append(self.convert_tokens_to_string(A__     )     )
									A__				:       Optional[Any]	  =						[]
								sub_texts.append(A__     )
							else:
								current_sub_text.append(A__     )
						if current_sub_text:
							sub_texts.append(self.convert_tokens_to_string(A__     )     )

						# Mimic the behavior of the Rust tokenizer:
						# No space before [MASK] and [SEP]
						if spaces_between_special_tokens:
							A__				:       List[Any]	  =						re.sub(r""" (\[(MASK|SEP)\])"""       ,			r"""\1"""       ,			""" """.join(A__     )     )
						else:
							A__				:       Optional[Any]	  =						"""""".join(A__     )

						A__				:       Union[str, Any]	  =						(
						    clean_up_tokenization_spaces
						    if clean_up_tokenization_spaces is not None
						    else self.clean_up_tokenization_spaces
						)
						if clean_up_tokenization_spaces:
							A__				:       Union[str, Any]	  =						self.clean_up_tokenization(A__     )
							return clean_text
						else:
							return text






					def     __A     (					self       ,			A__       ,			A__ = None     ):
						if not os.path.isdir(A__     ):
							logger.error(F"""Vocabulary path ({save_directory}) should be a directory"""     )
							return
						A__				:       str	  =						os.path.join(
						    A__       ,			(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]     )

						if os.path.abspath(self.vocab_file     ) != os.path.abspath(A__     ) and os.path.isfile(self.vocab_file     ):
							copyfile(self.vocab_file       ,			A__     )
						elif not os.path.isfile(self.vocab_file     ):
							with open(A__       ,			"""wb"""     ) as fi:
								A__				:       Dict	  =						self.sp_model.serialized_model_proto()
								fi.write(A__     )

						return (out_vocab_file,)






					def     __A     (					self       ,			A__       ,			A__ = None     ):
						if token_ids_a is None:
							return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
						A__				:       List[Any]	  =						[self.cls_token_id]
						A__				:       List[Any]	  =						[self.sep_token_id]
						return cls + token_ids_a + sep + token_ids_a + sep






					def     __A     (					self       ,			A__       ,			A__ = None       ,			A__ = False     ):
						if already_has_special_tokens:
							return super().get_special_tokens_mask(
							    token_ids_a=A__       ,			token_ids_a=A__       ,			already_has_special_tokens=A__     )

						if token_ids_a is None:
							return [1] + ([0] * len(A__     )) + [1]
						return [1] + ([0] * len(A__     )) + [1] + ([0] * len(A__     )) + [1]






					def     __A     (					self       ,			A__       ,			A__ = None     ):
						A__				:       Any	  =						[self.sep_token_id]
						A__				:       List[Any]	  =						[self.cls_token_id]
						if token_ids_a is None:
							return len(cls + token_ids_a + sep     ) * [0]
						return len(cls + token_ids_a + sep     ) * [0] + len(token_ids_a + sep     ) * [1]



