



import json
import os
import re
import unicodedata
from json.encoder import INFINITY
from typing import Any, Dict, List, Optional, Tuple, Union

import numpy as np
import regex

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding
from ...utils import TensorType, is_flax_available, is_tf_available, is_torch_available, logging
from ...utils.generic import _is_jax, _is_numpy


__snake_case						:List[Any]      		=     logging.get_logger(__name__)

__snake_case						:Union[str, Any]      		=     {
    '''artists_file''': '''artists.json''',
    '''lyrics_file''': '''lyrics.json''',
    '''genres_file''': '''genres.json''',
}

__snake_case						:List[str]      		=     {
    '''artists_file''': {
        '''jukebox''': '''https://huggingface.co/ArthurZ/jukebox/blob/main/artists.json''',
    },
    '''genres_file''': {
        '''jukebox''': '''https://huggingface.co/ArthurZ/jukebox/blob/main/genres.json''',
    },
    '''lyrics_file''': {
        '''jukebox''': '''https://huggingface.co/ArthurZ/jukebox/blob/main/lyrics.json''',
    },
}

__snake_case						:Optional[Any]      		=     {
    '''jukebox''': 512,
}

class     _A       (	__UpperCAmelCase    ):
       UpperCamelCase__  :    Tuple											=						VOCAB_FILES_NAMES
       UpperCamelCase__  :    List[str]											=						PRETRAINED_VOCAB_FILES_MAP
       UpperCamelCase__  :    Dict											=						PRETRAINED_LYRIC_TOKENS_SIZES
       UpperCamelCase__  :    str											=						['''input_ids''', '''attention_mask''']



       def __init__(		self							:     str     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     List[Any]     ,		__SCREAMING_SNAKE_CASE							:     List[Any]     ,		__SCREAMING_SNAKE_CASE							:     Tuple=["v3", "v2", "v2"]     ,		__SCREAMING_SNAKE_CASE							:     Optional[int]=512     ,		__SCREAMING_SNAKE_CASE							:     List[Any]=5     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]="<|endoftext|>"     ,		**__SCREAMING_SNAKE_CASE							:     List[str]     ,		):


           '''simple docstring'''

           __a						       =				AddedToken(__SCREAMING_SNAKE_CASE     ,		lstrip=__SCREAMING_SNAKE_CASE     ,		rstrip=__SCREAMING_SNAKE_CASE) if isinstance(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE) else unk_token
           super().__init__(
               unk_token=__SCREAMING_SNAKE_CASE     ,		n_genres=__SCREAMING_SNAKE_CASE     ,		version=__SCREAMING_SNAKE_CASE     ,		max_n_lyric_tokens=__SCREAMING_SNAKE_CASE     ,		**__SCREAMING_SNAKE_CASE     ,		)
           __a						       =				version
           __a						       =				max_n_lyric_tokens
           __a						       =				n_genres

           with open(__SCREAMING_SNAKE_CASE     ,		encoding='''utf-8''') as vocab_handle:
               __a						       =				json.load(__SCREAMING_SNAKE_CASE)

           with open(__SCREAMING_SNAKE_CASE     ,		encoding='''utf-8''') as vocab_handle:
               __a						       =				json.load(__SCREAMING_SNAKE_CASE)

           with open(__SCREAMING_SNAKE_CASE     ,		encoding='''utf-8''') as vocab_handle:
               __a						       =				json.load(__SCREAMING_SNAKE_CASE)

           __a						       =				r'''[^A-Za-z0-9.,:;!?\-\'\"()\[\] \t\n]+'''
           # In v2, we had a n_vocab=80 and in v3 we missed + and so n_vocab=79 of characters.
           if len(self.lyrics_encoder) == 79:
               __a						       =				oov.replace(r'''\-\''''     ,		r'''\-+\'''')

           __a						       =				regex.compile(__SCREAMING_SNAKE_CASE)
           __a						       =				{v: k for k, v in self.artists_encoder.items()}
           __a						       =				{v: k for k, v in self.genres_encoder.items()}
           __a						       =				{v: k for k, v in self.lyrics_encoder.items()}



       @property
       def 		_lowerCamelCase			(		self							:     List[str]):


           '''simple docstring'''

           return len(self.artists_encoder) + len(self.genres_encoder) + len(self.lyrics_encoder)



       def 		_lowerCamelCase			(		self							:     Dict):


           '''simple docstring'''

           return dict(self.artists_encoder     ,		self.genres_encoder     ,		self.lyrics_encoder)



       def 		_lowerCamelCase			(		self							:     Union[str, Any]     ,		__SCREAMING_SNAKE_CASE							:     List[Any]     ,		__SCREAMING_SNAKE_CASE							:     str     ,		__SCREAMING_SNAKE_CASE							:     str):


           '''simple docstring'''

           __a						       =				[self.artists_encoder.get(__SCREAMING_SNAKE_CASE     ,		0) for artist in list_artists]
           for genres in range(len(__SCREAMING_SNAKE_CASE)):
               __a						       =				[self.genres_encoder.get(__SCREAMING_SNAKE_CASE     ,		0) for genre in list_genres[genres]]
               __a						       =				list_genres[genres] + [-1] * (self.n_genres - len(list_genres[genres]))

           __a						       =				[[self.lyrics_encoder.get(__SCREAMING_SNAKE_CASE     ,		0) for character in list_lyrics[0]], [], []]
           return artists_id, list_genres, lyric_ids



       def 		_lowerCamelCase			(		self							:     Optional[int]     ,		__SCREAMING_SNAKE_CASE							:     int):


           '''simple docstring'''

           return list(__SCREAMING_SNAKE_CASE)



       def 		_lowerCamelCase			(		self							:     Tuple     ,		__SCREAMING_SNAKE_CASE							:     Optional[int]     ,		__SCREAMING_SNAKE_CASE							:     List[str]     ,		__SCREAMING_SNAKE_CASE							:     Tuple     ,		**__SCREAMING_SNAKE_CASE							:     Any):


           '''simple docstring'''

           __a       ,   __a       ,   __a						       =				self.prepare_for_tokenization(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)
           __a						       =				self._tokenize(__SCREAMING_SNAKE_CASE)
           return artist, genre, lyrics



       def 		_lowerCamelCase			(		self							:     Optional[int]     ,		__SCREAMING_SNAKE_CASE							:     str     ,		__SCREAMING_SNAKE_CASE							:     str     ,		__SCREAMING_SNAKE_CASE							:     str     ,		__SCREAMING_SNAKE_CASE							:     bool = False):


           '''simple docstring'''

           for idx in range(len(self.version)):
               if self.version[idx] == "v3":
                   __a						       =				artists[idx].lower()
                   __a						       =				[genres[idx].lower()]
               else:
                   __a						       =				self._normalize(artists[idx]) + '''.v2'''
                   __a						       =				[
                       self._normalize(__SCREAMING_SNAKE_CASE) + '''.v2''' for genre in genres[idx].split('''_''')
                   ]  # split is for the full dictionary with combined genres

           if self.version[0] == "v2":
               __a						       =				regex.compile(r'''[^A-Za-z0-9.,:;!?\-\'\"()\[\] \t\n]+''')
               __a						       =				'''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,:;!?-+\'\"()[] \t\n'''
               __a						       =				{vocab[index]: index + 1 for index in range(len(__SCREAMING_SNAKE_CASE))}
               __a						       =				0
               __a						       =				len(__SCREAMING_SNAKE_CASE) + 1
               __a						       =				self.vocab
               __a						       =				{v: k for k, v in self.vocab.items()}
               __a						       =				''''''
           else:
               __a						       =				regex.compile(r'''[^A-Za-z0-9.,:;!?\-+\'\"()\[\] \t\n]+''')

           __a						       =				self._run_strip_accents(__SCREAMING_SNAKE_CASE)
           __a						       =				lyrics.replace('''\\'''     ,		'''\n''')
           __a						       =				self.out_of_vocab.sub(''''''     ,		__SCREAMING_SNAKE_CASE), [], []
           return artists, genres, lyrics



       def 		_lowerCamelCase			(		self							:     int     ,		__SCREAMING_SNAKE_CASE							:     str):


           '''simple docstring'''

           __a						       =				unicodedata.normalize('''NFD'''     ,		__SCREAMING_SNAKE_CASE)
           __a						       =				[]
           for char in text:
               __a						       =				unicodedata.category(__SCREAMING_SNAKE_CASE)
               if cat == "Mn":
                   continue
               output.append(__SCREAMING_SNAKE_CASE)
           return "".join(__SCREAMING_SNAKE_CASE)



       def 		_lowerCamelCase			(		self							:     Any     ,		__SCREAMING_SNAKE_CASE							:     str):


           '''simple docstring'''

           __a						       =				(
               [chr(__SCREAMING_SNAKE_CASE) for i in range(ord('''a''')     ,		ord('''z''') + 1)]
               + [chr(__SCREAMING_SNAKE_CASE) for i in range(ord('''A''')     ,		ord('''Z''') + 1)]
               + [chr(__SCREAMING_SNAKE_CASE) for i in range(ord('''0''')     ,		ord('''9''') + 1)]
               + ['''.''']
           )
           __a						       =				frozenset(__SCREAMING_SNAKE_CASE)
           __a						       =				re.compile(r'''_+''')
           __a						       =				''''''.join([c if c in accepted else '''_''' for c in text.lower()])
           __a						       =				pattern.sub('''_'''     ,		__SCREAMING_SNAKE_CASE).strip('''_''')
           return text



       def 		_lowerCamelCase			(		self							:     List[str]     ,		__SCREAMING_SNAKE_CASE							:     List[str]):


           '''simple docstring'''

           return " ".join(__SCREAMING_SNAKE_CASE)



       def 		_lowerCamelCase			(		self							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     Optional[int]     ,		__SCREAMING_SNAKE_CASE							:     Optional[Union[str, TensorType]] = None     ,		__SCREAMING_SNAKE_CASE							:     bool = False):


           '''simple docstring'''

           if not isinstance(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE):
               __a						       =				TensorType(__SCREAMING_SNAKE_CASE)

           # Get a function reference for the correct framework
           if tensor_type == TensorType.TENSORFLOW:
               if not is_tf_available():
                   raise ImportError(
                       '''Unable to convert output to TensorFlow tensors format, TensorFlow is not installed.''')
               import tensorflow as tf

               __a						       =				tf.constant
               __a						       =				tf.is_tensor
           elif tensor_type == TensorType.PYTORCH:
               if not is_torch_available():
                   raise ImportError('''Unable to convert output to PyTorch tensors format, PyTorch is not installed.''')
               import torch

               __a						       =				torch.tensor
               __a						       =				torch.is_tensor
           elif tensor_type == TensorType.JAX:
               if not is_flax_available():
                   raise ImportError('''Unable to convert output to JAX tensors format, JAX is not installed.''')
               import jax.numpy as jnp  # noqa: F811

               __a						       =				jnp.array
               __a						       =				_is_jax
           else:
               __a						       =				np.asarray
               __a						       =				_is_numpy

           # Do the tensor conversion in batch

           try:
               if prepend_batch_axis:
                   __a						       =				[inputs]

               if not is_tensor(__SCREAMING_SNAKE_CASE):
                   __a						       =				as_tensor(__SCREAMING_SNAKE_CASE)
           except:  # noqa E722
               raise ValueError(
                   '''Unable to create tensor, you should probably activate truncation and/or padding '''
                   '''with \'padding=True\' \'truncation=True\' to have batched tensors with the same length.''')

           return inputs



       def __call__(		self							:     List[str]     ,		__SCREAMING_SNAKE_CASE							:     List[Any]     ,		__SCREAMING_SNAKE_CASE							:     Tuple     ,		__SCREAMING_SNAKE_CASE							:     Tuple=""     ,		__SCREAMING_SNAKE_CASE							:     Any="pt"):


           '''simple docstring'''

           __a						       =				[0, 0, 0]
           __a						       =				[artist] * len(self.version)
           __a						       =				[genres] * len(self.version)

           __a       ,   __a       ,   __a						       =				self.tokenize(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)
           __a       ,   __a       ,   __a						       =				self._convert_token_to_id(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)

           __a						       =				[-INFINITY] * len(full_tokens[-1])
           __a						       =				[
               self.convert_to_tensors(
                   [input_ids + [artists_id[i]] + genres_ids[i] + full_tokens[i]]     ,		tensor_type=__SCREAMING_SNAKE_CASE)
               for i in range(len(self.version))
           ]
           return BatchEncoding({'''input_ids''': input_ids, '''attention_masks''': attention_masks})



       def 		_lowerCamelCase			(		self							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     str     ,		__SCREAMING_SNAKE_CASE							:     Optional[str] = None):


           '''simple docstring'''

           if not os.path.isdir(__SCREAMING_SNAKE_CASE):
               logger.error(F'Vocabulary path ({save_directory}) should be a directory')
               return

           __a						       =				os.path.join(
               __SCREAMING_SNAKE_CASE     ,		(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''artists_file'''])
           with open(__SCREAMING_SNAKE_CASE     ,		'''w'''     ,		encoding='''utf-8''') as f:
               f.write(json.dumps(self.artists_encoder     ,		ensure_ascii=__SCREAMING_SNAKE_CASE))

           __a						       =				os.path.join(
               __SCREAMING_SNAKE_CASE     ,		(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''genres_file'''])
           with open(__SCREAMING_SNAKE_CASE     ,		'''w'''     ,		encoding='''utf-8''') as f:
               f.write(json.dumps(self.genres_encoder     ,		ensure_ascii=__SCREAMING_SNAKE_CASE))

           __a						       =				os.path.join(
               __SCREAMING_SNAKE_CASE     ,		(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''lyrics_file'''])
           with open(__SCREAMING_SNAKE_CASE     ,		'''w'''     ,		encoding='''utf-8''') as f:
               f.write(json.dumps(self.lyrics_encoder     ,		ensure_ascii=__SCREAMING_SNAKE_CASE))

           return (artists_file, genres_file, lyrics_file)





       def 		_lowerCamelCase			(		self							:     str     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     int     ,		__SCREAMING_SNAKE_CASE							:     List[str]):


           '''simple docstring'''

           __a						       =				self.artists_decoder.get(__SCREAMING_SNAKE_CASE)
           __a						       =				[self.genres_decoder.get(__SCREAMING_SNAKE_CASE) for genre in genres_index]
           __a						       =				[self.lyrics_decoder.get(__SCREAMING_SNAKE_CASE) for character in lyric_index]
           return artist, genres, lyrics










from collections import defaultdict
from typing import Optional

from ..image_utils import load_image
from ..utils import (
    add_end_docstrings,
    is_torch_available,
    logging,
    requires_backends,
)
from .base import PIPELINE_INIT_ARGS, ChunkPipeline


if is_torch_available():
 import torch

 from ..models.auto.modeling_auto import MODEL_FOR_MASK_GENERATION_MAPPING

__snake_case						:List[Any]      		=     logging.get_logger(__name__)

@add_end_docstrings(__UpperCAmelCase    )
class     _A       (	__UpperCAmelCase    ):



       def __init__(		self							:     Dict     ,		**__SCREAMING_SNAKE_CASE							:     Tuple):


           '''simple docstring'''

           super().__init__(**__SCREAMING_SNAKE_CASE)
           requires_backends(self     ,		'''vision''')
           requires_backends(self     ,		'''torch''')

           if self.framework != "pt":
               raise ValueError(F'The {self.__class__} is only available in PyTorch.')

           self.check_model_type(__SCREAMING_SNAKE_CASE)



       def 		_lowerCamelCase			(		self							:     Any     ,		**__SCREAMING_SNAKE_CASE							:     Any):


           '''simple docstring'''

           __a						       =				{}
           __a						       =				{}
           __a						       =				{}
           # preprocess args
           if "points_per_batch" in kwargs:
               __a						       =				kwargs['''points_per_batch''']
           if "points_per_crop" in kwargs:
               __a						       =				kwargs['''points_per_crop''']
           if "crops_n_layers" in kwargs:
               __a						       =				kwargs['''crops_n_layers''']
           if "crop_overlap_ratio" in kwargs:
               __a						       =				kwargs['''crop_overlap_ratio''']
           if "crop_n_points_downscale_factor" in kwargs:
               __a						       =				kwargs['''crop_n_points_downscale_factor''']
           # postprocess args
           if "pred_iou_thresh" in kwargs:
               __a						       =				kwargs['''pred_iou_thresh''']
           if "stability_score_offset" in kwargs:
               __a						       =				kwargs['''stability_score_offset''']
           if "mask_threshold" in kwargs:
               __a						       =				kwargs['''mask_threshold''']
           if "stability_score_thresh" in kwargs:
               __a						       =				kwargs['''stability_score_thresh''']
           if "crops_nms_thresh" in kwargs:
               __a						       =				kwargs['''crops_nms_thresh''']
           if "output_rle_mask" in kwargs:
               __a						       =				kwargs['''output_rle_mask''']
           if "output_bboxes_mask" in kwargs:
               __a						       =				kwargs['''output_bboxes_mask''']
           return preprocess_kwargs, forward_params, postprocess_kwargs



       def __call__(		self							:     Union[str, Any]     ,		__SCREAMING_SNAKE_CASE							:     int     ,		*__SCREAMING_SNAKE_CASE							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     Tuple=None     ,		__SCREAMING_SNAKE_CASE							:     Any=None     ,		**__SCREAMING_SNAKE_CASE							:     str):


           '''simple docstring'''

           return super().__call__(__SCREAMING_SNAKE_CASE     ,		*__SCREAMING_SNAKE_CASE     ,		num_workers=__SCREAMING_SNAKE_CASE     ,		batch_size=__SCREAMING_SNAKE_CASE     ,		**__SCREAMING_SNAKE_CASE)



       def 		_lowerCamelCase			(		self							:     Dict     ,		__SCREAMING_SNAKE_CASE							:     str     ,		__SCREAMING_SNAKE_CASE							:     Any=64     ,		__SCREAMING_SNAKE_CASE							:     int = 0     ,		__SCREAMING_SNAKE_CASE							:     float = 512 / 1_500     ,		__SCREAMING_SNAKE_CASE							:     Optional[int] = 32     ,		__SCREAMING_SNAKE_CASE							:     Optional[int] = 1     ,		):


           '''simple docstring'''

           __a						       =				load_image(__SCREAMING_SNAKE_CASE)
           __a						       =				self.image_processor.size['''longest_edge''']
           __a       ,   __a       ,   __a       ,   __a						       =				self.image_processor.generate_crop_boxes(
               __SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)
           __a						       =				self.image_processor(images=__SCREAMING_SNAKE_CASE     ,		return_tensors='''pt''')

           with self.device_placement():
               if self.framework == "pt":
                   __a						       =				self.get_inference_context()
                   with inference_context():
                       __a						       =				self._ensure_tensor_on_device(__SCREAMING_SNAKE_CASE     ,		device=self.device)
                       __a						       =				self.model.get_image_embeddings(model_inputs.pop('''pixel_values'''))
                       __a						       =				image_embeddings

           __a						       =				grid_points.shape[1]
           __a						       =				points_per_batch if points_per_batch is not None else n_points

           if points_per_batch <= 0:
               raise ValueError(
                   '''Cannot have points_per_batch<=0. Must be >=1 to returned batched outputs. '''
                   '''To return all points at once, set points_per_batch to None''')

           for i in range(0     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE):
               __a						       =				grid_points[:, i : i + points_per_batch, :, :]
               __a						       =				input_labels[:, i : i + points_per_batch]
               __a						       =				i == n_points - points_per_batch
               yield {
                   "input_points": batched_points,
                   "input_labels": labels,
                   "input_boxes": crop_boxes,
                   "is_last": is_last,
                   **model_inputs,
               }



       def 		_lowerCamelCase			(		self							:     Any     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     int=0.88     ,		__SCREAMING_SNAKE_CASE							:     List[Any]=0.95     ,		__SCREAMING_SNAKE_CASE							:     List[Any]=0     ,		__SCREAMING_SNAKE_CASE							:     int=1     ,		):


           '''simple docstring'''

           __a						       =				model_inputs.pop('''input_boxes''')
           __a						       =				model_inputs.pop('''is_last''')
           __a						       =				model_inputs.pop('''original_sizes''').tolist()
           __a						       =				model_inputs.pop('''reshaped_input_sizes''').tolist()

           __a						       =				self.model(**__SCREAMING_SNAKE_CASE)

           # post processing happens here in order to avoid CPU GPU copies of ALL the masks
           __a						       =				model_outputs['''pred_masks''']
           __a						       =				self.image_processor.post_process_masks(
               __SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		binarize=__SCREAMING_SNAKE_CASE)
           __a						       =				model_outputs['''iou_scores''']
           __a       ,   __a       ,   __a						       =				self.image_processor.filter_masks(
               masks[0]     ,		iou_scores[0]     ,		original_sizes[0]     ,		input_boxes[0]     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		)
           return {
               "masks": masks,
               "is_last": is_last,
               "boxes": boxes,
               "iou_scores": iou_scores,
           }





       def 		_lowerCamelCase			(		self							:     int     ,		__SCREAMING_SNAKE_CASE							:     Dict     ,		__SCREAMING_SNAKE_CASE							:     Dict=False     ,		__SCREAMING_SNAKE_CASE							:     Tuple=False     ,		__SCREAMING_SNAKE_CASE							:     int=0.7     ,		):


           '''simple docstring'''

           __a						       =				[]
           __a						       =				[]
           __a						       =				[]
           for model_output in model_outputs:
               all_scores.append(model_output.pop('''iou_scores'''))
               all_masks.extend(model_output.pop('''masks'''))
               all_boxes.append(model_output.pop('''boxes'''))

           __a						       =				torch.cat(__SCREAMING_SNAKE_CASE)
           __a						       =				torch.cat(__SCREAMING_SNAKE_CASE)
           __a       ,   __a       ,   __a       ,   __a						       =				self.image_processor.post_process_for_mask_generation(
               __SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)

           __a						       =				defaultdict(__SCREAMING_SNAKE_CASE)
           for output in model_outputs:
               for k, v in output.items():
                   extra[k].append(__SCREAMING_SNAKE_CASE)

           __a						       =				{}
           if output_rle_mask:
               __a						       =				rle_mask

           if output_bboxes_mask:
               __a						       =				bounding_boxes

           return {"masks": output_masks, "scores": iou_scores, **optional, **extra}





