

"""simple docstring"""






import gc
import random
import unittest

import numpy as np
import torch
from transformers import (
    CLIPImageProcessor,
    CLIPTextConfig,
    CLIPTextModel,
    CLIPTokenizer,
    CLIPVisionConfig,
    CLIPVisionModelWithProjection,
)

from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableUnCLIPImgaImgPipeline, UNetaDConditionModel
from diffusers.pipelines.pipeline_utils import DiffusionPipeline
from diffusers.pipelines.stable_diffusion.stable_unclip_image_normalizer import StableUnCLIPImageNormalizer
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import (
    enable_full_determinism,
    floats_tensor,
    load_image,
    load_numpy,
    require_torch_gpu,
    skip_mps,
    slow,
    torch_device,
)

from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS
from ..test_pipelines_common import (
    PipelineKarrasSchedulerTesterMixin,
    PipelineLatentTesterMixin,
    PipelineTesterMixin,
    assert_mean_pixel_difference,
)


enable_full_determinism()







class 	__UpperCamelCase    (    _lowerCAmelCase							,							_lowerCAmelCase							,							_lowerCAmelCase							,							unittest.TestCase						):
		_UpperCAmelCase          =		StableUnCLIPImgaImgPipeline
		_UpperCAmelCase          =		TEXT_GUIDED_IMAGE_VARIATION_PARAMS
		_UpperCAmelCase          =		TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
		_UpperCAmelCase          =		frozenset(
		    []						)  # TO-DO: update image_params once pipeline is refactored with VaeImageProcessor.preprocess
		_UpperCAmelCase          =		frozenset([]						)

		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

						_lowerCAmelCase       :   Union[str, Any]  =    32
						_lowerCAmelCase       :   Union[str, Any]  =    embedder_hidden_size

						# image encoding components

						_lowerCAmelCase       :   Optional[int]  =    CLIPImageProcessor(crop_size=32    ,size=32      )

						torch.manual_seed(0      )
						_lowerCAmelCase       :   List[Any]  =    CLIPVisionModelWithProjection(
						    CLIPVisionConfig(
						        hidden_size=_lowerCAmelCase    ,projection_dim=_lowerCAmelCase    ,num_hidden_layers=5    ,num_attention_heads=4    ,image_size=32    ,intermediate_size=37    ,patch_size=1    ,)      )

						# regular denoising components

						torch.manual_seed(0      )
						_lowerCAmelCase       :   List[Any]  =    StableUnCLIPImageNormalizer(embedding_dim=_lowerCAmelCase      )
						_lowerCAmelCase       :   str  =    DDPMScheduler(beta_schedule='squaredcos_cap_v2'      )

						torch.manual_seed(0      )
						_lowerCAmelCase       :   Union[str, Any]  =    CLIPTokenizer.from_pretrained('hf-internal-testing/tiny-random-clip'      )

						torch.manual_seed(0      )
						_lowerCAmelCase       :   Optional[int]  =    CLIPTextModel(
						    CLIPTextConfig(
						        bos_token_id=0    ,eos_token_id=2    ,hidden_size=_lowerCAmelCase    ,projection_dim=32    ,intermediate_size=37    ,layer_norm_eps=1E-05    ,num_attention_heads=4    ,num_hidden_layers=5    ,pad_token_id=1    ,vocab_size=1000    ,)      )

						torch.manual_seed(0      )
						_lowerCAmelCase       :   Optional[Any]  =    UNetaDConditionModel(
						    sample_size=32    ,in_channels=4    ,out_channels=4    ,down_block_types=('CrossAttnDownBlock2D', 'DownBlock2D')    ,up_block_types=('UpBlock2D', 'CrossAttnUpBlock2D')    ,block_out_channels=(32, 64)    ,attention_head_dim=(2, 4)    ,class_embed_type='projection'    ,projection_class_embeddings_input_dim=embedder_projection_dim * 2    ,cross_attention_dim=_lowerCAmelCase    ,layers_per_block=1    ,upcast_attention=_lowerCAmelCase    ,use_linear_projection=_lowerCAmelCase    ,)

						torch.manual_seed(0      )
						_lowerCAmelCase       :   str  =    DDIMScheduler(
						    beta_schedule='scaled_linear'    ,beta_start=0.0_0_0_8_5    ,beta_end=0.0_1_2    ,prediction_type='v_prediction'    ,set_alpha_to_one=_lowerCAmelCase    ,steps_offset=1    ,)

						torch.manual_seed(0      )
						_lowerCAmelCase       :   int  =    AutoencoderKL()

						_lowerCAmelCase       :   List[str]  =    {
						    # image encoding components
						    'feature_extractor': feature_extractor,
						    'image_encoder': image_encoder.eval(),
						    # image noising components
						    'image_normalizer': image_normalizer.eval(),
						    'image_noising_scheduler': image_noising_scheduler,
						    # regular denoising components
						    'tokenizer': tokenizer,
						    'text_encoder': text_encoder.eval(),
						    'unet': unet.eval(),
						    'scheduler': scheduler,
						    'vae': vae.eval(),
						}

						return components

		def __lowerCamelCase		(		self    ,_A    ,_A=0    ,_A=True      ):
						'''simple docstring'''

						if str(_lowerCAmelCase      ).startswith('mps'      ):
										_lowerCAmelCase       :   Dict  =    torch.manual_seed(_lowerCAmelCase      )
						else:
										_lowerCAmelCase       :   str  =    torch.Generator(device=_lowerCAmelCase      ).manual_seed(_lowerCAmelCase      )

						_lowerCAmelCase       :   str  =    floats_tensor((1, 3, 32, 32)    ,rng=random.Random(_lowerCAmelCase      )      ).to(_lowerCAmelCase      )

						if pil_image:
										_lowerCAmelCase       :   str  =    input_image * 0.5 + 0.5
										_lowerCAmelCase       :   Optional[int]  =    input_image.clamp(0    ,1      )
										_lowerCAmelCase       :   Optional[int]  =    input_image.cpu().permute(0    ,2    ,3    ,1      ).float().numpy()
										_lowerCAmelCase       :   Dict  =    DiffusionPipeline.numpy_to_pil(_lowerCAmelCase      )[0]

						return {
						    "prompt": "An anime racoon running a marathon",
						    "image": input_image,
						    "generator": generator,
						    "num_inference_steps": 2,
						    "output_type": "np",
						}

		@skip_mps
		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

						_lowerCAmelCase       :   Optional[int]  =    'cpu'  # ensure determinism for the device-dependent torch.Generator
						_lowerCAmelCase       :   Tuple  =    self.get_dummy_components()
						_lowerCAmelCase       :   int  =    StableUnCLIPImgaImgPipeline(**_lowerCAmelCase      )
						_lowerCAmelCase       :   Optional[int]  =    sd_pipe.to(_lowerCAmelCase      )
						sd_pipe.set_progress_bar_config(disable=_lowerCAmelCase      )

						_lowerCAmelCase       :   Any  =    self.get_dummy_inputs(_lowerCAmelCase      )
						inputs.update({'image_embeds': None}      )
						_lowerCAmelCase       :   Dict  =    sd_pipe(**_lowerCAmelCase      ).images
						_lowerCAmelCase       :   Optional[Any]  =    image[0, -3:, -3:, -1]

						assert image.shape == (1, 32, 32, 3)
						_lowerCAmelCase       :   Any  =    np.array([0.3_8_7_2, 0.7_2_2_4, 0.5_6_0_1, 0.4_7_4_1, 0.6_8_7_2, 0.5_8_1_4, 0.4_6_3_6, 0.3_8_6_7, 0.5_0_7_8]      )

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

		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

						_lowerCAmelCase       :   Dict  =    torch_device in ['cpu', 'mps']

						self._test_attention_slicing_forward_pass(test_max_difference=_lowerCAmelCase      )

		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

						_lowerCAmelCase       :   Optional[Any]  =    torch_device in ['cpu', 'mps']

						self._test_inference_batch_single_identical(test_max_difference=_lowerCAmelCase      )







		@unittest.skipIf(
		    torch_device != 'cuda' or not is_xformers_available()    ,reason='XFormers attention is only available with CUDA and `xformers` installed'    ,)
		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

						self._test_xformers_attention_forwardGenerator_pass(test_max_difference=_lowerCAmelCase      )







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

		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

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

		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

						_lowerCAmelCase       :   Union[str, Any]  =    load_image(
						    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/turtle.png'      )

						_lowerCAmelCase       :   Dict  =    load_numpy(
						    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/stable_unclip_2_1_l_img2img_anime_turtle_fp16.npy'      )

						_lowerCAmelCase       :   int  =    StableUnCLIPImgaImgPipeline.from_pretrained(
						    'fusing/stable-unclip-2-1-l-img2img'    ,torch_dtype=torch.floataa      )
						pipe.to(_lowerCAmelCase      )
						pipe.set_progress_bar_config(disable=_lowerCAmelCase      )
						# stable unclip will oom when integration tests are run on a V100,
						# so turn on memory savings
						pipe.enable_attention_slicing()
						pipe.enable_sequential_cpu_offload()

						_lowerCAmelCase       :   Dict  =    torch.Generator(device='cpu'      ).manual_seed(0      )
						_lowerCAmelCase       :   str  =    pipe(_lowerCAmelCase    ,'anime turle'    ,generator=_lowerCAmelCase    ,output_type='np'      )

						_lowerCAmelCase       :   str  =    output.images[0]

						assert image.shape == (768, 768, 3)

						assert_mean_pixel_difference(_lowerCAmelCase    ,_lowerCAmelCase      )

		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

						_lowerCAmelCase       :   Dict  =    load_image(
						    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/turtle.png'      )

						_lowerCAmelCase       :   List[str]  =    load_numpy(
						    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/stable_unclip_2_1_h_img2img_anime_turtle_fp16.npy'      )

						_lowerCAmelCase       :   List[Any]  =    StableUnCLIPImgaImgPipeline.from_pretrained(
						    'fusing/stable-unclip-2-1-h-img2img'    ,torch_dtype=torch.floataa      )
						pipe.to(_lowerCAmelCase      )
						pipe.set_progress_bar_config(disable=_lowerCAmelCase      )
						# stable unclip will oom when integration tests are run on a V100,
						# so turn on memory savings
						pipe.enable_attention_slicing()
						pipe.enable_sequential_cpu_offload()

						_lowerCAmelCase       :   List[str]  =    torch.Generator(device='cpu'      ).manual_seed(0      )
						_lowerCAmelCase       :   Tuple  =    pipe(_lowerCAmelCase    ,'anime turle'    ,generator=_lowerCAmelCase    ,output_type='np'      )

						_lowerCAmelCase       :   List[Any]  =    output.images[0]

						assert image.shape == (768, 768, 3)

						assert_mean_pixel_difference(_lowerCAmelCase    ,_lowerCAmelCase      )







		def __lowerCamelCase		(		self      ):
						'''simple docstring'''

						_lowerCAmelCase       :   Optional[Any]  =    load_image(
						    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/turtle.png'      )

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

						_lowerCAmelCase       :   Optional[Any]  =    StableUnCLIPImgaImgPipeline.from_pretrained(
						    'fusing/stable-unclip-2-1-h-img2img'    ,torch_dtype=torch.floataa      )
						_lowerCAmelCase       :   Dict  =    pipe.to(_lowerCAmelCase      )
						pipe.set_progress_bar_config(disable=_lowerCAmelCase      )
						pipe.enable_attention_slicing()
						pipe.enable_sequential_cpu_offload()

						_lowerCAmelCase       :   Union[str, Any]  =    pipe(
						    _lowerCAmelCase    ,'anime turtle'    ,num_inference_steps=2    ,output_type='np'    ,)

						_lowerCAmelCase       :   Union[str, Any]  =    torch.cuda.max_memory_allocated()
						# make sure that less than 7 GB is allocated
						assert mem_bytes < 7 * 10**9








"""simple docstring"""






import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_bert import BertTokenizer


_lowerCAmelCase						=		logging.get_logger(__name__)

_lowerCAmelCase						=		{"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

_lowerCAmelCase						=		{
    """vocab_file""": {
        """bert-base-uncased""": """https://huggingface.co/bert-base-uncased/resolve/main/vocab.txt""",
        """bert-large-uncased""": """https://huggingface.co/bert-large-uncased/resolve/main/vocab.txt""",
        """bert-base-cased""": """https://huggingface.co/bert-base-cased/resolve/main/vocab.txt""",
        """bert-large-cased""": """https://huggingface.co/bert-large-cased/resolve/main/vocab.txt""",
        """bert-base-multilingual-uncased""": (
            """https://huggingface.co/bert-base-multilingual-uncased/resolve/main/vocab.txt"""
        ),
        """bert-base-multilingual-cased""": """https://huggingface.co/bert-base-multilingual-cased/resolve/main/vocab.txt""",
        """bert-base-chinese""": """https://huggingface.co/bert-base-chinese/resolve/main/vocab.txt""",
        """bert-base-german-cased""": """https://huggingface.co/bert-base-german-cased/resolve/main/vocab.txt""",
        """bert-large-uncased-whole-word-masking""": (
            """https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/vocab.txt"""
        ),
        """bert-large-cased-whole-word-masking""": (
            """https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/vocab.txt"""
        ),
        """bert-large-uncased-whole-word-masking-finetuned-squad""": (
            """https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt"""
        ),
        """bert-large-cased-whole-word-masking-finetuned-squad""": (
            """https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt"""
        ),
        """bert-base-cased-finetuned-mrpc""": (
            """https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/vocab.txt"""
        ),
        """bert-base-german-dbmdz-cased""": """https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/vocab.txt""",
        """bert-base-german-dbmdz-uncased""": (
            """https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/vocab.txt"""
        ),
        """TurkuNLP/bert-base-finnish-cased-v1""": (
            """https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/vocab.txt"""
        ),
        """TurkuNLP/bert-base-finnish-uncased-v1""": (
            """https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/vocab.txt"""
        ),
        """wietsedv/bert-base-dutch-cased""": (
            """https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/vocab.txt"""
        ),
    },
    """tokenizer_file""": {
        """bert-base-uncased""": """https://huggingface.co/bert-base-uncased/resolve/main/tokenizer.json""",
        """bert-large-uncased""": """https://huggingface.co/bert-large-uncased/resolve/main/tokenizer.json""",
        """bert-base-cased""": """https://huggingface.co/bert-base-cased/resolve/main/tokenizer.json""",
        """bert-large-cased""": """https://huggingface.co/bert-large-cased/resolve/main/tokenizer.json""",
        """bert-base-multilingual-uncased""": (
            """https://huggingface.co/bert-base-multilingual-uncased/resolve/main/tokenizer.json"""
        ),
        """bert-base-multilingual-cased""": (
            """https://huggingface.co/bert-base-multilingual-cased/resolve/main/tokenizer.json"""
        ),
        """bert-base-chinese""": """https://huggingface.co/bert-base-chinese/resolve/main/tokenizer.json""",
        """bert-base-german-cased""": """https://huggingface.co/bert-base-german-cased/resolve/main/tokenizer.json""",
        """bert-large-uncased-whole-word-masking""": (
            """https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/tokenizer.json"""
        ),
        """bert-large-cased-whole-word-masking""": (
            """https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/tokenizer.json"""
        ),
        """bert-large-uncased-whole-word-masking-finetuned-squad""": (
            """https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json"""
        ),
        """bert-large-cased-whole-word-masking-finetuned-squad""": (
            """https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json"""
        ),
        """bert-base-cased-finetuned-mrpc""": (
            """https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/tokenizer.json"""
        ),
        """bert-base-german-dbmdz-cased""": (
            """https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/tokenizer.json"""
        ),
        """bert-base-german-dbmdz-uncased""": (
            """https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/tokenizer.json"""
        ),
        """TurkuNLP/bert-base-finnish-cased-v1""": (
            """https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/tokenizer.json"""
        ),
        """TurkuNLP/bert-base-finnish-uncased-v1""": (
            """https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/tokenizer.json"""
        ),
        """wietsedv/bert-base-dutch-cased""": (
            """https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/tokenizer.json"""
        ),
    },
}

_lowerCAmelCase						=		{
    """bert-base-uncased""": 5_1_2,
    """bert-large-uncased""": 5_1_2,
    """bert-base-cased""": 5_1_2,
    """bert-large-cased""": 5_1_2,
    """bert-base-multilingual-uncased""": 5_1_2,
    """bert-base-multilingual-cased""": 5_1_2,
    """bert-base-chinese""": 5_1_2,
    """bert-base-german-cased""": 5_1_2,
    """bert-large-uncased-whole-word-masking""": 5_1_2,
    """bert-large-cased-whole-word-masking""": 5_1_2,
    """bert-large-uncased-whole-word-masking-finetuned-squad""": 5_1_2,
    """bert-large-cased-whole-word-masking-finetuned-squad""": 5_1_2,
    """bert-base-cased-finetuned-mrpc""": 5_1_2,
    """bert-base-german-dbmdz-cased""": 5_1_2,
    """bert-base-german-dbmdz-uncased""": 5_1_2,
    """TurkuNLP/bert-base-finnish-cased-v1""": 5_1_2,
    """TurkuNLP/bert-base-finnish-uncased-v1""": 5_1_2,
    """wietsedv/bert-base-dutch-cased""": 5_1_2,
}

_lowerCAmelCase						=		{
    """bert-base-uncased""": {"""do_lower_case""": True},
    """bert-large-uncased""": {"""do_lower_case""": True},
    """bert-base-cased""": {"""do_lower_case""": False},
    """bert-large-cased""": {"""do_lower_case""": False},
    """bert-base-multilingual-uncased""": {"""do_lower_case""": True},
    """bert-base-multilingual-cased""": {"""do_lower_case""": False},
    """bert-base-chinese""": {"""do_lower_case""": False},
    """bert-base-german-cased""": {"""do_lower_case""": False},
    """bert-large-uncased-whole-word-masking""": {"""do_lower_case""": True},
    """bert-large-cased-whole-word-masking""": {"""do_lower_case""": False},
    """bert-large-uncased-whole-word-masking-finetuned-squad""": {"""do_lower_case""": True},
    """bert-large-cased-whole-word-masking-finetuned-squad""": {"""do_lower_case""": False},
    """bert-base-cased-finetuned-mrpc""": {"""do_lower_case""": False},
    """bert-base-german-dbmdz-cased""": {"""do_lower_case""": False},
    """bert-base-german-dbmdz-uncased""": {"""do_lower_case""": True},
    """TurkuNLP/bert-base-finnish-cased-v1""": {"""do_lower_case""": False},
    """TurkuNLP/bert-base-finnish-uncased-v1""": {"""do_lower_case""": True},
    """wietsedv/bert-base-dutch-cased""": {"""do_lower_case""": False},
}







class 	__UpperCamelCase    (    a__						):
  _UpperCAmelCase          =		VOCAB_FILES_NAMES
  _UpperCAmelCase          =		PRETRAINED_VOCAB_FILES_MAP
  _UpperCAmelCase          =		PRETRAINED_INIT_CONFIGURATION
  _UpperCAmelCase          =		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  _UpperCAmelCase          =		BertTokenizer

  def __init__(		self    ,_A=None    ,_A=None    ,_A=True    ,_A="[UNK]"    ,_A="[SEP]"    ,_A="[PAD]"    ,_A="[CLS]"    ,_A="[MASK]"    ,_A=True    ,_A=None    ,**_A    ,):
      '''simple docstring'''

      super().__init__(
          _A    ,tokenizer_file=_A    ,do_lower_case=_A    ,unk_token=_A    ,sep_token=_A    ,pad_token=_A    ,cls_token=_A    ,mask_token=_A    ,tokenize_chinese_chars=_A    ,strip_accents=_A    ,**_A    ,)

      _lowerCAmelCase       :   Tuple  =    json.loads(self.backend_tokenizer.normalizer.__getstate__()      )
      if (
          normalizer_state.get('lowercase'    ,_A      ) != do_lower_case
          or normalizer_state.get('strip_accents'    ,_A      ) != strip_accents
          or normalizer_state.get('handle_chinese_chars'    ,_A      ) != tokenize_chinese_chars
      ):
          _lowerCAmelCase       :   Dict  =    getattr(_A    ,normalizer_state.pop('type'      )      )
          _lowerCAmelCase       :   Dict  =    do_lower_case
          _lowerCAmelCase       :   Optional[int]  =    strip_accents
          _lowerCAmelCase       :   Union[str, Any]  =    tokenize_chinese_chars
          _lowerCAmelCase       :   Dict  =    normalizer_class(**_A      )

      _lowerCAmelCase       :   Union[str, Any]  =    do_lower_case

  def __lowerCamelCase		(		self    ,_A    ,_A=None      ):
      '''simple docstring'''

      _lowerCAmelCase       :   Tuple  =    [self.cls_token_id] + token_ids_a + [self.sep_token_id]

      if token_ids_a:
          output += token_ids_a + [self.sep_token_id]

      return output

  def __lowerCamelCase		(		self    ,_A    ,_A = None      ):
      '''simple docstring'''

      _lowerCAmelCase       :   Union[str, Any]  =    [self.sep_token_id]
      _lowerCAmelCase       :   str  =    [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]







  def __lowerCamelCase		(		self    ,_A    ,_A = None      ):
      '''simple docstring'''

      _lowerCAmelCase       :   str  =    self._tokenizer.model.save(_A    ,name=_A      )
      return tuple(_A      )





