




import argparse
import gc
import json
import os
import shutil
import warnings

import torch

from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer


try:
		from transformers import LlamaTokenizerFast
except ImportError as e:
		warnings.warn(e)
		warnings.warn(
		    """The converted tokenizer will be the `slow` tokenizer. To use the fast, update your `tokenizers` library and re-run the tokenizer conversion"""
		)
		__A						:							List[str]							=  None
__A						:							List[str]							=  {
    """7B""": 1_1_0_0_8,
    """13B""": 1_3_8_2_4,
    """30B""": 1_7_9_2_0,
    """65B""": 2_2_0_1_6,
    """70B""": 2_8_6_7_2,
}
__A						:							Optional[int]							=  {
    """7B""": 1,
    """7Bf""": 1,
    """13B""": 2,
    """13Bf""": 2,
    """30B""": 4,
    """65B""": 8,
    """70B""": 8,
    """70Bf""": 8,
}
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE=1					,	SCREAMING_SNAKE_CASE=2_56   ):
			'''simple docstring'''
			return multiple_of * ((int(ffn_dim_multiplier * int(8 * n / 3   )   ) + multiple_of - 1) // multiple_of)
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''
			with open(SCREAMING_SNAKE_CASE					,	"""r"""   ) as f:
						return json.load(SCREAMING_SNAKE_CASE   )
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''
			with open(SCREAMING_SNAKE_CASE					,	"""w"""   ) as f:
						json.dump(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE=True   ):
			'''simple docstring'''
			os.makedirs(SCREAMING_SNAKE_CASE					,	exist_ok=SCREAMING_SNAKE_CASE   )
			SCREAMING_SNAKE_CASE           =					os.path.join(SCREAMING_SNAKE_CASE					,	"""tmp"""   )
			os.makedirs(SCREAMING_SNAKE_CASE					,	exist_ok=SCREAMING_SNAKE_CASE   )

			SCREAMING_SNAKE_CASE           =					read_json(os.path.join(SCREAMING_SNAKE_CASE					,	"""params.json"""   )   )
			SCREAMING_SNAKE_CASE           =					NUM_SHARDS[model_size]
			SCREAMING_SNAKE_CASE           =					params["""n_layers"""]
			SCREAMING_SNAKE_CASE           =					params["""n_heads"""]
			SCREAMING_SNAKE_CASE           =					n_heads // num_shards
			SCREAMING_SNAKE_CASE           =					params["""dim"""]
			SCREAMING_SNAKE_CASE           =					dim // n_heads
			SCREAMING_SNAKE_CASE           =					10_000.0
			SCREAMING_SNAKE_CASE           =					1.0 / (base ** (torch.arange(0					,	SCREAMING_SNAKE_CASE					,	2   ).float() / dims_per_head))

			if "n_kv_heads" in params:
						SCREAMING_SNAKE_CASE           =					params["""n_kv_heads"""]  # for GQA / MQA
						SCREAMING_SNAKE_CASE           =					n_heads_per_shard // num_key_value_heads
						SCREAMING_SNAKE_CASE           =					dim // num_key_value_heads
			else:  # compatibility with other checkpoints
						SCREAMING_SNAKE_CASE           =					n_heads
						SCREAMING_SNAKE_CASE           =					n_heads_per_shard
						SCREAMING_SNAKE_CASE           =					dim

			# permute for sliced rotary
			def permute(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE=n_heads					,	SCREAMING_SNAKE_CASE=dim					,	SCREAMING_SNAKE_CASE=dim   ):
						return w.view(SCREAMING_SNAKE_CASE					,	dima // n_heads // 2					,	2					,	SCREAMING_SNAKE_CASE   ).transpose(1					,	2   ).reshape(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )

			print(f"""Fetching all parameters from the checkpoint at {input_base_path}."""   )
			# Load weights
			if model_size == "7B":
						# Not sharded
						# (The sharded implementation would also work, but this is simpler.)
						SCREAMING_SNAKE_CASE           =					torch.load(os.path.join(SCREAMING_SNAKE_CASE					,	"""consolidated.00.pth"""   )					,	map_location="""cpu"""   )
			else:
						# Sharded
						SCREAMING_SNAKE_CASE           =					[
						    torch.load(os.path.join(SCREAMING_SNAKE_CASE					,	f"""consolidated.{i:02d}.pth"""   )					,	map_location="""cpu"""   )
						    for i in range(SCREAMING_SNAKE_CASE   )
						]
			SCREAMING_SNAKE_CASE           =					0
			SCREAMING_SNAKE_CASE           =					{"""weight_map""": {}}
			for layer_i in range(SCREAMING_SNAKE_CASE   ):
						SCREAMING_SNAKE_CASE           =					f"""pytorch_model-{layer_i + 1}-of-{n_layers + 1}.bin"""
						if model_size == "7B":
									# Unsharded
									SCREAMING_SNAKE_CASE           =					{
									    f"""model.layers.{layer_i}.self_attn.q_proj.weight""": permute(
									        loaded[f"""layers.{layer_i}.attention.wq.weight"""]   ),
									    f"""model.layers.{layer_i}.self_attn.k_proj.weight""": permute(
									        loaded[f"""layers.{layer_i}.attention.wk.weight"""]   ),
									    f"""model.layers.{layer_i}.self_attn.v_proj.weight""": loaded[f"""layers.{layer_i}.attention.wv.weight"""],
									    f"""model.layers.{layer_i}.self_attn.o_proj.weight""": loaded[f"""layers.{layer_i}.attention.wo.weight"""],
									    f"""model.layers.{layer_i}.mlp.gate_proj.weight""": loaded[f"""layers.{layer_i}.feed_forward.w1.weight"""],
									    f"""model.layers.{layer_i}.mlp.down_proj.weight""": loaded[f"""layers.{layer_i}.feed_forward.w2.weight"""],
									    f"""model.layers.{layer_i}.mlp.up_proj.weight""": loaded[f"""layers.{layer_i}.feed_forward.w3.weight"""],
									    f"""model.layers.{layer_i}.input_layernorm.weight""": loaded[f"""layers.{layer_i}.attention_norm.weight"""],
									    f"""model.layers.{layer_i}.post_attention_layernorm.weight""": loaded[f"""layers.{layer_i}.ffn_norm.weight"""],
									}
						else:
									# Sharded
									# Note that attention.w{q,k,v,o}, feed_fordward.w[1,2,3], attention_norm.weight and ffn_norm.weight share
									# the same storage object, saving attention_norm and ffn_norm will save other weights too, which is
									# redundant as other weights will be stitched from multiple shards. To avoid that, they are cloned.

									SCREAMING_SNAKE_CASE           =					{
									    f"""model.layers.{layer_i}.input_layernorm.weight""": loaded[0][
									        f"""layers.{layer_i}.attention_norm.weight"""
									    ].clone(),
									    f"""model.layers.{layer_i}.post_attention_layernorm.weight""": loaded[0][
									        f"""layers.{layer_i}.ffn_norm.weight"""
									    ].clone(),
									}
									SCREAMING_SNAKE_CASE           =					permute(
									    torch.cat(
									        [
									            loaded[i][f"""layers.{layer_i}.attention.wq.weight"""].view(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )
									            for i in range(SCREAMING_SNAKE_CASE   )
									        ]					,	dim=0					,	).reshape(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )   )
									SCREAMING_SNAKE_CASE           =					permute(
									    torch.cat(
									        [
									            loaded[i][f"""layers.{layer_i}.attention.wk.weight"""].view(
									                SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )
									            for i in range(SCREAMING_SNAKE_CASE   )
									        ]					,	dim=0					,	).reshape(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	)
									SCREAMING_SNAKE_CASE           =					torch.cat(
									    [
									        loaded[i][f"""layers.{layer_i}.attention.wv.weight"""].view(
									            SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )
									        for i in range(SCREAMING_SNAKE_CASE   )
									    ]					,	dim=0					,	).reshape(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )

									SCREAMING_SNAKE_CASE           =					torch.cat(
									    [loaded[i][f"""layers.{layer_i}.attention.wo.weight"""] for i in range(SCREAMING_SNAKE_CASE   )]					,	dim=1   )
									SCREAMING_SNAKE_CASE           =					torch.cat(
									    [loaded[i][f"""layers.{layer_i}.feed_forward.w1.weight"""] for i in range(SCREAMING_SNAKE_CASE   )]					,	dim=0   )
									SCREAMING_SNAKE_CASE           =					torch.cat(
									    [loaded[i][f"""layers.{layer_i}.feed_forward.w2.weight"""] for i in range(SCREAMING_SNAKE_CASE   )]					,	dim=1   )
									SCREAMING_SNAKE_CASE           =					torch.cat(
									    [loaded[i][f"""layers.{layer_i}.feed_forward.w3.weight"""] for i in range(SCREAMING_SNAKE_CASE   )]					,	dim=0   )

						SCREAMING_SNAKE_CASE           =					inv_freq
						for k, v in state_dict.items():
									SCREAMING_SNAKE_CASE           =					filename
									param_count += v.numel()
						torch.save(SCREAMING_SNAKE_CASE					,	os.path.join(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )   )

			SCREAMING_SNAKE_CASE           =					f"""pytorch_model-{n_layers + 1}-of-{n_layers + 1}.bin"""
			if model_size == "7B":
						# Unsharded
						SCREAMING_SNAKE_CASE           =					{
						    """model.embed_tokens.weight""": loaded["""tok_embeddings.weight"""],
						    """model.norm.weight""": loaded["""norm.weight"""],
						    """lm_head.weight""": loaded["""output.weight"""],
						}
			else:
						SCREAMING_SNAKE_CASE           =					{
						    """model.norm.weight""": loaded[0]["""norm.weight"""],
						    """model.embed_tokens.weight""": torch.cat(
						        [loaded[i]["""tok_embeddings.weight"""] for i in range(SCREAMING_SNAKE_CASE   )]					,	dim=1   ),
						    """lm_head.weight""": torch.cat([loaded[i]["""output.weight"""] for i in range(SCREAMING_SNAKE_CASE   )]					,	dim=0   ),
						}

			for k, v in state_dict.items():
						SCREAMING_SNAKE_CASE           =					filename
						param_count += v.numel()
			torch.save(SCREAMING_SNAKE_CASE					,	os.path.join(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )   )

			# Write configs
			SCREAMING_SNAKE_CASE           =					{"""total_size""": param_count * 2}
			write_json(SCREAMING_SNAKE_CASE					,	os.path.join(SCREAMING_SNAKE_CASE					,	"""pytorch_model.bin.index.json"""   )   )
			SCREAMING_SNAKE_CASE           =					params["""ffn_dim_multiplier"""] if """ffn_dim_multiplier""" in params else 1
			SCREAMING_SNAKE_CASE           =					params["""multiple_of"""] if """multiple_of""" in params else 2_56
			SCREAMING_SNAKE_CASE           =					LlamaConfig(
			    hidden_size=SCREAMING_SNAKE_CASE					,	intermediate_size=compute_intermediate_size(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )					,	num_attention_heads=params["""n_heads"""]					,	num_hidden_layers=params["""n_layers"""]					,	rms_norm_eps=params["""norm_eps"""]					,	num_key_value_heads=SCREAMING_SNAKE_CASE					,	)
			config.save_pretrained(SCREAMING_SNAKE_CASE   )

			# Make space so we can load the model properly now.
			del state_dict
			del loaded
			gc.collect()

			print("""Loading the checkpoint in a Llama model."""   )
			SCREAMING_SNAKE_CASE           =					LlamaForCausalLM.from_pretrained(SCREAMING_SNAKE_CASE					,	torch_dtype=torch.floataa					,	low_cpu_mem_usage=SCREAMING_SNAKE_CASE   )
			# Avoid saving this as part of the config.
			del model.config._name_or_path

			print("""Saving in the Transformers format."""   )
			model.save_pretrained(SCREAMING_SNAKE_CASE					,	safe_serialization=SCREAMING_SNAKE_CASE   )
			shutil.rmtree(SCREAMING_SNAKE_CASE   )
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''
			# Initialize the tokenizer based on the `spm` model
			SCREAMING_SNAKE_CASE           =					LlamaTokenizer if LlamaTokenizerFast is None else LlamaTokenizerFast
			print(f"""Saving a {tokenizer_class.__name__} to {tokenizer_path}."""   )
			SCREAMING_SNAKE_CASE           =					tokenizer_class(SCREAMING_SNAKE_CASE   )
			tokenizer.save_pretrained(SCREAMING_SNAKE_CASE   )
def 					lowerCamelCase_    (    ):
			'''simple docstring'''
			SCREAMING_SNAKE_CASE           =					argparse.ArgumentParser()
			parser.add_argument(
			    """--input_dir"""					,	help="""Location of LLaMA weights, which contains tokenizer.model and model folders"""					,	)
			parser.add_argument(
			    """--model_size"""					,	choices=["""7B""", """7Bf""", """13B""", """13Bf""", """30B""", """65B""", """70B""", """70Bf""", """tokenizer_only"""]					,	)
			parser.add_argument(
			    """--output_dir"""					,	help="""Location to write HF model and tokenizer"""					,	)
			parser.add_argument("""--safe_serialization"""					,	type=SCREAMING_SNAKE_CASE					,	help="""Whether or not to save using `safetensors`."""   )
			SCREAMING_SNAKE_CASE           =					parser.parse_args()
			if args.model_size != "tokenizer_only":
						write_model(
						    model_path=args.output_dir					,	input_base_path=os.path.join(args.input_dir					,	args.model_size   )					,	model_size=args.model_size					,	safe_serialization=args.safe_serialization					,	)
			SCREAMING_SNAKE_CASE           =					os.path.join(args.input_dir					,	"""tokenizer.model"""   )
			write_tokenizer(args.output_dir					,	SCREAMING_SNAKE_CASE   )


if __name__ == "__main__":
		main()












import os
from shutil import copyfile
from typing import List, Optional, Tuple

from tokenizers import processors

from ...tokenization_utils import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
		from .tokenization_mbart import MBartTokenizer
else:
		__A						:							Tuple							=  None


__A						:							Any							=  logging.get_logger(__name__)


__A						:							Union[str, Any]							=  {"""vocab_file""": """sentencepiece.bpe.model""", """tokenizer_file""": """tokenizer.json"""}

__A						:							List[Any]							=  {
    """vocab_file""": {
        """facebook/mbart-large-en-ro""": (
            """https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/sentencepiece.bpe.model"""
        ),
        """facebook/mbart-large-cc25""": (
            """https://huggingface.co/facebook/mbart-large-cc25/resolve/main/sentencepiece.bpe.model"""
        ),
    },
    """tokenizer_file""": {
        """facebook/mbart-large-en-ro""": """https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/tokenizer.json""",
        """facebook/mbart-large-cc25""": """https://huggingface.co/facebook/mbart-large-cc25/resolve/main/tokenizer.json""",
    },
}

__A						:							int							=  {
    """facebook/mbart-large-en-ro""": 1_0_2_4,
    """facebook/mbart-large-cc25""": 1_0_2_4,
}

# fmt: off
__A						:							List[Any]							=  ["""ar_AR""", """cs_CZ""", """de_DE""", """en_XX""", """es_XX""", """et_EE""", """fi_FI""", """fr_XX""", """gu_IN""", """hi_IN""", """it_IT""", """ja_XX""", """kk_KZ""", """ko_KR""", """lt_LT""", """lv_LV""", """my_MM""", """ne_NP""", """nl_XX""", """ro_RO""", """ru_RU""", """si_LK""", """tr_TR""", """vi_VN""", """zh_CN"""]




class 			UpperCAmelCase_      (   A       ):




							'''simple docstring'''



							a__						  =     VOCAB_FILES_NAMES
							a__						  =     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							a__						  =     PRETRAINED_VOCAB_FILES_MAP
							a__						  =     ['''input_ids''', '''attention_mask''']
							a__						  =     MBartTokenizer

							a__						  =     []
							a__						  =     []





							def __init__(					self       :	str       ,     a       :	List[Any]=None       ,     a       :	Optional[int]=None       ,     a       :	str="<s>"       ,     a       :	Tuple="</s>"       ,     a       :	Optional[int]="</s>"       ,     a       :	int="<s>"       ,     a       :	List[str]="<unk>"       ,     a       :	Tuple="<pad>"       ,     a       :	Dict="<mask>"       ,     a       :	Optional[Any]=None       ,     a       :	List[Any]=None       ,     a       :	Any=None       ,     **a       :	Optional[Any]       ,     )			->					Any:
										# Mask token behave like a normal word, i.e. include the space before it
										SCREAMING_SNAKE_CASE           =					AddedToken(a       ,     lstrip=a       ,     rstrip=a			) if isinstance(a       ,     a			) else mask_token

										super().__init__(
										    vocab_file=a       ,     tokenizer_file=a       ,     bos_token=a       ,     eos_token=a       ,     sep_token=a       ,     cls_token=a       ,     unk_token=a       ,     pad_token=a       ,     mask_token=a       ,     src_lang=a       ,     tgt_lang=a       ,     additional_special_tokens=a       ,     **a       ,     )

										SCREAMING_SNAKE_CASE           =					vocab_file
										SCREAMING_SNAKE_CASE           =					False if not self.vocab_file else True

										SCREAMING_SNAKE_CASE           =					FAIRSEQ_LANGUAGE_CODES.copy()

										if additional_special_tokens is not None:
													# Only add those special tokens if they are not already there.
													_additional_special_tokens.extend(
													    [t for t in additional_special_tokens if t not in _additional_special_tokens]			)

										self.add_special_tokens({"""additional_special_tokens""": _additional_special_tokens}			)
										SCREAMING_SNAKE_CASE           =					{
										    lang_code: self.convert_tokens_to_ids(a			) for lang_code in FAIRSEQ_LANGUAGE_CODES
										}

										SCREAMING_SNAKE_CASE           =					src_lang if src_lang is not None else """en_XX"""
										SCREAMING_SNAKE_CASE           =					self.convert_tokens_to_ids(self._src_lang			)
										SCREAMING_SNAKE_CASE           =					tgt_lang
										self.set_src_lang_special_tokens(self._src_lang			)





							@property
							def    _UpperCAmelCase     (					self       :	int			)			->					str:
										return self._src_lang





							@src_lang.setter
							def    _UpperCAmelCase     (					self       :	List[Any]       ,     a       :	str			)			->					None:
										SCREAMING_SNAKE_CASE           =					new_src_lang
										self.set_src_lang_special_tokens(self._src_lang			)





							def    _UpperCAmelCase     (					self       :	Dict       ,     a       :	List[int]       ,     a       :	Optional[List[int]] = None			)			->					List[int]:
										if token_ids_a is None:
													return self.prefix_tokens + token_ids_a + self.suffix_tokens
										# We don't expect to process pairs, but leave the pair logic for API consistency
										return self.prefix_tokens + token_ids_a + token_ids_a + self.suffix_tokens





							def    _UpperCAmelCase     (					self       :	Tuple       ,     a       :	List[int]       ,     a       :	Optional[List[int]] = None			)			->					List[int]:
										SCREAMING_SNAKE_CASE           =					[self.sep_token_id]
										SCREAMING_SNAKE_CASE           =					[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 + sep + token_ids_a + sep			) * [0]





							def    _UpperCAmelCase     (					self       :	Optional[Any]       ,     a       :	Optional[int]       ,     a       :	str       ,     a       :	Optional[str]       ,     a       :	Optional[str]       ,     **a       :	Optional[Any]			)			->					Optional[Any]:
										if src_lang is None or tgt_lang is None:
													raise ValueError("""Translation requires a `src_lang` and a `tgt_lang` for this model"""			)
										SCREAMING_SNAKE_CASE           =					src_lang
										SCREAMING_SNAKE_CASE           =					self(a       ,     add_special_tokens=a       ,     return_tensors=a       ,     **a			)
										SCREAMING_SNAKE_CASE           =					self.convert_tokens_to_ids(a			)
										SCREAMING_SNAKE_CASE           =					tgt_lang_id
										return inputs





							def    _UpperCAmelCase     (					self       :	str       ,     a       :	List[str]       ,     a       :	str = "en_XX"       ,     a       :	Optional[List[str]] = None       ,     a       :	str = "ro_RO"       ,     **a       :	List[str]       ,     )			->					BatchEncoding:
										SCREAMING_SNAKE_CASE           =					src_lang
										SCREAMING_SNAKE_CASE           =					tgt_lang
										return super().prepare_seqaseq_batch(a       ,     a       ,     **a			)





							def    _UpperCAmelCase     (					self       :	Optional[Any]			)			->					str:
										return self.set_src_lang_special_tokens(self.src_lang			)





							def    _UpperCAmelCase     (					self       :	str			)			->					List[str]:
										return self.set_tgt_lang_special_tokens(self.tgt_lang			)





							def    _UpperCAmelCase     (					self       :	Dict       ,     a       :	List[str]			)			->					None:
										SCREAMING_SNAKE_CASE           =					self.convert_tokens_to_ids(a			)
										SCREAMING_SNAKE_CASE           =					[]
										SCREAMING_SNAKE_CASE           =					[self.eos_token_id, self.cur_lang_code]

										SCREAMING_SNAKE_CASE           =					self.convert_ids_to_tokens(self.prefix_tokens			)
										SCREAMING_SNAKE_CASE           =					self.convert_ids_to_tokens(self.suffix_tokens			)

										SCREAMING_SNAKE_CASE           =					processors.TemplateProcessing(
										    single=prefix_tokens_str + ["""$A"""] + suffix_tokens_str       ,     pair=prefix_tokens_str + ["""$A""", """$B"""] + suffix_tokens_str       ,     special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str       ,     self.prefix_tokens + self.suffix_tokens			)			)       ,     )





							def    _UpperCAmelCase     (					self       :	Dict       ,     a       :	str			)			->					None:
										SCREAMING_SNAKE_CASE           =					self.convert_tokens_to_ids(a			)
										SCREAMING_SNAKE_CASE           =					[]
										SCREAMING_SNAKE_CASE           =					[self.eos_token_id, self.cur_lang_code]

										SCREAMING_SNAKE_CASE           =					self.convert_ids_to_tokens(self.prefix_tokens			)
										SCREAMING_SNAKE_CASE           =					self.convert_ids_to_tokens(self.suffix_tokens			)

										SCREAMING_SNAKE_CASE           =					processors.TemplateProcessing(
										    single=prefix_tokens_str + ["""$A"""] + suffix_tokens_str       ,     pair=prefix_tokens_str + ["""$A""", """$B"""] + suffix_tokens_str       ,     special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str       ,     self.prefix_tokens + self.suffix_tokens			)			)       ,     )







							def    _UpperCAmelCase     (					self       :	Dict       ,     a       :	str       ,     a       :	Optional[str] = None			)			->					Tuple[str]:
										if not self.can_save_slow_tokenizer:
													raise ValueError(
													    """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
													    """tokenizer."""			)

										if not os.path.isdir(a			):
													logger.error(f"""Vocabulary path ({save_directory}) should be a directory."""			)
													return
										SCREAMING_SNAKE_CASE           =					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			):
													copyfile(self.vocab_file       ,     a			)

										return (out_vocab_file,)






