
'''simple docstring'''







import unittest

import numpy as np
from datasets import load_dataset

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
	import torch

if is_vision_available():
	from PIL import Image

	from transformers import BeitImageProcessor






class 			lowerCAmelCase__       (  unittest.TestCase					):






					def __init__(       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE=7    ,							__SCREAMING_SNAKE_CASE=3    ,							__SCREAMING_SNAKE_CASE=18    ,							__SCREAMING_SNAKE_CASE=30    ,							__SCREAMING_SNAKE_CASE=4_00    ,							__SCREAMING_SNAKE_CASE=True    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=True    ,							__SCREAMING_SNAKE_CASE=None    ,							__SCREAMING_SNAKE_CASE=True    ,							__SCREAMING_SNAKE_CASE=[0.5, 0.5, 0.5]    ,							__SCREAMING_SNAKE_CASE=[0.5, 0.5, 0.5]    ,							__SCREAMING_SNAKE_CASE=False    ,							):


											"""simple docstring"""





											lowercase_     :					int													=	size if size is not None else {'''height''': 20, '''width''': 20}
											lowercase_     :					Tuple													=	crop_size if crop_size is not None else {'''height''': 18, '''width''': 18}
											lowercase_     :					List[Any]													=	parent
											lowercase_     :					Optional[Any]													=	batch_size
											lowercase_     :					Any													=	num_channels
											lowercase_     :					int													=	image_size
											lowercase_     :					List[str]													=	min_resolution
											lowercase_     :					Optional[Any]													=	max_resolution
											lowercase_     :					int													=	do_resize
											lowercase_     :					List[Any]													=	size
											lowercase_     :					Any													=	do_center_crop
											lowercase_     :					Optional[Any]													=	crop_size
											lowercase_     :					Union[str, Any]													=	do_normalize
											lowercase_     :					Optional[Any]													=	image_mean
											lowercase_     :					Dict													=	image_std
											lowercase_     :					int													=	do_reduce_labels






					def      _snake_case   (       self		):


											"""simple docstring"""





											return {
											    "do_resize": self.do_resize,
											    "size": self.size,
											    "do_center_crop": self.do_center_crop,
											    "crop_size": self.crop_size,
											    "do_normalize": self.do_normalize,
											    "image_mean": self.image_mean,
											    "image_std": self.image_std,
											    "do_reduce_labels": self.do_reduce_labels,
											}







def  snake_case_		(    ):



						"""simple docstring"""





						lowercase_     :					Dict													=	load_dataset('''hf-internal-testing/fixtures_ade20k'''				,				split='''test'''							)

						lowercase_     :					List[str]													=	Image.open(dataset[0]['''file''']							)
						lowercase_     :					int													=	Image.open(dataset[1]['''file''']							)

						return image, map
def  snake_case_		(    ):



						"""simple docstring"""





						lowercase_     :					str													=	load_dataset('''hf-internal-testing/fixtures_ade20k'''				,				split='''test'''							)

						lowercase_     :					Optional[Any]													=	Image.open(ds[0]['''file''']							)
						lowercase_     :					Union[str, Any]													=	Image.open(ds[1]['''file''']							)
						lowercase_     :					Optional[Any]													=	Image.open(ds[2]['''file''']							)
						lowercase_     :					str													=	Image.open(ds[3]['''file''']							)

						return [imagea, imagea], [mapa, mapa]






@require_torch
@require_vision
class 			lowerCAmelCase__       (  lowerCamelCase_   ,						unittest.TestCase					):
					lowerCAmelCase_					       =					BeitImageProcessor if is_vision_available() else None






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					str													=	BeitImageProcessingTester(self		)






					@property
					def      _snake_case   (       self		):


											"""simple docstring"""





											return self.image_processor_tester.prepare_image_processor_dict()






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Tuple													=	self.image_processing_class(**self.image_processor_dict		)
											self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE    ,							'''do_resize'''		)		)
											self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE    ,							'''size'''		)		)
											self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE    ,							'''do_center_crop'''		)		)
											self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE    ,							'''center_crop'''		)		)
											self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE    ,							'''do_normalize'''		)		)
											self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE    ,							'''image_mean'''		)		)
											self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE    ,							'''image_std'''		)		)






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Tuple													=	self.image_processing_class.from_dict(self.image_processor_dict		)
											self.assertEqual(image_processor.size    ,							{'''height''': 20, '''width''': 20}		)
											self.assertEqual(image_processor.crop_size    ,							{'''height''': 18, '''width''': 18}		)
											self.assertEqual(image_processor.do_reduce_labels    ,							__SCREAMING_SNAKE_CASE		)

											lowercase_     :					int													=	self.image_processing_class.from_dict(
											    self.image_processor_dict    ,							size=42    ,							crop_size=84    ,							reduce_labels=__SCREAMING_SNAKE_CASE		)
											self.assertEqual(image_processor.size    ,							{'''height''': 42, '''width''': 42}		)
											self.assertEqual(image_processor.crop_size    ,							{'''height''': 84, '''width''': 84}		)
											self.assertEqual(image_processor.do_reduce_labels    ,							__SCREAMING_SNAKE_CASE		)






					def      _snake_case   (       self		):


											"""simple docstring"""





											pass






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					List[Any]													=	self.image_processing_class(**self.image_processor_dict		)
											# create random PIL images
											lowercase_     :					Any													=	prepare_image_inputs(self.image_processor_tester    ,							equal_resolution=__SCREAMING_SNAKE_CASE		)
											for image in image_inputs:
																	self.assertIsInstance(__SCREAMING_SNAKE_CASE    ,							Image.Image		)

											# Test not batched input
											lowercase_     :					Optional[int]													=	image_processing(image_inputs[0]    ,							return_tensors='''pt'''		).pixel_values
											self.assertEqual(
											    encoded_images.shape    ,							(
											        1,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)

											# Test batched
											lowercase_     :					Dict													=	image_processing(__SCREAMING_SNAKE_CASE    ,							return_tensors='''pt'''		).pixel_values
											self.assertEqual(
											    encoded_images.shape    ,							(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Any													=	self.image_processing_class(**self.image_processor_dict		)
											# create random numpy tensors
											lowercase_     :					Union[str, Any]													=	prepare_image_inputs(self.image_processor_tester    ,							equal_resolution=__SCREAMING_SNAKE_CASE    ,							numpify=__SCREAMING_SNAKE_CASE		)
											for image in image_inputs:
																	self.assertIsInstance(__SCREAMING_SNAKE_CASE    ,							np.ndarray		)

											# Test not batched input
											lowercase_     :					int													=	image_processing(image_inputs[0]    ,							return_tensors='''pt'''		).pixel_values
											self.assertEqual(
											    encoded_images.shape    ,							(
											        1,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)

											# Test batched
											lowercase_     :					Dict													=	image_processing(__SCREAMING_SNAKE_CASE    ,							return_tensors='''pt'''		).pixel_values
											self.assertEqual(
											    encoded_images.shape    ,							(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Union[str, Any]													=	self.image_processing_class(**self.image_processor_dict		)
											# create random PyTorch tensors
											lowercase_     :					Tuple													=	prepare_image_inputs(self.image_processor_tester    ,							equal_resolution=__SCREAMING_SNAKE_CASE    ,							torchify=__SCREAMING_SNAKE_CASE		)
											for image in image_inputs:
																	self.assertIsInstance(__SCREAMING_SNAKE_CASE    ,							torch.Tensor		)

											# Test not batched input
											lowercase_     :					Union[str, Any]													=	image_processing(image_inputs[0]    ,							return_tensors='''pt'''		).pixel_values
											self.assertEqual(
											    encoded_images.shape    ,							(
											        1,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)

											# Test batched
											lowercase_     :					Union[str, Any]													=	image_processing(__SCREAMING_SNAKE_CASE    ,							return_tensors='''pt'''		).pixel_values
											self.assertEqual(
											    encoded_images.shape    ,							(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Any													=	self.image_processing_class(**self.image_processor_dict		)
											# create random PyTorch tensors
											lowercase_     :					List[Any]													=	prepare_image_inputs(self.image_processor_tester    ,							equal_resolution=__SCREAMING_SNAKE_CASE    ,							torchify=__SCREAMING_SNAKE_CASE		)
											lowercase_     :					Tuple													=	[]
											for image in image_inputs:
																	self.assertIsInstance(__SCREAMING_SNAKE_CASE    ,							torch.Tensor		)
																	maps.append(torch.zeros(image.shape[-2:]		).long()		)

											# Test not batched input
											lowercase_     :					Any													=	image_processing(image_inputs[0]    ,							maps[0]    ,							return_tensors='''pt'''		)
											self.assertEqual(
											    encoding['''pixel_values'''].shape    ,							(
											        1,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)
											self.assertEqual(
											    encoding['''labels'''].shape    ,							(
											        1,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)
											self.assertEqual(encoding['''labels'''].dtype    ,							torch.long		)
											self.assertTrue(encoding['''labels'''].min().item() >= 0		)
											self.assertTrue(encoding['''labels'''].max().item() <= 2_55		)

											# Test batched
											lowercase_     :					Optional[int]													=	image_processing(__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							return_tensors='''pt'''		)
											self.assertEqual(
											    encoding['''pixel_values'''].shape    ,							(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)
											self.assertEqual(
											    encoding['''labels'''].shape    ,							(
											        self.image_processor_tester.batch_size,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)
											self.assertEqual(encoding['''labels'''].dtype    ,							torch.long		)
											self.assertTrue(encoding['''labels'''].min().item() >= 0		)
											self.assertTrue(encoding['''labels'''].max().item() <= 2_55		)

											# Test not batched input (PIL images)
											lowercase_						,			lowercase_     :					Optional[int]													=	prepare_semantic_single_inputs()

											lowercase_     :					Optional[int]													=	image_processing(__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							return_tensors='''pt'''		)
											self.assertEqual(
											    encoding['''pixel_values'''].shape    ,							(
											        1,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)
											self.assertEqual(
											    encoding['''labels'''].shape    ,							(
											        1,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)
											self.assertEqual(encoding['''labels'''].dtype    ,							torch.long		)
											self.assertTrue(encoding['''labels'''].min().item() >= 0		)
											self.assertTrue(encoding['''labels'''].max().item() <= 2_55		)

											# Test batched input (PIL images)
											lowercase_						,			lowercase_     :					List[str]													=	prepare_semantic_batch_inputs()

											lowercase_     :					Tuple													=	image_processing(__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							return_tensors='''pt'''		)
											self.assertEqual(
											    encoding['''pixel_values'''].shape    ,							(
											        2,
											        self.image_processor_tester.num_channels,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)
											self.assertEqual(
											    encoding['''labels'''].shape    ,							(
											        2,
											        self.image_processor_tester.crop_size['''height'''],
											        self.image_processor_tester.crop_size['''width'''],
											    )    ,							)
											self.assertEqual(encoding['''labels'''].dtype    ,							torch.long		)
											self.assertTrue(encoding['''labels'''].min().item() >= 0		)
											self.assertTrue(encoding['''labels'''].max().item() <= 2_55		)






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Union[str, Any]													=	self.image_processing_class(**self.image_processor_dict		)

											# ADE20k has 150 classes, and the background is included, so labels should be between 0 and 150
											lowercase_						,			lowercase_     :					str													=	prepare_semantic_single_inputs()
											lowercase_     :					int													=	image_processing(__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							return_tensors='''pt'''		)
											self.assertTrue(encoding['''labels'''].min().item() >= 0		)
											self.assertTrue(encoding['''labels'''].max().item() <= 1_50		)

											lowercase_     :					List[str]													=	True
											lowercase_     :					Union[str, Any]													=	image_processing(__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							return_tensors='''pt'''		)
											self.assertTrue(encoding['''labels'''].min().item() >= 0		)
											self.assertTrue(encoding['''labels'''].max().item() <= 2_55		)





'''simple docstring'''







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

import sentencepiece as spm

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


_lowercase			:  Optional[Any]   							=	logging.get_logger(__name__)

_lowercase			:  str   							=	"▁"

_lowercase			:  Optional[int]   							=	{"vocab_file": "sentencepiece.bpe.model"}

_lowercase			:  Dict   							=	{
    "vocab_file": {
        "facebook/xglm-564M": "https://huggingface.co/facebook/xglm-564M/resolve/main/sentencepiece.bpe.model",
    }
}

_lowercase			:  Optional[Any]   							=	{
    "facebook/xglm-564M": 2_0_4_8,
}






class 			lowerCAmelCase__       (  lowerCamelCase_					):
					lowerCAmelCase_					       =					VOCAB_FILES_NAMES
					lowerCAmelCase_					       =					PRETRAINED_VOCAB_FILES_MAP
					lowerCAmelCase_					       =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
					lowerCAmelCase_					       =					['''input_ids''', '''attention_mask''']






					def __init__(       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE="<s>"    ,							__SCREAMING_SNAKE_CASE="</s>"    ,							__SCREAMING_SNAKE_CASE="</s>"    ,							__SCREAMING_SNAKE_CASE="<s>"    ,							__SCREAMING_SNAKE_CASE="<unk>"    ,							__SCREAMING_SNAKE_CASE="<pad>"    ,							__SCREAMING_SNAKE_CASE = None    ,							**__SCREAMING_SNAKE_CASE    ,							):


											"""simple docstring"""





											lowercase_     :					Any													=	{} if sp_model_kwargs is None else sp_model_kwargs

											# Compatibility with the original tokenizer
											lowercase_     :					Optional[Any]													=	7
											lowercase_     :					List[Any]													=	[F'''<madeupword{i}>''' for i in range(self.num_madeup_words		)]

											lowercase_     :					Tuple													=	kwargs.get('''additional_special_tokens'''    ,							[]		)
											kwargs["additional_special_tokens"] += [
											    word for word in madeup_words if word not in kwargs["additional_special_tokens"]
											]

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

											lowercase_     :					int													=	spm.SentencePieceProcessor(**self.sp_model_kwargs		)
											self.sp_model.Load(str(__SCREAMING_SNAKE_CASE		)		)
											lowercase_     :					Dict													=	vocab_file

											# Original fairseq vocab and spm vocab must be "aligned":
											# Vocab    |    0    |    1    |   2    |    3    |  4  |  5  |  6  |   7   |   8   |  9
											# -------- | ------- | ------- | ------ | ------- | --- | --- | --- | ----- | ----- | ----
											# fairseq  | '<s>'   | '<pad>' | '</s>' | '<unk>' | ',' | '.' | '▁' | 's'   | '▁de' | '-'
											# spm      | '<unk>' | '<s>'   | '</s>' | ','     | '.' | '▁' | 's' | '▁de' | '-'   | '▁a'

											# The first "real" token "," has position 4 in the original fairseq vocab and position 3 in the spm vocab
											lowercase_     :					List[Any]													=	1

											# Mimic fairseq token-to-id alignment for the first 4 token
											lowercase_     :					Optional[Any]													=	{'''<s>''': 0, '''<pad>''': 1, '''</s>''': 2, '''<unk>''': 3}

											lowercase_     :					Dict													=	len(self.sp_model		)
											lowercase_     :					int													=	{F'''<madeupword{i}>''': sp_size + i + self.fairseq_offset for i in range(self.num_madeup_words		)}
											self.fairseq_tokens_to_ids.update(__SCREAMING_SNAKE_CASE		)

											lowercase_     :					List[str]													=	{v: k for k, v in self.fairseq_tokens_to_ids.items()}






					def __getstate__(       self		):


											"""simple docstring"""





											lowercase_     :					List[Any]													=	self.__dict__.copy()
											lowercase_     :					Optional[Any]													=	None
											lowercase_     :					List[Any]													=	self.sp_model.serialized_model_proto()
											return state






					def __setstate__(       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											lowercase_     :					List[Any]													=	d

											# for backward compatibility
											if not hasattr(self    ,							'''sp_model_kwargs'''		):
																	lowercase_     :					Optional[Any]													=	{}

											lowercase_     :					int													=	spm.SentencePieceProcessor(**self.sp_model_kwargs		)
											self.sp_model.LoadFromSerializedProto(self.sp_model_proto		)






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE = None		):


											"""simple docstring"""





											if token_ids_a is None:
																	return [self.sep_token_id] + token_ids_a
											lowercase_     :					Optional[Any]													=	[self.sep_token_id]
											return sep + token_ids_a + sep + sep + token_ids_a






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE = None    ,							__SCREAMING_SNAKE_CASE = False		):


											"""simple docstring"""





											if already_has_special_tokens:
																	return super().get_special_tokens_mask(
																	    token_ids_a=__SCREAMING_SNAKE_CASE    ,							token_ids_a=__SCREAMING_SNAKE_CASE    ,							already_has_special_tokens=__SCREAMING_SNAKE_CASE		)

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






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE = None		):


											"""simple docstring"""





											lowercase_     :					List[Any]													=	[self.sep_token_id]

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






					@property
					def      _snake_case   (       self		):


											"""simple docstring"""





											return len(self.sp_model		) + self.fairseq_offset + self.num_madeup_words






					def      _snake_case   (       self		):


											"""simple docstring"""





											lowercase_     :					Any													=	{self.convert_ids_to_tokens(__SCREAMING_SNAKE_CASE		): i for i in range(self.vocab_size		)}
											vocab.update(self.added_tokens_encoder		)
											return vocab






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											return self.sp_model.encode(__SCREAMING_SNAKE_CASE    ,							out_type=__SCREAMING_SNAKE_CASE		)






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if token in self.fairseq_tokens_to_ids:
																	return self.fairseq_tokens_to_ids[token]
											lowercase_     :					str													=	self.sp_model.PieceToId(__SCREAMING_SNAKE_CASE		)

											# Need to return unknown token if the SP model returned 0
											return spm_id + self.fairseq_offset if spm_id else self.unk_token_id






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											if index in self.fairseq_ids_to_tokens:
																	return self.fairseq_ids_to_tokens[index]
											return self.sp_model.IdToPiece(index - self.fairseq_offset		)






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											lowercase_     :					Dict													=	''''''.join(__SCREAMING_SNAKE_CASE		).replace(__SCREAMING_SNAKE_CASE    ,							''' '''		).strip()
											return out_string






					def      _snake_case   (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE = None		):


											"""simple docstring"""





											if not os.path.isdir(__SCREAMING_SNAKE_CASE		):
																	logger.error(F'''Vocabulary path ({save_directory}) should be a directory'''		)
																	return
											lowercase_     :					str													=	os.path.join(
											    __SCREAMING_SNAKE_CASE    ,							(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']		)

											if os.path.abspath(self.vocab_file		) != os.path.abspath(__SCREAMING_SNAKE_CASE		) and os.path.isfile(self.vocab_file		):
																	copyfile(self.vocab_file    ,							__SCREAMING_SNAKE_CASE		)
											elif not os.path.isfile(self.vocab_file		):
																	with open(__SCREAMING_SNAKE_CASE    ,							'''wb'''		) as fi:
																							lowercase_     :					Optional[int]													=	self.sp_model.serialized_model_proto()
																							fi.write(__SCREAMING_SNAKE_CASE		)

											return (out_vocab_file,)



