


'''simple docstring'''



import argparse
from typing import List

import evaluate
import numpy as np
import torch
from datasets import DatasetDict, load_dataset

# New Code #
# We'll be using StratifiedKFold for this example
from sklearn.model_selection import StratifiedKFold
from torch.optim import AdamW
from torch.utils.data import DataLoader
from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed

from accelerate import Accelerator, DistributedType


########################################################################
# This is a fully working simple example to use Accelerate,
# specifically showcasing how to perform Cross Validation,
# and builds off the `nlp_example.py` script.
#
# This example trains a Bert base model on GLUE MRPC
# in any of the following settings (with the same script):
#   - single CPU or single GPU
#   - multi GPUS (using PyTorch distributed mode)
#   - (multi) TPUs
#   - fp16 (mixed-precision) or fp32 (normal precision)
#
# To help focus on the differences in the code, building `DataLoaders`
# was refactored into its own function.
# New additions from the base script can be found quickly by
# looking for the # New Code # tags
#
# To run it in each of these various modes, follow the instructions
# in the readme for examples:
# https://github.com/huggingface/accelerate/tree/main/examples
#
########################################################################


A__		:					Any												=  16
A__		:					Optional[Any]												=  32



def 			UpperCAmelCase__					(	UpperCAmelCase_    :				Accelerator      ,    UpperCAmelCase_    :				DatasetDict      ,    UpperCAmelCase_    :				List[int]      ,    UpperCAmelCase_    :				List[int]      ,    UpperCAmelCase_    :				int = 16							)     ->		Any:
     __lowerCamelCase   :	Optional[Any]								=		AutoTokenizer.from_pretrained('bert-base-cased'							)
     __lowerCamelCase   :	Optional[int]								=		DatasetDict(
         {
             'train': dataset['train'].select(UpperCAmelCase_							),
             'validation': dataset['train'].select(UpperCAmelCase_							),
             'test': dataset['validation'],
         }							)

     def tokenize_function(UpperCAmelCase_    :				Optional[Any]							):
          # max_length=None => use the model max length (it's actually the default)
          __lowerCamelCase   :	int								=		tokenizer(examples['sentence1']      ,    examples['sentence2']      ,    truncation=UpperCAmelCase_      ,    max_length=UpperCAmelCase_							)
          return outputs

     # Apply the method we just defined to all the examples in all the splits of the dataset
     # starting with the main process first:
     with accelerator.main_process_first():
          __lowerCamelCase   :	Optional[int]								=		datasets.map(
              UpperCAmelCase_      ,    batched=UpperCAmelCase_      ,    remove_columns=['idx', 'sentence1', 'sentence2']      ,    )

     # We also rename the 'label' column to 'labels' which is the expected name for labels by the models of the
     # transformers library
     __lowerCamelCase   :	Optional[int]								=		tokenized_datasets.rename_column('label'      ,    'labels'							)

     def collate_fn(UpperCAmelCase_    :				List[Any]							):
          # On TPU it's best to pad everything to the same length or training will be very slow.
          __lowerCamelCase   :	Union[str, Any]								=		1_28 if accelerator.distributed_type == DistributedType.TPU else None
          # When using mixed precision we want round multiples of 8/16
          if accelerator.mixed_precision == "fp8":
               __lowerCamelCase   :	Optional[Any]								=		16
          elif accelerator.mixed_precision != "no":
               __lowerCamelCase   :	Optional[int]								=		8
          else:
               __lowerCamelCase   :	Optional[Any]								=		None

          return tokenizer.pad(
              UpperCAmelCase_      ,    padding='longest'      ,    max_length=UpperCAmelCase_      ,    pad_to_multiple_of=UpperCAmelCase_      ,    return_tensors='pt'      ,    )

     # Instantiate dataloaders.
     __lowerCamelCase   :	Optional[Any]								=		DataLoader(
         tokenized_datasets['train']      ,    shuffle=UpperCAmelCase_      ,    collate_fn=UpperCAmelCase_      ,    batch_size=UpperCAmelCase_							)
     __lowerCamelCase   :	Any								=		DataLoader(
         tokenized_datasets['validation']      ,    shuffle=UpperCAmelCase_      ,    collate_fn=UpperCAmelCase_      ,    batch_size=UpperCAmelCase_							)

     __lowerCamelCase   :	Optional[int]								=		DataLoader(
         tokenized_datasets['test']      ,    shuffle=UpperCAmelCase_      ,    collate_fn=UpperCAmelCase_      ,    batch_size=UpperCAmelCase_							)

     return train_dataloader, eval_dataloader, test_dataloader



def 			UpperCAmelCase__					(	UpperCAmelCase_    :				List[str]      ,    UpperCAmelCase_    :				Union[str, Any]							)     ->		List[Any]:
     # New Code #
     __lowerCamelCase   :	Tuple								=		[]
     # Download the dataset
     __lowerCamelCase   :	int								=		load_dataset('glue'      ,    'mrpc'							)
     # Create our splits
     __lowerCamelCase   :	Tuple								=		StratifiedKFold(n_splits=int(args.num_folds							)							)
     # Initialize accelerator
     __lowerCamelCase   :	Optional[Any]								=		Accelerator(cpu=args.cpu      ,    mixed_precision=args.mixed_precision							)
     # Sample hyper-parameters for learning rate, batch size, seed and a few other HPs
     __lowerCamelCase   :	List[Any]								=		config['lr']
     __lowerCamelCase   :	str								=		int(config['num_epochs']							)
     __lowerCamelCase   :	Optional[int]								=		int(config['seed']							)
     __lowerCamelCase   :	Union[str, Any]								=		int(config['batch_size']							)

     __lowerCamelCase   :	Tuple								=		evaluate.load('glue'      ,    'mrpc'							)

     # If the batch size is too big we use gradient accumulation
     __lowerCamelCase   :	Optional[Any]								=		1
     if batch_size > MAX_GPU_BATCH_SIZE and accelerator.distributed_type != DistributedType.TPU:
          __lowerCamelCase   :	Optional[Any]								=		batch_size // MAX_GPU_BATCH_SIZE
          __lowerCamelCase   :	List[str]								=		MAX_GPU_BATCH_SIZE

     set_seed(UpperCAmelCase_							)

     # New Code #
     # Create our folds:
     __lowerCamelCase   :	str								=		kfold.split(np.zeros(datasets['train'].num_rows							)      ,    datasets['train']['label']							)
     __lowerCamelCase   :	Optional[int]								=		[]
     # Iterate over them
     for i, (train_idxs, valid_idxs) in enumerate(UpperCAmelCase_							):
          __lowerCamelCase				,       __lowerCamelCase				,       __lowerCamelCase   :	int								=		get_fold_dataloaders(
              UpperCAmelCase_      ,    UpperCAmelCase_      ,    UpperCAmelCase_      ,    UpperCAmelCase_      ,    )
          # Instantiate the model (we build the model here so that the seed also control new weights initialization)
          __lowerCamelCase   :	Optional[Any]								=		AutoModelForSequenceClassification.from_pretrained('bert-base-cased'      ,    return_dict=UpperCAmelCase_							)

          # We could avoid this line since the accelerator is set with `device_placement=True` (default value).
          # Note that if you are placing tensors on devices manually, this line absolutely needs to be before the optimizer
          # creation otherwise training will not work on TPU (`accelerate` will kindly throw an error to make us aware of that).
          __lowerCamelCase   :	Optional[Any]								=		model.to(accelerator.device							)

          # Instantiate optimizer
          __lowerCamelCase   :	Optional[Any]								=		AdamW(params=model.parameters()      ,    lr=UpperCAmelCase_							)

          # Instantiate scheduler
          __lowerCamelCase   :	List[str]								=		get_linear_schedule_with_warmup(
              optimizer=UpperCAmelCase_      ,    num_warmup_steps=1_00      ,    num_training_steps=(len(UpperCAmelCase_							) * num_epochs) // gradient_accumulation_steps      ,    )

          # Prepare everything
          # There is no specific order to remember, we just need to unpack the objects in the same order we gave them to the
          # prepare method.
          __lowerCamelCase				,       __lowerCamelCase				,       __lowerCamelCase				,       __lowerCamelCase				,       __lowerCamelCase   :	int								=		accelerator.prepare(
              UpperCAmelCase_      ,    UpperCAmelCase_      ,    UpperCAmelCase_      ,    UpperCAmelCase_      ,    UpperCAmelCase_							)

          # Now we train the model
          for epoch in range(UpperCAmelCase_							):
               model.train()
               for step, batch in enumerate(UpperCAmelCase_							):
                    # We could avoid this line since we set the accelerator with `device_placement=True`.
                    batch.to(accelerator.device							)
                    __lowerCamelCase   :	Any								=		model(**UpperCAmelCase_							)
                    __lowerCamelCase   :	int								=		outputs.loss
                    __lowerCamelCase   :	List[str]								=		loss / gradient_accumulation_steps
                    accelerator.backward(UpperCAmelCase_							)
                    if step % gradient_accumulation_steps == 0:
                         optimizer.step()
                         lr_scheduler.step()
                         optimizer.zero_grad()

               model.eval()
               for step, batch in enumerate(UpperCAmelCase_							):
                    # We could avoid this line since we set the accelerator with `device_placement=True`.
                    batch.to(accelerator.device							)
                    with torch.no_grad():
                         __lowerCamelCase   :	Any								=		model(**UpperCAmelCase_							)
                    __lowerCamelCase   :	List[Any]								=		outputs.logits.argmax(dim=-1							)
                    __lowerCamelCase				,       __lowerCamelCase   :	Dict								=		accelerator.gather_for_metrics((predictions, batch['labels'])							)
                    metric.add_batch(
                        predictions=UpperCAmelCase_      ,    references=UpperCAmelCase_      ,    )

               __lowerCamelCase   :	Any								=		metric.compute()
               # Use accelerator.print to print only on the main process.
               accelerator.print(F'epoch {epoch}:'      ,    UpperCAmelCase_							)

          # New Code #
          # We also run predictions on the test set at the very end
          __lowerCamelCase   :	str								=		[]
          for step, batch in enumerate(UpperCAmelCase_							):
               # We could avoid this line since we set the accelerator with `device_placement=True`.
               batch.to(accelerator.device							)
               with torch.no_grad():
                    __lowerCamelCase   :	Tuple								=		model(**UpperCAmelCase_							)
               __lowerCamelCase   :	int								=		outputs.logits
               __lowerCamelCase				,       __lowerCamelCase   :	int								=		accelerator.gather_for_metrics((predictions, batch['labels'])							)
               fold_predictions.append(predictions.cpu()							)
               if i == 0:
                    # We need all of the test predictions
                    test_references.append(references.cpu()							)
        # Use accelerator.print to print only on the main process.
          test_predictions.append(torch.cat(UpperCAmelCase_      ,    dim=0							)							)
          # We now need to release all our memory and get rid of the current model, optimizer, etc
          accelerator.free_memory()
     # New Code #
     # Finally we check the accuracy of our folded results:
     __lowerCamelCase   :	Tuple								=		torch.cat(UpperCAmelCase_      ,    dim=0							)
     __lowerCamelCase   :	Dict								=		torch.stack(UpperCAmelCase_      ,    dim=0							).sum(dim=0							).div(int(args.num_folds							)							).argmax(dim=-1							)
     __lowerCamelCase   :	Tuple								=		metric.compute(predictions=UpperCAmelCase_      ,    references=UpperCAmelCase_							)
     accelerator.print('Average test metrics from all folds:'      ,    UpperCAmelCase_							)



def 			UpperCAmelCase__					(	)     ->		Union[str, Any]:
     __lowerCamelCase   :	Dict								=		argparse.ArgumentParser(description='Simple example of training script.'							)
     parser.add_argument(
         '--mixed_precision'      ,    type=UpperCAmelCase_      ,    default=UpperCAmelCase_      ,    choices=['no', 'fp16', 'bf16', 'fp8']      ,    help='Whether to use mixed precision. Choose'
         'between fp16 and bf16 (bfloat16). Bf16 requires PyTorch >= 1.10.'
         'and an Nvidia Ampere GPU.'      ,    )
     parser.add_argument('--cpu'      ,    action='store_true'      ,    help='If passed, will train on the CPU.'							)
     # New Code #
     parser.add_argument('--num_folds'      ,    type=UpperCAmelCase_      ,    default=3      ,    help='The number of splits to perform across the dataset'							)
     __lowerCamelCase   :	Union[str, Any]								=		parser.parse_args()
     __lowerCamelCase   :	List[str]								=		{'lr': 2e-5, 'num_epochs': 3, 'seed': 42, 'batch_size': 16}
     training_function(UpperCAmelCase_      ,    UpperCAmelCase_							)


if __name__ == "__main__":
      main()










'''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_	)






