



'''simple docstring'''


import gc
import random
import unittest

import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    EulerAncestralDiscreteScheduler,
    LMSDiscreteScheduler,
    PNDMScheduler,
    StableDiffusionInstructPixaPixPipeline,
    UNetaDConditionModel,
)
from diffusers.image_processor import VaeImageProcessor
from diffusers.utils import floats_tensor, load_image, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..pipeline_params import (
    IMAGE_TO_IMAGE_IMAGE_PARAMS,
    TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS,
    TEXT_GUIDED_IMAGE_VARIATION_PARAMS,
)
from ..test_pipelines_common import PipelineKarrasSchedulerTesterMixin, PipelineLatentTesterMixin, PipelineTesterMixin


enable_full_determinism()




class      __UpperCamelCase       (_UpperCAmelCase			,   _UpperCAmelCase			,   _UpperCAmelCase			,   unittest.TestCase			):
	__A			  =					StableDiffusionInstructPixaPixPipeline
	__A			  =					TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {'''height''', '''width''', '''cross_attention_kwargs'''}
	__A			  =					TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS
	__A			  =					IMAGE_TO_IMAGE_IMAGE_PARAMS
	__A			  =					IMAGE_TO_IMAGE_IMAGE_PARAMS







	def   _a   (    self						)    ->    Optional[Any]:
							'''simple docstring'''






							torch.manual_seed(0						)
							lowercase        =							UNetaDConditionModel(
							    block_out_channels=(32, 64) ,				layers_per_block=2 ,				sample_size=32 ,				in_channels=8 ,				out_channels=4 ,				down_block_types=("""DownBlock2D""", """CrossAttnDownBlock2D""") ,				up_block_types=("""CrossAttnUpBlock2D""", """UpBlock2D""") ,				cross_attention_dim=32 ,				)
							lowercase        =							PNDMScheduler(skip_prk_steps=_lowerCAmelCase						)
							torch.manual_seed(0						)
							lowercase        =							AutoencoderKL(
							    block_out_channels=[32, 64] ,				in_channels=3 ,				out_channels=3 ,				down_block_types=["""DownEncoderBlock2D""", """DownEncoderBlock2D"""] ,				up_block_types=["""UpDecoderBlock2D""", """UpDecoderBlock2D"""] ,				latent_channels=4 ,				)
							torch.manual_seed(0						)
							lowercase        =							CLIPTextConfig(
							    bos_token_id=0 ,				eos_token_id=2 ,				hidden_size=32 ,				intermediate_size=37 ,				layer_norm_eps=1E-05 ,				num_attention_heads=4 ,				num_hidden_layers=5 ,				pad_token_id=1 ,				vocab_size=1000 ,				)
							lowercase        =							CLIPTextModel(_lowerCAmelCase						)
							lowercase        =							CLIPTokenizer.from_pretrained("""hf-internal-testing/tiny-random-clip"""						)

							lowercase        =							{
							    """unet""": unet,
							    """scheduler""": scheduler,
							    """vae""": vae,
							    """text_encoder""": text_encoder,
							    """tokenizer""": tokenizer,
							    """safety_checker""": None,
							    """feature_extractor""": None,
							}
							return components







	def   _a   (    self ,				_lowerCAmelCase ,				_lowerCAmelCase=0						)    ->    Dict:
							'''simple docstring'''






							lowercase        =							floats_tensor((1, 3, 32, 32) ,				rng=random.Random(_lowerCAmelCase						)						).to(_lowerCAmelCase						)
							lowercase        =							image.cpu().permute(0 ,				2 ,				3 ,				1						)[0]
							lowercase        =							Image.fromarray(np.uinta(_lowerCAmelCase						)						).convert("""RGB"""						)
							if str(_lowerCAmelCase						).startswith("""mps"""						):
													lowercase        =							torch.manual_seed(_lowerCAmelCase						)
							else:
													lowercase        =							torch.Generator(device=_lowerCAmelCase						).manual_seed(_lowerCAmelCase						)
							lowercase        =							{
							    """prompt""": """A painting of a squirrel eating a burger""",
							    """image""": image,
							    """generator""": generator,
							    """num_inference_steps""": 2,
							    """guidance_scale""": 6.0,
							    """image_guidance_scale""": 1,
							    """output_type""": """numpy""",
							}
							return inputs







	def   _a   (    self						)    ->    List[Any]:
							'''simple docstring'''






							lowercase        =							"""cpu"""  # ensure determinism for the device-dependent torch.Generator
							lowercase        =							self.get_dummy_components()
							lowercase        =							StableDiffusionInstructPixaPixPipeline(**_lowerCAmelCase						)
							lowercase        =							sd_pipe.to(_lowerCAmelCase						)
							sd_pipe.set_progress_bar_config(disable=_lowerCAmelCase						)

							lowercase        =							self.get_dummy_inputs(_lowerCAmelCase						)
							lowercase        =							sd_pipe(**_lowerCAmelCase						).images
							lowercase        =							image[0, -3:, -3:, -1]
							assert image.shape == (1, 32, 32, 3)
							lowercase        =							np.array([0.7526, 0.3750, 0.4547, 0.6117, 0.5866, 0.5016, 0.4327, 0.5642, 0.4815]						)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-3







	def   _a   (    self						)    ->    int:
							'''simple docstring'''






							lowercase        =							"""cpu"""  # ensure determinism for the device-dependent torch.Generator
							lowercase        =							self.get_dummy_components()
							lowercase        =							StableDiffusionInstructPixaPixPipeline(**_lowerCAmelCase						)
							lowercase        =							sd_pipe.to(_lowerCAmelCase						)
							sd_pipe.set_progress_bar_config(disable=_lowerCAmelCase						)

							lowercase        =							self.get_dummy_inputs(_lowerCAmelCase						)
							lowercase        =							"""french fries"""
							lowercase        =							sd_pipe(**_lowerCAmelCase ,				negative_prompt=_lowerCAmelCase						)
							lowercase        =							output.images
							lowercase        =							image[0, -3:, -3:, -1]

							assert image.shape == (1, 32, 32, 3)
							lowercase        =							np.array([0.7511, 0.3642, 0.4553, 0.6236, 0.5797, 0.5013, 0.4343, 0.5611, 0.4831]						)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-3







	def   _a   (    self						)    ->    Optional[int]:
							'''simple docstring'''






							lowercase        =							"""cpu"""  # ensure determinism for the device-dependent torch.Generator
							lowercase        =							self.get_dummy_components()
							lowercase        =							StableDiffusionInstructPixaPixPipeline(**_lowerCAmelCase						)
							lowercase        =							sd_pipe.to(_lowerCAmelCase						)
							sd_pipe.set_progress_bar_config(disable=_lowerCAmelCase						)

							lowercase        =							self.get_dummy_inputs(_lowerCAmelCase						)
							lowercase        =							[inputs["""prompt"""]] * 2

							lowercase        =							np.array(inputs["""image"""]						).astype(np.floataa						) / 255.0
							lowercase        =							torch.from_numpy(_lowerCAmelCase						).unsqueeze(0						).to(_lowerCAmelCase						)
							lowercase        =							image / 2 + 0.5
							lowercase        =							image.permute(0 ,				3 ,				1 ,				2						)
							lowercase        =							image.repeat(2 ,				1 ,				1 ,				1						)

							lowercase        =							sd_pipe(**_lowerCAmelCase						).images
							lowercase        =							image[-1, -3:, -3:, -1]

							assert image.shape == (2, 32, 32, 3)
							lowercase        =							np.array([0.5812, 0.5748, 0.5222, 0.5908, 0.5695, 0.7174, 0.6804, 0.5523, 0.5579]						)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-3







	def   _a   (    self						)    ->    Optional[int]:
							'''simple docstring'''






							lowercase        =							"""cpu"""  # ensure determinism for the device-dependent torch.Generator
							lowercase        =							self.get_dummy_components()
							lowercase        =							EulerAncestralDiscreteScheduler(
							    beta_start=0.0_0085 ,				beta_end=0.012 ,				beta_schedule="""scaled_linear"""						)
							lowercase        =							StableDiffusionInstructPixaPixPipeline(**_lowerCAmelCase						)
							lowercase        =							sd_pipe.to(_lowerCAmelCase						)
							sd_pipe.set_progress_bar_config(disable=_lowerCAmelCase						)

							lowercase        =							self.get_dummy_inputs(_lowerCAmelCase						)
							lowercase        =							sd_pipe(**_lowerCAmelCase						).images
							lowercase        =							image[0, -3:, -3:, -1]

							lowercase        =							[round(_lowerCAmelCase ,				4						) for x in image_slice.flatten().tolist()]
							print(""",""".join([str(_lowerCAmelCase						) for x in slice]						)						)

							assert image.shape == (1, 32, 32, 3)
							lowercase        =							np.array([0.7417, 0.3842, 0.4732, 0.5776, 0.5891, 0.5139, 0.4052, 0.5673, 0.4986]						)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 1E-3







	def   _a   (    self						)    ->    Tuple:
							'''simple docstring'''






							super().test_inference_batch_single_identical(expected_max_diff=3E-3						)







	def   _a   (    self						)    ->    List[str]:
							'''simple docstring'''






							lowercase        =							self.get_dummy_components()
							lowercase        =							StableDiffusionInstructPixaPixPipeline(**_lowerCAmelCase						)
							lowercase        =							VaeImageProcessor(do_resize=_lowerCAmelCase ,				do_normalize=_lowerCAmelCase						)
							lowercase        =							pipe.to(_lowerCAmelCase						)
							pipe.set_progress_bar_config(disable=_lowerCAmelCase						)

							lowercase        =							pipe(**self.get_dummy_inputs_by_type(_lowerCAmelCase ,				input_image_type="""pt"""						)						)[0]

							lowercase        =							components["""vae"""]
							lowercase        =							self.get_dummy_inputs_by_type(_lowerCAmelCase ,				input_image_type="""pt"""						)

							for image_param in self.image_latents_params:
													if image_param in inputs.keys():
																			lowercase        =							vae.encode(inputs[image_param]						).latent_dist.mode()

							lowercase        =							pipe(**_lowerCAmelCase						)[0]

							lowercase        =							np.abs(out - out_latents_inputs						).max()
							self.assertLess(_lowerCAmelCase ,				1E-4 ,				"""passing latents as image input generate different result from passing image"""						)




@slow
@require_torch_gpu
class      __UpperCamelCase       (unittest.TestCase			):







	def   _a   (    self						)    ->    Tuple:
							'''simple docstring'''






							super().tearDown()
							gc.collect()
							torch.cuda.empty_cache()







	def   _a   (    self ,				_lowerCAmelCase=0						)    ->    Tuple:
							'''simple docstring'''






							lowercase        =							torch.manual_seed(_lowerCAmelCase						)
							lowercase        =							load_image(
							    """https://huggingface.co/datasets/diffusers/test-arrays/resolve/main/stable_diffusion_pix2pix/example.jpg"""						)
							lowercase        =							{
							    """prompt""": """turn him into a cyborg""",
							    """image""": image,
							    """generator""": generator,
							    """num_inference_steps""": 3,
							    """guidance_scale""": 7.5,
							    """image_guidance_scale""": 1.0,
							    """output_type""": """numpy""",
							}
							return inputs







	def   _a   (    self						)    ->    Optional[Any]:
							'''simple docstring'''






							lowercase        =							StableDiffusionInstructPixaPixPipeline.from_pretrained(
							    """timbrooks/instruct-pix2pix""" ,				safety_checker=_lowerCAmelCase						)
							pipe.to(_lowerCAmelCase						)
							pipe.set_progress_bar_config(disable=_lowerCAmelCase						)
							pipe.enable_attention_slicing()

							lowercase        =							self.get_inputs()
							lowercase        =							pipe(**_lowerCAmelCase						).images
							lowercase        =							image[0, -3:, -3:, -1].flatten()

							assert image.shape == (1, 512, 512, 3)
							lowercase        =							np.array([0.5902, 0.6015, 0.6027, 0.5983, 0.6092, 0.6061, 0.5765, 0.5785, 0.5555]						)

							assert np.abs(expected_slice - image_slice						).max() < 1E-3







	def   _a   (    self						)    ->    List[str]:
							'''simple docstring'''






							lowercase        =							StableDiffusionInstructPixaPixPipeline.from_pretrained(
							    """timbrooks/instruct-pix2pix""" ,				safety_checker=_lowerCAmelCase						)
							lowercase        =							LMSDiscreteScheduler.from_config(pipe.scheduler.config						)
							pipe.to(_lowerCAmelCase						)
							pipe.set_progress_bar_config(disable=_lowerCAmelCase						)
							pipe.enable_attention_slicing()

							lowercase        =							self.get_inputs()
							lowercase        =							pipe(**_lowerCAmelCase						).images
							lowercase        =							image[0, -3:, -3:, -1].flatten()

							assert image.shape == (1, 512, 512, 3)
							lowercase        =							np.array([0.6578, 0.6817, 0.6972, 0.6761, 0.6856, 0.6916, 0.6428, 0.6516, 0.6301]						)

							assert np.abs(expected_slice - image_slice						).max() < 1E-3







	def   _a   (    self						)    ->    Dict:
							'''simple docstring'''






							lowercase        =							StableDiffusionInstructPixaPixPipeline.from_pretrained(
							    """timbrooks/instruct-pix2pix""" ,				safety_checker=_lowerCAmelCase						)
							lowercase        =							DDIMScheduler.from_config(pipe.scheduler.config						)
							pipe.to(_lowerCAmelCase						)
							pipe.set_progress_bar_config(disable=_lowerCAmelCase						)
							pipe.enable_attention_slicing()

							lowercase        =							self.get_inputs()
							lowercase        =							pipe(**_lowerCAmelCase						).images
							lowercase        =							image[0, -3:, -3:, -1].flatten()

							assert image.shape == (1, 512, 512, 3)
							lowercase        =							np.array([0.3828, 0.3834, 0.3818, 0.3792, 0.3865, 0.3752, 0.3792, 0.3847, 0.3753]						)

							assert np.abs(expected_slice - image_slice						).max() < 1E-3







	def   _a   (    self						)    ->    int:
							'''simple docstring'''






							lowercase        =							0

							def callback_fn(_lowerCAmelCase ,				_lowerCAmelCase ,				_lowerCAmelCase						) -> None:
													lowercase        =							True
													nonlocal number_of_steps
													number_of_steps += 1
													if step == 1:
																			lowercase        =							latents.detach().cpu().numpy()
																			assert latents.shape == (1, 4, 64, 64)
																			lowercase        =							latents[0, -3:, -3:, -1]
																			lowercase        =							np.array([-0.2463, -0.4644, -0.9756, 1.5176, 1.4414, 0.7866, 0.9897, 0.8521, 0.7983]						)

																			assert np.abs(latents_slice.flatten() - expected_slice						).max() < 5E-2
													elif step == 2:
																			lowercase        =							latents.detach().cpu().numpy()
																			assert latents.shape == (1, 4, 64, 64)
																			lowercase        =							latents[0, -3:, -3:, -1]
																			lowercase        =							np.array([-0.2644, -0.4626, -0.9653, 1.5176, 1.4551, 0.7686, 0.9805, 0.8452, 0.8115]						)

																			assert np.abs(latents_slice.flatten() - expected_slice						).max() < 5E-2

							lowercase        =							False

							lowercase        =							StableDiffusionInstructPixaPixPipeline.from_pretrained(
							    """timbrooks/instruct-pix2pix""" ,				safety_checker=_lowerCAmelCase ,				torch_dtype=torch.floataa						)
							lowercase        =							pipe.to(_lowerCAmelCase						)
							pipe.set_progress_bar_config(disable=_lowerCAmelCase						)
							pipe.enable_attention_slicing()

							lowercase        =							self.get_inputs()
							pipe(**_lowerCAmelCase ,				callback=_lowerCAmelCase ,				callback_steps=1						)
							assert callback_fn.has_been_called
							assert number_of_steps == 3







	def   _a   (    self						)    ->    Optional[int]:
							'''simple docstring'''






							torch.cuda.empty_cache()
							torch.cuda.reset_max_memory_allocated()
							torch.cuda.reset_peak_memory_stats()

							lowercase        =							StableDiffusionInstructPixaPixPipeline.from_pretrained(
							    """timbrooks/instruct-pix2pix""" ,				safety_checker=_lowerCAmelCase ,				torch_dtype=torch.floataa						)
							lowercase        =							pipe.to(_lowerCAmelCase						)
							pipe.set_progress_bar_config(disable=_lowerCAmelCase						)
							pipe.enable_attention_slicing(1						)
							pipe.enable_sequential_cpu_offload()

							lowercase        =							self.get_inputs()
							lowercase        =							pipe(**_lowerCAmelCase						)

							lowercase        =							torch.cuda.max_memory_allocated()
							# make sure that less than 2.2 GB is allocated
							assert mem_bytes < 2.2 * 10**9







	def   _a   (    self						)    ->    Any:
							'''simple docstring'''






							lowercase        =							self.get_inputs()
							# resize to resolution that is divisible by 8 but not 16 or 32
							lowercase        =							inputs["""image"""].resize((504, 504)						)

							lowercase        =							"""timbrooks/instruct-pix2pix"""
							lowercase        =							StableDiffusionInstructPixaPixPipeline.from_pretrained(
							    _lowerCAmelCase ,				safety_checker=_lowerCAmelCase ,				)
							pipe.to(_lowerCAmelCase						)
							pipe.set_progress_bar_config(disable=_lowerCAmelCase						)
							pipe.enable_attention_slicing()

							lowercase        =							pipe(**_lowerCAmelCase						)
							lowercase        =							output.images[0]

							lowercase        =							image[255:258, 383:386, -1]

							assert image.shape == (504, 504, 3)
							lowercase        =							np.array([0.2726, 0.2529, 0.2664, 0.2655, 0.2641, 0.2642, 0.2591, 0.2649, 0.2590]						)

							assert np.abs(image_slice.flatten() - expected_slice						).max() < 5E-3







'''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_      :				int   					=    {'''vocab_file''': '''spm_char.model'''}

lowercase_      :				int   					=    {
    '''vocab_file''': {
        '''microsoft/speecht5_asr''': '''https://huggingface.co/microsoft/speecht5_asr/resolve/main/spm_char.model''',
        '''microsoft/speecht5_tts''': '''https://huggingface.co/microsoft/speecht5_tts/resolve/main/spm_char.model''',
        '''microsoft/speecht5_vc''': '''https://huggingface.co/microsoft/speecht5_vc/resolve/main/spm_char.model''',
    }
}

lowercase_      :				Optional[Any]   					=    {
    '''microsoft/speecht5_asr''': 1024,
    '''microsoft/speecht5_tts''': 1024,
    '''microsoft/speecht5_vc''': 1024,
}




class      __UpperCamelCase       (_UpperCAmelCase			):
	__A			  =					VOCAB_FILES_NAMES
	__A			  =					PRETRAINED_VOCAB_FILES_MAP
	__A			  =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	__A			  =					['''input_ids''', '''attention_mask''']







	def __init__(    self ,				_lowerCAmelCase ,				_lowerCAmelCase="<s>" ,				_lowerCAmelCase="</s>" ,				_lowerCAmelCase="<unk>" ,				_lowerCAmelCase="<pad>" ,				_lowerCAmelCase = None ,				**_lowerCAmelCase ,				)    ->    None:
							'''simple docstring'''






							lowercase        =							{} if sp_model_kwargs is None else sp_model_kwargs

							super().__init__(
							    bos_token=_lowerCAmelCase ,				eos_token=_lowerCAmelCase ,				unk_token=_lowerCAmelCase ,				pad_token=_lowerCAmelCase ,				sp_model_kwargs=self.sp_model_kwargs ,				**_lowerCAmelCase ,				)

							lowercase        =							vocab_file

							lowercase        =							spm.SentencePieceProcessor(**self.sp_model_kwargs						)
							self.sp_model.Load(_lowerCAmelCase						)







	@property
	def   _a   (    self						)    ->    List[Any]:
							'''simple docstring'''






							return self.sp_model.get_piece_size()







	def   _a   (    self						)    ->    str:
							'''simple docstring'''






							lowercase        =							{self.convert_ids_to_tokens(_lowerCAmelCase						): i for i in range(self.vocab_size						)}
							vocab.update(self.added_tokens_encoder						)
							return vocab







	def __getstate__(    self						)    ->    Union[str, Any]:
							'''simple docstring'''






							lowercase        =							self.__dict__.copy()
							lowercase        =							None
							return state







	def __setstate__(    self ,				_lowerCAmelCase						)    ->    Optional[int]:
							'''simple docstring'''






							lowercase        =							d

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

							lowercase        =							spm.SentencePieceProcessor(**self.sp_model_kwargs						)
							self.sp_model.Load(self.vocab_file						)







	def   _a   (    self ,				_lowerCAmelCase						)    ->    List[str]:
							'''simple docstring'''






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







	def   _a   (    self ,				_lowerCAmelCase						)    ->    List[Any]:
							'''simple docstring'''






							return self.sp_model.piece_to_id(_lowerCAmelCase						)







	def   _a   (    self ,				_lowerCAmelCase						)    ->    str:
							'''simple docstring'''






							lowercase        =							self.sp_model.IdToPiece(_lowerCAmelCase						)
							return token







	def   _a   (    self ,				_lowerCAmelCase						)    ->    Optional[Any]:
							'''simple docstring'''






							lowercase        =							[]
							lowercase        =							""""""
							for token in tokens:
													# make sure that special tokens are not decoded using sentencepiece model
													if token in self.all_special_tokens:
																			out_string += self.sp_model.decode(_lowerCAmelCase						) + token
																			lowercase        =							[]
													else:
																			current_sub_tokens.append(_lowerCAmelCase						)
							out_string += self.sp_model.decode(_lowerCAmelCase						)
							return out_string.strip()







	def   _a   (    self ,				_lowerCAmelCase ,				_lowerCAmelCase=None						)    ->    List[int]:
							'''simple docstring'''






							if token_ids_a is None:
													return token_ids_a + [self.eos_token_id]
							# We don't expect to process pairs, but leave the pair logic for API consistency
							return token_ids_a + token_ids_a + [self.eos_token_id]







	def   _a   (    self ,				_lowerCAmelCase ,				_lowerCAmelCase = None ,				_lowerCAmelCase = False						)    ->    List[int]:
							'''simple docstring'''






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

							lowercase        =							[1]
							if token_ids_a is None:
													return ([0] * len(_lowerCAmelCase						)) + suffix_ones
							return ([0] * len(_lowerCAmelCase						)) + ([0] * len(_lowerCAmelCase						)) + suffix_ones







	def   _a   (    self ,				_lowerCAmelCase ,				_lowerCAmelCase = None						)    ->    Tuple[str]:
							'''simple docstring'''






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

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

							return (out_vocab_file,)


