

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

import sentencepiece as spm

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


lowerCamelCase :      Tuple					 =     logging.get_logger(__name__)

lowerCamelCase :      List[str]					 =     "▁"

lowerCamelCase :      Union[str, Any]					 =     {"vocab_file": "sentencepiece.bpe.model"}

lowerCamelCase :      Tuple					 =     {
    "vocab_file": {
        "facebook/mbart-large-50-one-to-many-mmt": (
            "https://huggingface.co/facebook/mbart-large-50-one-to-many-mmt/resolve/main/sentencepiece.bpe.model"
        ),
    }
}

lowerCamelCase :      str					 =     {
    "facebook/mbart-large-50-one-to-many-mmt": 1_0_2_4,
}

# fmt: off
lowerCamelCase :      Dict					 =     ["ar_AR", "cs_CZ", "de_DE", "en_XX", "es_XX", "et_EE", "fi_FI", "fr_XX", "gu_IN", "hi_IN", "it_IT", "ja_XX", "kk_KZ", "ko_KR", "lt_LT", "lv_LV", "my_MM", "ne_NP", "nl_XX", "ro_RO", "ru_RU", "si_LK", "tr_TR", "vi_VN", "zh_CN", "af_ZA", "az_AZ", "bn_IN", "fa_IR", "he_IL", "hr_HR", "id_ID", "ka_GE", "km_KH", "mk_MK", "ml_IN", "mn_MN", "mr_IN", "pl_PL", "ps_AF", "pt_XX", "sv_SE", "sw_KE", "ta_IN", "te_IN", "th_TH", "tl_XX", "uk_UA", "ur_PK", "xh_ZA", "gl_ES", "sl_SI"]







class 							A__    (       A__  ):
  A__		 =				VOCAB_FILES_NAMES
  A__		 =				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  A__		 =				PRETRAINED_VOCAB_FILES_MAP
  A__		 =				['input_ids', 'attention_mask']

  A__		 =				[]
  A__		 =				[]





  def __init__(		self      :	int							,					_a      :	Tuple							,					_a      :	Optional[int]=None							,					_a      :	str=None							,					_a      :	Tuple="</s>"							,					_a      :	List[str]="</s>"							,					_a      :	Any="<s>"							,					_a      :	Dict="<unk>"							,					_a      :	Optional[Any]="<pad>"							,					_a      :	Optional[int]="<mask>"							,					_a      :	Optional[Dict[str, Any]] = None							,					**_a      :	List[Any]							,					)	->    None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =AddedToken(_a							,					lstrip=_a							,					rstrip=_a ) if isinstance(_a							,					_a ) else mask_token

       _SCREAMING_SNAKE_CASE							    ={} if sp_model_kwargs is None else sp_model_kwargs

       _SCREAMING_SNAKE_CASE							    =kwargs.get('additional_special_tokens'							,					[] )
       kwargs["additional_special_tokens"] += [
           code for code in FAIRSEQ_LANGUAGE_CODES if code not in kwargs["additional_special_tokens"]
       ]

       super().__init__(
           src_lang=_a							,					tgt_lang=_a							,					eos_token=_a							,					unk_token=_a							,					sep_token=_a							,					cls_token=_a							,					pad_token=_a							,					mask_token=_a							,					sp_model_kwargs=self.sp_model_kwargs							,					**_a							,					)

       _SCREAMING_SNAKE_CASE							    =spm.SentencePieceProcessor(**self.sp_model_kwargs )
       self.sp_model.Load(str(_a ) )
       _SCREAMING_SNAKE_CASE							    =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'

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

       # The first "real" token "," has position 4 in the original fairseq vocab and position 3 in the spm vocab
       _SCREAMING_SNAKE_CASE							    =1

       _SCREAMING_SNAKE_CASE							    =len(self.sp_model )
       _SCREAMING_SNAKE_CASE							    ={
           code: self.sp_model_size + i + self.fairseq_offset for i, code in enumerate(_a )
       }
       _SCREAMING_SNAKE_CASE							    ={v: k for k, v in self.lang_code_to_id.items()}
       _SCREAMING_SNAKE_CASE							    =len(self.sp_model ) + len(self.lang_code_to_id ) + self.fairseq_offset

       self.fairseq_tokens_to_ids.update(self.lang_code_to_id )
       _SCREAMING_SNAKE_CASE							    ={v: k for k, v in self.fairseq_tokens_to_ids.items()}

       _SCREAMING_SNAKE_CASE							    =src_lang if src_lang is not None else 'en_XX'
       _SCREAMING_SNAKE_CASE							    =self.lang_code_to_id[self._src_lang]
       _SCREAMING_SNAKE_CASE							    =tgt_lang
       self.set_src_lang_special_tokens(self._src_lang )





  @property
  def 						A  (		self      :	Dict )	->    int:





       '''simple docstring'''






       return len(self.sp_model ) + len(self.lang_code_to_id ) + self.fairseq_offset + 1  # Plus 1 for the mask token





  @property
  def 						A  (		self      :	List[Any] )	->    str:





       '''simple docstring'''






       return self._src_lang





  @src_lang.setter
  def 						A  (		self      :	Optional[Any]							,					_a      :	str )	->    None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =new_src_lang
       self.set_src_lang_special_tokens(self._src_lang )





  def __getstate__(		self      :	List[Any] )	->    Dict:





       '''simple docstring'''






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





  def __setstate__(		self      :	Dict							,					_a      :	Dict )	->    None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =d

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

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





  def 						A  (		self      :	List[Any] )	->    Dict:





       '''simple docstring'''






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





  def 						A  (		self      :	Dict							,					_a      :	str )	->    List[str]:





       '''simple docstring'''






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





  def 						A  (		self      :	str							,					_a      :	str )	->    int:





       '''simple docstring'''






       if token in self.fairseq_tokens_to_ids:
            return self.fairseq_tokens_to_ids[token]
       _SCREAMING_SNAKE_CASE							    =self.sp_model.PieceToId(_a )

       # 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 						A  (		self      :	Optional[int]							,					_a      :	int )	->    str:





       '''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 						A  (		self      :	List[Any]							,					_a      :	str )	->    int:





       '''simple docstring'''






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





  def 						A  (		self      :	Optional[int]							,					_a      :	str							,					_a      :	Optional[str] = None )	->    Tuple[str]:





       '''simple docstring'''






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

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

       return (out_vocab_file,)





  def 						A  (		self      :	str							,					_a      :	List[int]							,					_a      :	Optional[List[int]] = None							,					_a      :	bool = False )	->    List[int]:





       '''simple docstring'''






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

       _SCREAMING_SNAKE_CASE							    =[1] * len(self.prefix_tokens )
       _SCREAMING_SNAKE_CASE							    =[1] * len(self.suffix_tokens )
       if token_ids_a is None:
            return prefix_ones + ([0] * len(_a )) + suffix_ones
       return prefix_ones + ([0] * len(_a )) + ([0] * len(_a )) + suffix_ones





  def 						A  (		self      :	List[str]							,					_a      :	List[int]							,					_a      :	Optional[List[int]] = None )	->    List[int]:





       '''simple docstring'''






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





  def 						A  (		self      :	Union[str, Any]							,					_a      :	Union[str, Any]							,					_a      :	str							,					_a      :	Optional[str]							,					_a      :	Optional[str]							,					**_a      :	Optional[Any] )	->    int:





       '''simple docstring'''






       if src_lang is None or tgt_lang is None:
            raise ValueError('Translation requires a `src_lang` and a `tgt_lang` for this model' )
       _SCREAMING_SNAKE_CASE							    =src_lang
       _SCREAMING_SNAKE_CASE							    =self(_a							,					add_special_tokens=_a							,					return_tensors=_a							,					**_a )
       _SCREAMING_SNAKE_CASE							    =self.convert_tokens_to_ids(_a )
       _SCREAMING_SNAKE_CASE							    =tgt_lang_id
       return inputs





  def 						A  (		self      :	Optional[Any]							,					_a      :	List[str]							,					_a      :	str = "en_XX"							,					_a      :	Optional[List[str]] = None							,					_a      :	str = "ro_RO"							,					**_a      :	Optional[Any]							,					)	->    BatchEncoding:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =src_lang
       _SCREAMING_SNAKE_CASE							    =tgt_lang
       return super().prepare_seqaseq_batch(_a							,					_a							,					**_a )





  def 						A  (		self      :	int )	->    List[Any]:





       '''simple docstring'''






       return self.set_src_lang_special_tokens(self.src_lang )





  def 						A  (		self      :	Optional[Any] )	->    Optional[Any]:





       '''simple docstring'''






       return self.set_tgt_lang_special_tokens(self.tgt_lang )





  def 						A  (		self      :	Tuple							,					_a      :	str )	->    None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =self.lang_code_to_id[src_lang]
       _SCREAMING_SNAKE_CASE							    =[self.cur_lang_code_id]
       _SCREAMING_SNAKE_CASE							    =[self.eos_token_id]





  def 						A  (		self      :	Optional[int]							,					_a      :	str )	->    None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							    =self.lang_code_to_id[tgt_lang]
       _SCREAMING_SNAKE_CASE							    =[self.cur_lang_code_id]
       _SCREAMING_SNAKE_CASE							    =[self.eos_token_id]




'''simple docstring'''



from copy import deepcopy
from typing import Optional, Union

import numpy as np

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
from ...utils import TensorType, is_tf_available, is_torch_available


if is_torch_available():
      import torch

if is_tf_available():
      import tensorflow as tf





class    UpperCAmelCase_  (_UpperCAmelCase  ):





    """simple docstring"""






    lowerCamelCase  :					Dict							     =			['image_processor']
    lowerCamelCase  :					str							     =			'SamImageProcessor'







    def __init__(							self			,     SCREAMING_SNAKE_CASE_	)				->     List[str]:
         super().__init__(SCREAMING_SNAKE_CASE_	)
         __lowerCamelCase   :	Any								=		self.image_processor
         __lowerCamelCase   :	str								=		-10
         __lowerCamelCase   :	List[str]								=		self.image_processor.size['longest_edge']







    def __call__(							self			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_ = None			,     **SCREAMING_SNAKE_CASE_			,     )				->     BatchEncoding:
         __lowerCamelCase   :	Union[str, Any]								=		self.image_processor(
             SCREAMING_SNAKE_CASE_			,     return_tensors=SCREAMING_SNAKE_CASE_			,     **SCREAMING_SNAKE_CASE_			,     )

         # pop arguments that are not used in the foward but used nevertheless
         __lowerCamelCase   :	List[Any]								=		encoding_image_processor['original_sizes']

         if hasattr(SCREAMING_SNAKE_CASE_			,     'numpy'	):  # Checks if Torch or TF tensor
              __lowerCamelCase   :	Dict								=		original_sizes.numpy()

         __lowerCamelCase				,       __lowerCamelCase				,       __lowerCamelCase   :	str								=		self._check_and_preprocess_points(
             input_points=SCREAMING_SNAKE_CASE_			,     input_labels=SCREAMING_SNAKE_CASE_			,     input_boxes=SCREAMING_SNAKE_CASE_			,     )

         __lowerCamelCase   :	Tuple								=		self._normalize_and_convert(
             SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_			,     input_points=SCREAMING_SNAKE_CASE_			,     input_labels=SCREAMING_SNAKE_CASE_			,     input_boxes=SCREAMING_SNAKE_CASE_			,     return_tensors=SCREAMING_SNAKE_CASE_			,     )

         return encoding_image_processor







    def       lowercase_				(							self			,     SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_="pt"			,     )				->     Optional[int]:
         if input_points is not None:
              if len(SCREAMING_SNAKE_CASE_	) != len(SCREAMING_SNAKE_CASE_	):
                   __lowerCamelCase   :	Union[str, Any]								=		[
                       self._normalize_coordinates(self.target_size			,     SCREAMING_SNAKE_CASE_			,     original_sizes[0]	) for point in input_points
                   ]
              else:
                   __lowerCamelCase   :	List[Any]								=		[
                       self._normalize_coordinates(self.target_size			,     SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_	)
                       for point, original_size in zip(SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_	)
                   ]
              # check that all arrays have the same shape
              if not all(point.shape == input_points[0].shape for point in input_points	):
                   if input_labels is not None:
                        __lowerCamelCase				,       __lowerCamelCase   :	Tuple								=		self._pad_points_and_labels(SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_	)

              __lowerCamelCase   :	Optional[int]								=		np.array(SCREAMING_SNAKE_CASE_	)

         if input_labels is not None:
              __lowerCamelCase   :	Optional[int]								=		np.array(SCREAMING_SNAKE_CASE_	)

         if input_boxes is not None:
              if len(SCREAMING_SNAKE_CASE_	) != len(SCREAMING_SNAKE_CASE_	):
                   __lowerCamelCase   :	Union[str, Any]								=		[
                       self._normalize_coordinates(self.target_size			,     SCREAMING_SNAKE_CASE_			,     original_sizes[0]			,     is_bounding_box=SCREAMING_SNAKE_CASE_	)
                       for box in input_boxes
                   ]
              else:
                   __lowerCamelCase   :	Optional[int]								=		[
                       self._normalize_coordinates(self.target_size			,     SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_			,     is_bounding_box=SCREAMING_SNAKE_CASE_	)
                       for box, original_size in zip(SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_	)
                   ]
              __lowerCamelCase   :	Optional[int]								=		np.array(SCREAMING_SNAKE_CASE_	)

         if input_boxes is not None:
              if return_tensors == "pt":
                   __lowerCamelCase   :	Any								=		torch.from_numpy(SCREAMING_SNAKE_CASE_	)
                   # boxes batch size of 1 by default
                   __lowerCamelCase   :	Union[str, Any]								=		input_boxes.unsqueeze(1	) if len(input_boxes.shape	) != 3 else input_boxes
              elif return_tensors == "tf":
                   __lowerCamelCase   :	List[str]								=		tf.convert_to_tensor(SCREAMING_SNAKE_CASE_	)
                   # boxes batch size of 1 by default
                   __lowerCamelCase   :	str								=		tf.expand_dims(SCREAMING_SNAKE_CASE_			,     1	) if len(input_boxes.shape	) != 3 else input_boxes
              encoding_image_processor.update({'input_boxes': input_boxes}	)
         if input_points is not None:
              if return_tensors == "pt":
                   __lowerCamelCase   :	int								=		torch.from_numpy(SCREAMING_SNAKE_CASE_	)
                   # point batch size of 1 by default
                   __lowerCamelCase   :	Dict								=		input_points.unsqueeze(1	) if len(input_points.shape	) != 4 else input_points
              elif return_tensors == "tf":
                   __lowerCamelCase   :	Dict								=		tf.convert_to_tensor(SCREAMING_SNAKE_CASE_	)
                   # point batch size of 1 by default
                   __lowerCamelCase   :	Tuple								=		tf.expand_dims(SCREAMING_SNAKE_CASE_			,     1	) if len(input_points.shape	) != 4 else input_points
              encoding_image_processor.update({'input_points': input_points}	)
         if input_labels is not None:
              if return_tensors == "pt":
                   __lowerCamelCase   :	List[Any]								=		torch.from_numpy(SCREAMING_SNAKE_CASE_	)
                   # point batch size of 1 by default
                   __lowerCamelCase   :	Dict								=		input_labels.unsqueeze(1	) if len(input_labels.shape	) != 3 else input_labels
              elif return_tensors == "tf":
                   __lowerCamelCase   :	str								=		tf.convert_to_tensor(SCREAMING_SNAKE_CASE_	)
                   # point batch size of 1 by default
                   __lowerCamelCase   :	Dict								=		tf.expand_dims(SCREAMING_SNAKE_CASE_			,     1	) if len(input_labels.shape	) != 3 else input_labels
              encoding_image_processor.update({'input_labels': input_labels}	)

         return encoding_image_processor







    def       lowercase_				(							self			,     SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_	)				->     Tuple:
         __lowerCamelCase   :	List[str]								=		max([point.shape[0] for point in input_points]	)
         __lowerCamelCase   :	Union[str, Any]								=		[]
         for i, point in enumerate(SCREAMING_SNAKE_CASE_	):
              if point.shape[0] != expected_nb_points:
                   __lowerCamelCase   :	Optional[int]								=		np.concatenate(
                       [point, np.zeros((expected_nb_points - point.shape[0], 2)	) + self.point_pad_value]			,     axis=0	)
                   __lowerCamelCase   :	List[Any]								=		np.append(input_labels[i]			,     [self.point_pad_value]	)
              processed_input_points.append(SCREAMING_SNAKE_CASE_	)
         __lowerCamelCase   :	List[Any]								=		processed_input_points
         return input_points, input_labels







    def       lowercase_				(							self			,     SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_=False	)				->     np.ndarray:
         __lowerCamelCase				,       __lowerCamelCase   :	Tuple								=		original_size
         __lowerCamelCase				,       __lowerCamelCase   :	Optional[Any]								=		self.image_processor._get_preprocess_shape(SCREAMING_SNAKE_CASE_			,     longest_edge=SCREAMING_SNAKE_CASE_	)
         __lowerCamelCase   :	Dict								=		deepcopy(SCREAMING_SNAKE_CASE_	).astype(SCREAMING_SNAKE_CASE_	)

         if is_bounding_box:
              __lowerCamelCase   :	Optional[int]								=		coords.reshape(-1			,     2			,     2	)

         __lowerCamelCase   :	List[Any]								=		coords[..., 0] * (new_w / old_w)
         __lowerCamelCase   :	Dict								=		coords[..., 1] * (new_h / old_h)

         if is_bounding_box:
              __lowerCamelCase   :	Tuple								=		coords.reshape(-1			,     4	)

         return coords







    def       lowercase_				(							self			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_=None			,     SCREAMING_SNAKE_CASE_=None			,     )				->     Optional[Any]:
         if input_points is not None:
              if hasattr(SCREAMING_SNAKE_CASE_			,     'numpy'	):  # Checks for TF or Torch tensor
                   __lowerCamelCase   :	List[str]								=		input_points.numpy().tolist()

              if not isinstance(SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_	) or not isinstance(input_points[0]			,     SCREAMING_SNAKE_CASE_	):
                   raise ValueError('Input points must be a list of list of floating points.'	)
              __lowerCamelCase   :	str								=		[np.array(SCREAMING_SNAKE_CASE_	) for input_point in input_points]
         else:
              __lowerCamelCase   :	Optional[Any]								=		None

         if input_labels is not None:
              if hasattr(SCREAMING_SNAKE_CASE_			,     'numpy'	):
                   __lowerCamelCase   :	Union[str, Any]								=		input_labels.numpy().tolist()

              if not isinstance(SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_	) or not isinstance(input_labels[0]			,     SCREAMING_SNAKE_CASE_	):
                   raise ValueError('Input labels must be a list of list integers.'	)
              __lowerCamelCase   :	Any								=		[np.array(SCREAMING_SNAKE_CASE_	) for label in input_labels]
         else:
              __lowerCamelCase   :	Dict								=		None

         if input_boxes is not None:
              if hasattr(SCREAMING_SNAKE_CASE_			,     'numpy'	):
                   __lowerCamelCase   :	int								=		input_boxes.numpy().tolist()

              if (
                  not isinstance(SCREAMING_SNAKE_CASE_			,     SCREAMING_SNAKE_CASE_	)
                  or not isinstance(input_boxes[0]			,     SCREAMING_SNAKE_CASE_	)
                  or not isinstance(input_boxes[0][0]			,     SCREAMING_SNAKE_CASE_	)
              ):
                   raise ValueError('Input boxes must be a list of list of list of floating points.'	)
              __lowerCamelCase   :	List[Any]								=		[np.array(SCREAMING_SNAKE_CASE_	).astype(np.floataa	) for box in input_boxes]
         else:
              __lowerCamelCase   :	Tuple								=		None

         return input_points, input_labels, input_boxes







    @property
    def       lowercase_				(							self	)				->     Dict:
         __lowerCamelCase   :	Any								=		self.image_processor.model_input_names
         return list(dict.fromkeys(SCREAMING_SNAKE_CASE_	)	)







    def       lowercase_				(							self			,     *SCREAMING_SNAKE_CASE_			,     **SCREAMING_SNAKE_CASE_	)				->     Optional[Any]:
         return self.image_processor.post_process_masks(*SCREAMING_SNAKE_CASE_			,     **SCREAMING_SNAKE_CASE_	)






