




import json
import unittest

import numpy as np
from huggingface_hub import hf_hub_download

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 transformers import OneFormerImageProcessor
												from transformers.models.oneformer.image_processing_oneformer import binary_mask_to_rle
												from transformers.models.oneformer.modeling_oneformer import OneFormerForUniversalSegmentationOutput

if is_vision_available():
						from PIL import Image





def __UpperCamelCase			(       _A ,  _A="shi-labs/oneformer_demo"  ):
						with open(hf_hub_download(_A ,  _A ,  repo_type='''dataset'''  ) ,  '''r'''  ) as f:
												lowerCAmelCase_      			=  json.load(_A  )
						lowerCAmelCase_      			=  {}
						lowerCAmelCase_      			=  []
						lowerCAmelCase_      			=  []
						for key, info in class_info.items():
												lowerCAmelCase_      			=  info['''name''']
												class_names.append(info['''name''']  )
												if info["isthing"]:
																		thing_ids.append(int(_A  )  )
						lowerCAmelCase_      			=  thing_ids
						lowerCAmelCase_      			=  class_names
						return metadata


class  A		(  unittest.TestCase     ):



		def __init__(     self,	UpperCamelCase__,	UpperCamelCase__=7,	UpperCamelCase__=3,	UpperCamelCase__=30,	UpperCamelCase__=400,	UpperCamelCase__=None,	UpperCamelCase__=True,	UpperCamelCase__=True,	UpperCamelCase__=[0.5, 0.5, 0.5],	UpperCamelCase__=[0.5, 0.5, 0.5],	UpperCamelCase__=10,	UpperCamelCase__=False,	UpperCamelCase__=255,	UpperCamelCase__="shi-labs/oneformer_demo",	UpperCamelCase__="ade20k_panoptic.json",	UpperCamelCase__=10,	):







								"""simple docstring"""



								lowerCAmelCase_      			=  parent
								lowerCAmelCase_      			=  batch_size
								lowerCAmelCase_      			=  num_channels
								lowerCAmelCase_      			=  min_resolution
								lowerCAmelCase_      			=  max_resolution
								lowerCAmelCase_      			=  do_resize
								lowerCAmelCase_      			=  {'''shortest_edge''': 32, '''longest_edge''': 1333} if size is None else size
								lowerCAmelCase_      			=  do_normalize
								lowerCAmelCase_      			=  image_mean
								lowerCAmelCase_      			=  image_std
								lowerCAmelCase_      			=  class_info_file
								lowerCAmelCase_      			=  prepare_metadata(UpperCamelCase__,	UpperCamelCase__   )
								lowerCAmelCase_      			=  num_text
								lowerCAmelCase_      			=  repo_path

								# for the post_process_functions
								lowerCAmelCase_      			=  2
								lowerCAmelCase_      			=  10
								lowerCAmelCase_      			=  10
								lowerCAmelCase_      			=  3
								lowerCAmelCase_      			=  4
								lowerCAmelCase_      			=  num_labels
								lowerCAmelCase_      			=  do_reduce_labels
								lowerCAmelCase_      			=  ignore_index



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								return {
								    "do_resize": self.do_resize,
								    "size": self.size,
								    "do_normalize": self.do_normalize,
								    "image_mean": self.image_mean,
								    "image_std": self.image_std,
								    "num_labels": self.num_labels,
								    "do_reduce_labels": self.do_reduce_labels,
								    "ignore_index": self.ignore_index,
								    "class_info_file": self.class_info_file,
								    "metadata": self.metadata,
								    "num_text": self.num_text,
								}



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__,	UpperCamelCase__=False   ):







								"""simple docstring"""



								if not batched:
														lowerCAmelCase_      			=  image_inputs[0]
														if isinstance(UpperCamelCase__,	Image.Image   ):
																				lowerCAmelCase_			,					lowerCAmelCase_      			=  image.size
														else:
																				lowerCAmelCase_			,					lowerCAmelCase_      			=  image.shape[1], image.shape[2]
														if w < h:
																				lowerCAmelCase_      			=  int(self.size['''shortest_edge'''] * h / w   )
																				lowerCAmelCase_      			=  self.size['''shortest_edge''']
														elif w > h:
																				lowerCAmelCase_      			=  self.size['''shortest_edge''']
																				lowerCAmelCase_      			=  int(self.size['''shortest_edge'''] * w / h   )
														else:
																				lowerCAmelCase_      			=  self.size['''shortest_edge''']
																				lowerCAmelCase_      			=  self.size['''shortest_edge''']

								else:
														lowerCAmelCase_      			=  []
														for image in image_inputs:
																				lowerCAmelCase_			,					lowerCAmelCase_      			=  self.get_expected_values([image]   )
																				expected_values.append((expected_height, expected_width)   )
														lowerCAmelCase_      			=  max(UpperCamelCase__,	key=lambda UpperCamelCase__   : item[0]   )[0]
														lowerCAmelCase_      			=  max(UpperCamelCase__,	key=lambda UpperCamelCase__   : item[1]   )[1]

								return expected_height, expected_width







		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								return OneFormerForUniversalSegmentationOutput(
								    # +1 for null class
								    class_queries_logits=torch.randn((self.batch_size, self.num_queries, self.num_classes + 1)   ),	masks_queries_logits=torch.randn((self.batch_size, self.num_queries, self.height, self.width)   ),	)







@require_torch
@require_vision
class  A		(  __UpperCAmelCase      ,				unittest.TestCase     ):
		__snake_case									=   OneFormerImageProcessor if (is_vision_available() and is_torch_available()) else None
		# only for test_image_processing_common.test_image_proc_to_json_string
		__snake_case									=   image_processing_class



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  OneFormerImageProcessorTester(self   )



		@property
		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								return self.image_processing_tester.prepare_image_processor_dict()



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  self.image_processing_class(**self.image_processor_dict   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''image_mean'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''image_std'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''do_normalize'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''do_resize'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''size'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''ignore_index'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''class_info_file'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''num_text'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''repo_path'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''metadata'''   )   )
								self.assertTrue(hasattr(UpperCamelCase__,	'''do_reduce_labels'''   )   )



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								pass



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  self.image_processing_class(**self.image_processor_dict   )
								# create random PIL images
								lowerCAmelCase_      			=  prepare_image_inputs(self.image_processing_tester,	equal_resolution=UpperCamelCase__   )
								for image in image_inputs:
														self.assertIsInstance(UpperCamelCase__,	Image.Image   )

								# Test not batched input
								lowerCAmelCase_      			=  image_processor(image_inputs[0],	['''semantic'''],	return_tensors='''pt'''   ).pixel_values

								lowerCAmelCase_			,					lowerCAmelCase_      			=  self.image_processing_tester.get_expected_values(UpperCamelCase__   )

								self.assertEqual(
								    encoded_images.shape,	(1, self.image_processing_tester.num_channels, expected_height, expected_width),	)

								# Test batched
								lowerCAmelCase_			,					lowerCAmelCase_      			=  self.image_processing_tester.get_expected_values(UpperCamelCase__,	batched=UpperCamelCase__   )

								lowerCAmelCase_      			=  image_processor(
								    UpperCamelCase__,	['''semantic'''] * len(UpperCamelCase__   ),	return_tensors='''pt'''   ).pixel_values
								self.assertEqual(
								    encoded_images.shape,	(
								        self.image_processing_tester.batch_size,
								        self.image_processing_tester.num_channels,
								        expected_height,
								        expected_width,
								    ),	)



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  self.image_processing_class(**self.image_processor_dict   )
								# create random numpy tensors
								lowerCAmelCase_      			=  prepare_image_inputs(self.image_processing_tester,	equal_resolution=UpperCamelCase__,	numpify=UpperCamelCase__   )
								for image in image_inputs:
														self.assertIsInstance(UpperCamelCase__,	np.ndarray   )

								# Test not batched input
								lowerCAmelCase_      			=  image_processor(image_inputs[0],	['''semantic'''],	return_tensors='''pt'''   ).pixel_values

								lowerCAmelCase_			,					lowerCAmelCase_      			=  self.image_processing_tester.get_expected_values(UpperCamelCase__   )

								self.assertEqual(
								    encoded_images.shape,	(1, self.image_processing_tester.num_channels, expected_height, expected_width),	)

								# Test batched
								lowerCAmelCase_			,					lowerCAmelCase_      			=  self.image_processing_tester.get_expected_values(UpperCamelCase__,	batched=UpperCamelCase__   )

								lowerCAmelCase_      			=  image_processor(
								    UpperCamelCase__,	['''semantic'''] * len(UpperCamelCase__   ),	return_tensors='''pt'''   ).pixel_values
								self.assertEqual(
								    encoded_images.shape,	(
								        self.image_processing_tester.batch_size,
								        self.image_processing_tester.num_channels,
								        expected_height,
								        expected_width,
								    ),	)



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  self.image_processing_class(**self.image_processor_dict   )
								# create random PyTorch tensors
								lowerCAmelCase_      			=  prepare_image_inputs(self.image_processing_tester,	equal_resolution=UpperCamelCase__,	torchify=UpperCamelCase__   )
								for image in image_inputs:
														self.assertIsInstance(UpperCamelCase__,	torch.Tensor   )

								# Test not batched input
								lowerCAmelCase_      			=  image_processor(image_inputs[0],	['''semantic'''],	return_tensors='''pt'''   ).pixel_values

								lowerCAmelCase_			,					lowerCAmelCase_      			=  self.image_processing_tester.get_expected_values(UpperCamelCase__   )

								self.assertEqual(
								    encoded_images.shape,	(1, self.image_processing_tester.num_channels, expected_height, expected_width),	)

								# Test batched
								lowerCAmelCase_			,					lowerCAmelCase_      			=  self.image_processing_tester.get_expected_values(UpperCamelCase__,	batched=UpperCamelCase__   )

								lowerCAmelCase_      			=  image_processor(
								    UpperCamelCase__,	['''semantic'''] * len(UpperCamelCase__   ),	return_tensors='''pt'''   ).pixel_values
								self.assertEqual(
								    encoded_images.shape,	(
								        self.image_processing_tester.batch_size,
								        self.image_processing_tester.num_channels,
								        expected_height,
								        expected_width,
								    ),	)



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__=False,	UpperCamelCase__=False,	UpperCamelCase__="np"   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  self.image_processing_class(**self.image_processor_dict   )
								# prepare image and target
								lowerCAmelCase_      			=  self.image_processing_tester.num_labels
								lowerCAmelCase_      			=  None
								lowerCAmelCase_      			=  None
								lowerCAmelCase_      			=  prepare_image_inputs(self.image_processing_tester,	equal_resolution=UpperCamelCase__   )
								if with_segmentation_maps:
														lowerCAmelCase_      			=  num_labels
														if is_instance_map:
																				lowerCAmelCase_      			=  list(range(UpperCamelCase__   )   ) * 2
																				lowerCAmelCase_      			=  dict(enumerate(UpperCamelCase__   )   )
														lowerCAmelCase_      			=  [
														    np.random.randint(0,	high * 2,	(img.size[1], img.size[0])   ).astype(np.uinta   ) for img in image_inputs
														]
														if segmentation_type == "pil":
																				lowerCAmelCase_      			=  [Image.fromarray(UpperCamelCase__   ) for annotation in annotations]

								lowerCAmelCase_      			=  image_processor(
								    UpperCamelCase__,	['''semantic'''] * len(UpperCamelCase__   ),	UpperCamelCase__,	return_tensors='''pt''',	instance_id_to_semantic_id=UpperCamelCase__,	pad_and_return_pixel_mask=UpperCamelCase__,	)

								return inputs



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								pass



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								def common(UpperCamelCase__=False,	UpperCamelCase__=None   ):
														lowerCAmelCase_      			=  self.comm_get_image_processor_inputs(
														    with_segmentation_maps=UpperCamelCase__,	is_instance_map=UpperCamelCase__,	segmentation_type=UpperCamelCase__   )

														lowerCAmelCase_      			=  inputs['''mask_labels''']
														lowerCAmelCase_      			=  inputs['''class_labels''']
														lowerCAmelCase_      			=  inputs['''pixel_values''']
														lowerCAmelCase_      			=  inputs['''text_inputs''']

														# check the batch_size
														for mask_label, class_label, text_input in zip(UpperCamelCase__,	UpperCamelCase__,	UpperCamelCase__   ):
																				self.assertEqual(mask_label.shape[0],	class_label.shape[0]   )
																				# this ensure padding has happened
																				self.assertEqual(mask_label.shape[1:],	pixel_values.shape[2:]   )
																				self.assertEqual(len(UpperCamelCase__   ),	self.image_processing_tester.num_text   )

								common()
								common(is_instance_map=UpperCamelCase__   )
								common(is_instance_map=UpperCamelCase__,	segmentation_type='''pil'''   )
								common(is_instance_map=UpperCamelCase__,	segmentation_type='''pil'''   )



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  np.zeros((20, 50)   )
								lowerCAmelCase_      			=  1
								lowerCAmelCase_      			=  1
								lowerCAmelCase_      			=  1

								lowerCAmelCase_      			=  binary_mask_to_rle(UpperCamelCase__   )
								self.assertEqual(len(UpperCamelCase__   ),	4   )
								self.assertEqual(rle[0],	21   )
								self.assertEqual(rle[1],	45   )



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  self.image_processing_class(
								    num_labels=self.image_processing_tester.num_classes,	max_seq_length=77,	task_seq_length=77,	class_info_file='''ade20k_panoptic.json''',	num_text=self.image_processing_tester.num_text,	repo_path='''shi-labs/oneformer_demo''',	)
								lowerCAmelCase_      			=  self.image_processing_tester.get_fake_oneformer_outputs()

								lowerCAmelCase_      			=  fature_extractor.post_process_semantic_segmentation(UpperCamelCase__   )

								self.assertEqual(len(UpperCamelCase__   ),	self.image_processing_tester.batch_size   )
								self.assertEqual(
								    segmentation[0].shape,	(
								        self.image_processing_tester.height,
								        self.image_processing_tester.width,
								    ),	)

								lowerCAmelCase_      			=  [(1, 4) for i in range(self.image_processing_tester.batch_size   )]
								lowerCAmelCase_      			=  fature_extractor.post_process_semantic_segmentation(UpperCamelCase__,	target_sizes=UpperCamelCase__   )

								self.assertEqual(segmentation[0].shape,	target_sizes[0]   )



		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  self.image_processing_class(
								    num_labels=self.image_processing_tester.num_classes,	max_seq_length=77,	task_seq_length=77,	class_info_file='''ade20k_panoptic.json''',	num_text=self.image_processing_tester.num_text,	repo_path='''shi-labs/oneformer_demo''',	)
								lowerCAmelCase_      			=  self.image_processing_tester.get_fake_oneformer_outputs()
								lowerCAmelCase_      			=  image_processor.post_process_instance_segmentation(UpperCamelCase__,	threshold=0   )

								self.assertTrue(len(UpperCamelCase__   ) == self.image_processing_tester.batch_size   )
								for el in segmentation:
														self.assertTrue('''segmentation''' in el   )
														self.assertTrue('''segments_info''' in el   )
														self.assertEqual(type(el['''segments_info''']   ),	UpperCamelCase__   )
														self.assertEqual(
														    el['''segmentation'''].shape,	(self.image_processing_tester.height, self.image_processing_tester.width)   )







		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  self.image_processing_class(
								    num_labels=self.image_processing_tester.num_classes,	max_seq_length=77,	task_seq_length=77,	class_info_file='''ade20k_panoptic.json''',	num_text=self.image_processing_tester.num_text,	repo_path='''shi-labs/oneformer_demo''',	)
								lowerCAmelCase_      			=  self.image_processing_tester.get_fake_oneformer_outputs()
								lowerCAmelCase_      			=  image_processor.post_process_panoptic_segmentation(UpperCamelCase__,	threshold=0   )

								self.assertTrue(len(UpperCamelCase__   ) == self.image_processing_tester.batch_size   )
								for el in segmentation:
														self.assertTrue('''segmentation''' in el   )
														self.assertTrue('''segments_info''' in el   )
														self.assertEqual(type(el['''segments_info''']   ),	UpperCamelCase__   )
														self.assertEqual(
														    el['''segmentation'''].shape,	(self.image_processing_tester.height, self.image_processing_tester.width)   )










from typing import Dict, List, Optional

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


_A     =			logging.get_logger(__name__)


_A     =			{
    '''nielsr/canine-s''': 2_048,
}

# Unicode defines 1,114,112 total “codepoints”
_A     =			1_114_112

# Below: Constants defining canonical codepoints for special, pseudo-characters.
# Copied from https://github.com/google-research/language/blob/master/language/canine/special_codepoints.py
_A     =			0

_A     =			0xe0_00
_A     =			0xe0_01
_A     =			0xe0_02
_A     =			0xe0_03
_A     =			0xe0_04

# Maps special codepoints to human-readable names.
_A     =			{
    # Special symbols are represented using codepoints values that are valid,
    # but designated as "Private Use", meaning that they will never be assigned
    # characters by the Unicode Consortium, and are thus safe for use here.
    #
    # NOTE: Do *NOT* add any sort of [UNK_CHAR] here. They are explicitly
    # excluded and should fail with a hard error.
    CLS: "[CLS]",
    SEP: "[SEP]",
    BOS: "[BOS]",
    MASK: "[MASK]",
    PAD: "[PAD]",
    RESERVED: "[RESERVED]",
}

# Maps special codepoint human-readable names to their codepoint values.
_A     =			{name: codepoint for codepoint, name in SPECIAL_CODEPOINTS.items()}


class  A		(  __UpperCAmelCase     ):
		__snake_case									=   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES



		def __init__(     self,	UpperCamelCase__=chr(UpperCamelCase__   ),	UpperCamelCase__=chr(UpperCamelCase__   ),	UpperCamelCase__=chr(UpperCamelCase__   ),	UpperCamelCase__=chr(UpperCamelCase__   ),	UpperCamelCase__=chr(UpperCamelCase__   ),	UpperCamelCase__=chr(UpperCamelCase__   ),	UpperCamelCase__=False,	UpperCamelCase__=2048,	**UpperCamelCase__,	):







								"""simple docstring"""



								lowerCAmelCase_      			=  AddedToken(UpperCamelCase__,	lstrip=UpperCamelCase__,	rstrip=UpperCamelCase__   ) if isinstance(UpperCamelCase__,	UpperCamelCase__   ) else bos_token
								lowerCAmelCase_      			=  AddedToken(UpperCamelCase__,	lstrip=UpperCamelCase__,	rstrip=UpperCamelCase__   ) if isinstance(UpperCamelCase__,	UpperCamelCase__   ) else eos_token
								lowerCAmelCase_      			=  AddedToken(UpperCamelCase__,	lstrip=UpperCamelCase__,	rstrip=UpperCamelCase__   ) if isinstance(UpperCamelCase__,	UpperCamelCase__   ) else sep_token
								lowerCAmelCase_      			=  AddedToken(UpperCamelCase__,	lstrip=UpperCamelCase__,	rstrip=UpperCamelCase__   ) if isinstance(UpperCamelCase__,	UpperCamelCase__   ) else cls_token
								lowerCAmelCase_      			=  AddedToken(UpperCamelCase__,	lstrip=UpperCamelCase__,	rstrip=UpperCamelCase__   ) if isinstance(UpperCamelCase__,	UpperCamelCase__   ) else pad_token

								# Mask token behave like a normal word, i.e. include the space before it
								lowerCAmelCase_      			=  AddedToken(UpperCamelCase__,	lstrip=UpperCamelCase__,	rstrip=UpperCamelCase__   ) if isinstance(UpperCamelCase__,	UpperCamelCase__   ) else mask_token

								super().__init__(
								    bos_token=UpperCamelCase__,	eos_token=UpperCamelCase__,	sep_token=UpperCamelCase__,	cls_token=UpperCamelCase__,	pad_token=UpperCamelCase__,	mask_token=UpperCamelCase__,	add_prefix_space=UpperCamelCase__,	model_max_length=UpperCamelCase__,	**UpperCamelCase__,	)

								# Creates a mapping for looking up the IDs of special symbols.
								lowerCAmelCase_      			=  {}
								for codepoint, name in SPECIAL_CODEPOINTS.items():
														lowerCAmelCase_      			=  codepoint

								# Creates a mapping for looking up the string forms of special symbol IDs.
								lowerCAmelCase_      			=  {
								    codepoint: name for name, codepoint in self._special_codepoints.items()
								}

								lowerCAmelCase_      			=  UNICODE_VOCAB_SIZE
								lowerCAmelCase_      			=  len(self._special_codepoints   )



		@property
		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								return self._unicode_vocab_size



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__   ):







								"""simple docstring"""



								return list(UpperCamelCase__   )



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__   ):







								"""simple docstring"""



								try:
														return ord(UpperCamelCase__   )
								except TypeError:
														raise ValueError(f"invalid token: '{token}'"   )



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__   ):







								"""simple docstring"""



								try:
														if index in SPECIAL_CODEPOINTS:
																				return SPECIAL_CODEPOINTS[index]
														return chr(UpperCamelCase__   )
								except TypeError:
														raise ValueError(f"invalid id: {index}"   )



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__   ):







								"""simple docstring"""



								return "".join(UpperCamelCase__   )



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__,	UpperCamelCase__ = None   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  [self.sep_token_id]
								lowerCAmelCase_      			=  [self.cls_token_id]

								lowerCAmelCase_      			=  cls + token_ids_a + sep
								if token_ids_a is not None:
														result += token_ids_a + sep
								return result



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__,	UpperCamelCase__ = None,	UpperCamelCase__ = False   ):







								"""simple docstring"""



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

								lowerCAmelCase_      			=  [1] + ([0] * len(UpperCamelCase__   )) + [1]
								if token_ids_a is not None:
														result += ([0] * len(UpperCamelCase__   )) + [1]
								return result



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__,	UpperCamelCase__ = None   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  [self.sep_token_id]
								lowerCAmelCase_      			=  [self.cls_token_id]

								lowerCAmelCase_      			=  len(cls + token_ids_a + sep   ) * [0]
								if token_ids_a is not None:
														result += len(token_ids_a + sep   ) * [1]
								return result







		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__,	UpperCamelCase__ = None   ):







								"""simple docstring"""



								return ()




