


'''simple docstring'''




import collections
import types

import numpy as np

from ..utils import (
    add_end_docstrings,
    is_tensorflow_probability_available,
    is_tf_available,
    is_torch_available,
    requires_backends,
)
from .base import PIPELINE_INIT_ARGS, ArgumentHandler, Dataset, Pipeline, PipelineException


if is_torch_available():
       import torch

       from ..models.auto.modeling_auto import (
           MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
           MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING,
       )

if is_tf_available() and is_tensorflow_probability_available():
       import tensorflow as tf
       import tensorflow_probability as tfp

       from ..models.auto.modeling_tf_auto import (
           TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
           TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING,
       )




class  _lowercase   (  __lowercase       ):
   def __call__(	self					:			Union[str, Any]					,      SCREAMING_SNAKE_CASE_					:			Any=None					,      SCREAMING_SNAKE_CASE_					:			List[str]=None					,      **SCREAMING_SNAKE_CASE_					:			Optional[int]			)   ->       Tuple:
        # Returns tqa_pipeline_inputs of shape:
        # [
        #   {"table": pd.DataFrame, "query": List[str]},
        #   ...,
        #   {"table": pd.DataFrame, "query" : List[str]}
        # ]
        requires_backends(self					,      'pandas'			)
        import pandas as pd

        if table is None:
             raise ValueError('Keyword argument `table` cannot be None.'			)
        elif query is None:
             if isinstance(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			) and table.get('query'			) is not None and table.get('table'			) is not None:
                  __snake_case    			=	[table]
             elif isinstance(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			) and len(SCREAMING_SNAKE_CASE_			) > 0:
                  if not all(isinstance(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			) for d in table			):
                       raise ValueError(
                           f'Keyword argument `table` should be a list of dict, but is {(type(SCREAMING_SNAKE_CASE_			) for d in table)}'			)

                  if table[0].get('query'			) is not None and table[0].get('table'			) is not None:
                       __snake_case    			=	table
                  else:
                       raise ValueError(
                           'If keyword argument `table` is a list of dictionaries, each dictionary should have a `table`'
                           f' and `query` key, but only dictionary has keys {table[0].keys()} `table` and `query` keys.'			)
             elif Dataset is not None and isinstance(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			) or isinstance(SCREAMING_SNAKE_CASE_					,      types.GeneratorType			):
                  return table
             else:
                  raise ValueError(
                      'Invalid input. Keyword argument `table` should be either of type `dict` or `list`, but '
                      f'is {type(SCREAMING_SNAKE_CASE_			)})'			)
        else:
             __snake_case    			=	[{'table': table, 'query': query}]

        for tqa_pipeline_input in tqa_pipeline_inputs:
             if not isinstance(tqa_pipeline_input['table']					,      pd.DataFrame			):
                  if tqa_pipeline_input["table"] is None:
                       raise ValueError('Table cannot be None.'			)

                  __snake_case    			=	pd.DataFrame(tqa_pipeline_input['table']			)

        return tqa_pipeline_inputs




@add_end_docstrings(__lowercase       )
class  _lowercase   (  __lowercase       ):
   _SCREAMING_SNAKE_CASE     :     Any									=  "table,query"
   def __init__(	self					:			List[str]					,      SCREAMING_SNAKE_CASE_					:			List[str]=TableQuestionAnsweringArgumentHandler()					,      *SCREAMING_SNAKE_CASE_					:			str					,      **SCREAMING_SNAKE_CASE_					:			List[Any]			)   ->       int:
        super().__init__(*SCREAMING_SNAKE_CASE_					,      **SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	args_parser

        self.check_model_type(
            dict(
                TF_MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING.items()
                + TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING.items()			)
            if self.framework == 'tf'
            else dict(
                MODEL_FOR_TABLE_QUESTION_ANSWERING_MAPPING.items() + MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING.items()			)			)

        __snake_case    			=	bool(getattr(self.model.config					,      'aggregation_labels'					,      SCREAMING_SNAKE_CASE_			)			) and bool(
            getattr(self.model.config					,      'num_aggregation_labels'					,      SCREAMING_SNAKE_CASE_			)			)
        __snake_case    			=	'tapas' if hasattr(self.model.config					,      'aggregation_labels'			) else None
   def a     (	self					:			Tuple					,      **SCREAMING_SNAKE_CASE_					:			Optional[Any]			)   ->       int:
        return self.model(**SCREAMING_SNAKE_CASE_			)
   def a     (	self					:			Tuple					,      **SCREAMING_SNAKE_CASE_					:			Union[str, Any]			)   ->       Optional[int]:
        if self.framework == "pt":
             __snake_case    			=	[]
             __snake_case    			=	[]
             __snake_case    			=	None
             __snake_case    			=	inputs['input_ids'].shape[0]

             __snake_case    			=	inputs['input_ids'].to(self.device			)
             __snake_case    			=	inputs['attention_mask'].to(self.device			)
             __snake_case    			=	inputs['token_type_ids'].to(self.device			)
             __snake_case    			=	None

             for index in range(SCREAMING_SNAKE_CASE_			):
                  # If sequences have already been processed, the token type IDs will be created according to the previous
                  # answer.
                  if prev_answers is not None:
                       __snake_case    			=	token_type_ids_example[:, 3]  # shape (seq_len,)
                       __snake_case    			=	np.zeros_like(prev_labels_example.cpu().numpy()			)  # shape (seq_len,)

                       __snake_case    			=	token_type_ids[index]  # shape (seq_len, 7)
                       for i in range(model_labels.shape[0]			):
                            __snake_case    			=	token_type_ids_example[:, 0].tolist()[i]
                            __snake_case    			=	token_type_ids_example[:, 1].tolist()[i] - 1
                            __snake_case    			=	token_type_ids_example[:, 2].tolist()[i] - 1

                            if row_id >= 0 and col_id >= 0 and segment_id == 1:
                                 __snake_case    			=	int(prev_answers[(col_id, row_id)]			)

                       __snake_case    			=	torch.from_numpy(SCREAMING_SNAKE_CASE_			).type(torch.long			).to(self.device			)

                  __snake_case    			=	input_ids[index]
                  __snake_case    			=	attention_mask[index]  # shape (seq_len,)
                  __snake_case    			=	token_type_ids[index]  # shape (seq_len, 7)
                  __snake_case    			=	self.model(
                      input_ids=input_ids_example.unsqueeze(0			)					,      attention_mask=attention_mask_example.unsqueeze(0			)					,      token_type_ids=token_type_ids_example.unsqueeze(0			)					,      )
                  __snake_case    			=	outputs.logits

                  if self.aggregate:
                       all_aggregations.append(outputs.logits_aggregation			)

                  all_logits.append(SCREAMING_SNAKE_CASE_			)

                  __snake_case    			=	torch.distributions.Bernoulli(logits=SCREAMING_SNAKE_CASE_			)
                  __snake_case    			=	dist_per_token.probs * attention_mask_example.type(torch.floataa			).to(
                      dist_per_token.probs.device			)

                  __snake_case    			=	collections.defaultdict(SCREAMING_SNAKE_CASE_			)
                  for i, p in enumerate(probabilities.squeeze().tolist()			):
                       __snake_case    			=	token_type_ids_example[:, 0].tolist()[i]
                       __snake_case    			=	token_type_ids_example[:, 1].tolist()[i] - 1
                       __snake_case    			=	token_type_ids_example[:, 2].tolist()[i] - 1
                       if col >= 0 and row >= 0 and segment_id == 1:
                            coords_to_probs[(col, row)].append(SCREAMING_SNAKE_CASE_			)

                  __snake_case    			=	{key: np.array(coords_to_probs[key]			).mean() > 0.5 for key in coords_to_probs}

             __snake_case    			=	torch.cat(tuple(SCREAMING_SNAKE_CASE_			)					,      0			)

             return (logits_batch,) if not self.aggregate else (logits_batch, torch.cat(tuple(SCREAMING_SNAKE_CASE_			)					,      0			))
        else:
             __snake_case    			=	[]
             __snake_case    			=	[]
             __snake_case    			=	None
             __snake_case    			=	inputs['input_ids'].shape[0]

             __snake_case    			=	inputs['input_ids']
             __snake_case    			=	inputs['attention_mask']
             __snake_case    			=	inputs['token_type_ids'].numpy()
             __snake_case    			=	None

             for index in range(SCREAMING_SNAKE_CASE_			):
                  # If sequences have already been processed, the token type IDs will be created according to the previous
                  # answer.
                  if prev_answers is not None:
                       __snake_case    			=	token_type_ids_example[:, 3]  # shape (seq_len,)
                       __snake_case    			=	np.zeros_like(SCREAMING_SNAKE_CASE_					,      dtype=np.intaa			)  # shape (seq_len,)

                       __snake_case    			=	token_type_ids[index]  # shape (seq_len, 7)
                       for i in range(model_labels.shape[0]			):
                            __snake_case    			=	token_type_ids_example[:, 0].tolist()[i]
                            __snake_case    			=	token_type_ids_example[:, 1].tolist()[i] - 1
                            __snake_case    			=	token_type_ids_example[:, 2].tolist()[i] - 1

                            if row_id >= 0 and col_id >= 0 and segment_id == 1:
                                 __snake_case    			=	int(prev_answers[(col_id, row_id)]			)

                       __snake_case    			=	model_labels

                  __snake_case    			=	input_ids[index]
                  __snake_case    			=	attention_mask[index]  # shape (seq_len,)
                  __snake_case    			=	token_type_ids[index]  # shape (seq_len, 7)
                  __snake_case    			=	self.model(
                      input_ids=np.expand_dims(SCREAMING_SNAKE_CASE_					,      axis=0			)					,      attention_mask=np.expand_dims(SCREAMING_SNAKE_CASE_					,      axis=0			)					,      token_type_ids=np.expand_dims(SCREAMING_SNAKE_CASE_					,      axis=0			)					,      )
                  __snake_case    			=	outputs.logits

                  if self.aggregate:
                       all_aggregations.append(outputs.logits_aggregation			)

                  all_logits.append(SCREAMING_SNAKE_CASE_			)

                  __snake_case    			=	tfp.distributions.Bernoulli(logits=SCREAMING_SNAKE_CASE_			)
                  __snake_case    			=	dist_per_token.probs_parameter() * tf.cast(SCREAMING_SNAKE_CASE_					,      tf.floataa			)

                  __snake_case    			=	collections.defaultdict(SCREAMING_SNAKE_CASE_			)
                  __snake_case    			=	token_type_ids_example
                  for i, p in enumerate(tf.squeeze(SCREAMING_SNAKE_CASE_			).numpy().tolist()			):
                       __snake_case    			=	token_type_ids_example[:, 0].tolist()[i]
                       __snake_case    			=	token_type_ids_example[:, 1].tolist()[i] - 1
                       __snake_case    			=	token_type_ids_example[:, 2].tolist()[i] - 1
                       if col >= 0 and row >= 0 and segment_id == 1:
                            coords_to_probs[(col, row)].append(SCREAMING_SNAKE_CASE_			)

                  __snake_case    			=	{key: np.array(coords_to_probs[key]			).mean() > 0.5 for key in coords_to_probs}

             __snake_case    			=	tf.concat(tuple(SCREAMING_SNAKE_CASE_			)					,      0			)

             return (logits_batch,) if not self.aggregate else (logits_batch, tf.concat(tuple(SCREAMING_SNAKE_CASE_			)					,      0			))
   def __call__(	self					:			int					,      *SCREAMING_SNAKE_CASE_					:			Any					,      **SCREAMING_SNAKE_CASE_					:			Optional[Any]			)   ->       List[Any]:
        __snake_case    			=	self._args_parser(*SCREAMING_SNAKE_CASE_					,      **SCREAMING_SNAKE_CASE_			)

        __snake_case    			=	super().__call__(SCREAMING_SNAKE_CASE_					,      **SCREAMING_SNAKE_CASE_			)
        if len(SCREAMING_SNAKE_CASE_			) == 1:
             return results[0]
        return results
   def a     (	self					:			Any					,      SCREAMING_SNAKE_CASE_					:			Union[str, Any]=None					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=None					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=None					,      **SCREAMING_SNAKE_CASE_					:			str			)   ->       Optional[Any]:
        __snake_case    			=	{}
        if padding is not None:
             __snake_case    			=	padding
        if truncation is not None:
             __snake_case    			=	truncation

        __snake_case    			=	{}
        if sequential is not None:
             __snake_case    			=	sequential
        return preprocess_params, forward_params, {}
   def a     (	self					:			int					,      SCREAMING_SNAKE_CASE_					:			Union[str, Any]					,      SCREAMING_SNAKE_CASE_					:			List[Any]=None					,      SCREAMING_SNAKE_CASE_					:			Optional[Any]=True					,      SCREAMING_SNAKE_CASE_					:			Dict=None			)   ->       Tuple:
        if truncation is None:
             if self.type == "tapas":
                  __snake_case    			=	'drop_rows_to_fit'
             else:
                  __snake_case    			=	'do_not_truncate'

        __snake_case			,					__snake_case    			=	pipeline_input['table'], pipeline_input['query']
        if table.empty:
             raise ValueError('table is empty'			)
        if query is None or query == "":
             raise ValueError('query is empty'			)
        __snake_case    			=	self.tokenizer(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_					,      return_tensors=self.framework					,      truncation=SCREAMING_SNAKE_CASE_					,      padding=SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	table
        return inputs
   def a     (	self					:			Tuple					,      SCREAMING_SNAKE_CASE_					:			int					,      SCREAMING_SNAKE_CASE_					:			int=False			)   ->       Optional[Any]:
        __snake_case    			=	model_inputs.pop('table'			)

        if self.type == "tapas":
             if sequential:
                  __snake_case    			=	self.sequential_inference(**SCREAMING_SNAKE_CASE_			)
             else:
                  __snake_case    			=	self.batch_inference(**SCREAMING_SNAKE_CASE_			)
        else:
             __snake_case    			=	self.model.generate(**SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	{'model_inputs': model_inputs, 'table': table, 'outputs': outputs}
        return model_outputs





   def a     (	self					:			Optional[int]					,      SCREAMING_SNAKE_CASE_					:			Union[str, Any]			)   ->       Any:
        __snake_case    			=	model_outputs['model_inputs']
        __snake_case    			=	model_outputs['table']
        __snake_case    			=	model_outputs['outputs']
        if self.type == "tapas":
             if self.aggregate:
                  __snake_case			,					__snake_case    			=	outputs[:2]
                  __snake_case    			=	self.tokenizer.convert_logits_to_predictions(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			)
                  __snake_case			,					__snake_case    			=	predictions
                  __snake_case    			=	{i: self.model.config.aggregation_labels[pred] for i, pred in enumerate(SCREAMING_SNAKE_CASE_			)}

                  __snake_case    			=	self.model.config.no_aggregation_label_index
                  __snake_case    			=	{
                      i: aggregators[i] + ' > ' for i, pred in enumerate(SCREAMING_SNAKE_CASE_			) if pred != no_agg_label_index
                  }
             else:
                  __snake_case    			=	outputs[0]
                  __snake_case    			=	self.tokenizer.convert_logits_to_predictions(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			)
                  __snake_case    			=	predictions[0]
                  __snake_case    			=	{}
                  __snake_case    			=	{}
             __snake_case    			=	[]
             for index, coordinates in enumerate(SCREAMING_SNAKE_CASE_			):
                  __snake_case    			=	[table.iat[coordinate] for coordinate in coordinates]
                  __snake_case    			=	aggregators.get(SCREAMING_SNAKE_CASE_					,      ''			)
                  __snake_case    			=	aggregators_prefix.get(SCREAMING_SNAKE_CASE_					,      ''			)
                  __snake_case    			=	{
                      'answer': aggregator_prefix + ', '.join(SCREAMING_SNAKE_CASE_			),
                      'coordinates': coordinates,
                      'cells': [table.iat[coordinate] for coordinate in coordinates],
                  }
                  if aggregator:
                       __snake_case    			=	aggregator

                  answers.append(SCREAMING_SNAKE_CASE_			)
             if len(SCREAMING_SNAKE_CASE_			) == 0:
                  raise PipelineException('Empty answer'			)
        else:
             __snake_case    			=	[{'answer': answer} for answer in self.tokenizer.batch_decode(SCREAMING_SNAKE_CASE_					,      skip_special_tokens=SCREAMING_SNAKE_CASE_			)]

        return answers if len(SCREAMING_SNAKE_CASE_			) > 1 else answers[0]








'''simple docstring'''




import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging


_a      :      List[str]       				=      logging.get_logger(__name__)

_a      :      Any       				=      {
    "facebook/sam-vit-huge": "https://huggingface.co/facebook/sam-vit-huge/resolve/main/config.json",
    "facebook/sam-vit-large": "https://huggingface.co/facebook/sam-vit-large/resolve/main/config.json",
    "facebook/sam-vit-base": "https://huggingface.co/facebook/sam-vit-base/resolve/main/config.json",
}




class  _lowercase   (  __lowercase       ):
   def __init__(	self					:			int					,      SCREAMING_SNAKE_CASE_					:			List[Any]=256					,      SCREAMING_SNAKE_CASE_					:			Optional[Any]=1024					,      SCREAMING_SNAKE_CASE_					:			Any=16					,      SCREAMING_SNAKE_CASE_					:			int=16					,      SCREAMING_SNAKE_CASE_					:			List[Any]=4					,      SCREAMING_SNAKE_CASE_					:			Optional[Any]="gelu"					,      SCREAMING_SNAKE_CASE_					:			Tuple=1e-6					,      **SCREAMING_SNAKE_CASE_					:			Optional[Any]					,      )   ->       Tuple:
        super().__init__(**SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	hidden_size
        __snake_case    			=	image_size
        __snake_case    			=	patch_size
        __snake_case    			=	image_size // patch_size
        __snake_case    			=	mask_input_channels
        __snake_case    			=	num_point_embeddings
        __snake_case    			=	hidden_act
        __snake_case    			=	layer_norm_eps




class  _lowercase   (  __lowercase       ):
   def __init__(	self					:			List[Any]					,      SCREAMING_SNAKE_CASE_					:			List[Any]=256					,      SCREAMING_SNAKE_CASE_					:			Dict="relu"					,      SCREAMING_SNAKE_CASE_					:			Any=2048					,      SCREAMING_SNAKE_CASE_					:			int=2					,      SCREAMING_SNAKE_CASE_					:			Optional[Any]=8					,      SCREAMING_SNAKE_CASE_					:			int=2					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=3					,      SCREAMING_SNAKE_CASE_					:			str=3					,      SCREAMING_SNAKE_CASE_					:			Optional[Any]=256					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=1e-6					,      **SCREAMING_SNAKE_CASE_					:			int					,      )   ->       str:
        super().__init__(**SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	hidden_size
        __snake_case    			=	hidden_act
        __snake_case    			=	mlp_dim
        __snake_case    			=	num_hidden_layers
        __snake_case    			=	num_attention_heads
        __snake_case    			=	attention_downsample_rate
        __snake_case    			=	num_multimask_outputs
        __snake_case    			=	iou_head_depth
        __snake_case    			=	iou_head_hidden_dim
        __snake_case    			=	layer_norm_eps




class  _lowercase   (  __lowercase       ):
   def __init__(	self					:			Union[str, Any]					,      SCREAMING_SNAKE_CASE_					:			int=768					,      SCREAMING_SNAKE_CASE_					:			int=256					,      SCREAMING_SNAKE_CASE_					:			str=12					,      SCREAMING_SNAKE_CASE_					:			Tuple=12					,      SCREAMING_SNAKE_CASE_					:			Optional[Any]=3					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=1024					,      SCREAMING_SNAKE_CASE_					:			List[str]=16					,      SCREAMING_SNAKE_CASE_					:			Optional[Any]="gelu"					,      SCREAMING_SNAKE_CASE_					:			Any=1e-06					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=0.0					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=1e-10					,      SCREAMING_SNAKE_CASE_					:			List[Any]=True					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=4.0					,      SCREAMING_SNAKE_CASE_					:			List[Any]=True					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=True					,      SCREAMING_SNAKE_CASE_					:			Union[str, Any]=14					,      SCREAMING_SNAKE_CASE_					:			str=[2, 5, 8, 11]					,      SCREAMING_SNAKE_CASE_					:			Optional[int]=128					,      SCREAMING_SNAKE_CASE_					:			Tuple=None					,      **SCREAMING_SNAKE_CASE_					:			List[Any]					,      )   ->       Optional[Any]:
        super().__init__(**SCREAMING_SNAKE_CASE_			)

        __snake_case    			=	hidden_size
        __snake_case    			=	output_channels
        __snake_case    			=	num_hidden_layers
        __snake_case    			=	num_attention_heads
        __snake_case    			=	num_channels
        __snake_case    			=	image_size
        __snake_case    			=	patch_size
        __snake_case    			=	hidden_act
        __snake_case    			=	layer_norm_eps
        __snake_case    			=	attention_dropout
        __snake_case    			=	initializer_range
        __snake_case    			=	qkv_bias
        __snake_case    			=	mlp_ratio
        __snake_case    			=	use_abs_pos
        __snake_case    			=	use_rel_pos
        __snake_case    			=	window_size
        __snake_case    			=	global_attn_indexes
        __snake_case    			=	num_pos_feats
        __snake_case    			=	int(hidden_size * mlp_ratio			) if mlp_dim is None else mlp_dim




class  _lowercase   (  __lowercase       ):
   _SCREAMING_SNAKE_CASE     :     Union[str, Any]									=  "sam"
   _SCREAMING_SNAKE_CASE     :     Any									=  True
   def __init__(	self					:			Optional[Any]					,      SCREAMING_SNAKE_CASE_					:			Dict=None					,      SCREAMING_SNAKE_CASE_					:			List[Any]=None					,      SCREAMING_SNAKE_CASE_					:			List[str]=None					,      SCREAMING_SNAKE_CASE_					:			str=0.0_2					,      **SCREAMING_SNAKE_CASE_					:			str					,      )   ->       str:
        super().__init__(**SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	vision_config if vision_config is not None else {}
        __snake_case    			=	prompt_encoder_config if prompt_encoder_config is not None else {}
        __snake_case    			=	mask_decoder_config if mask_decoder_config is not None else {}

        if isinstance(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			):
             __snake_case    			=	vision_config.to_dict()
        if isinstance(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			):
             __snake_case    			=	prompt_encoder_config.to_dict()
        if isinstance(SCREAMING_SNAKE_CASE_					,      SCREAMING_SNAKE_CASE_			):
             __snake_case    			=	mask_decoder_config.to_dict()

        __snake_case    			=	SamVisionConfig(**SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	SamPromptEncoderConfig(**SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	SamMaskDecoderConfig(**SCREAMING_SNAKE_CASE_			)
        __snake_case    			=	initializer_range





   def a     (	self					:			int			)   ->       str:
        __snake_case    			=	copy.deepcopy(self.__dict__			)
        __snake_case    			=	self.vision_config.to_dict()
        __snake_case    			=	self.prompt_encoder_config.to_dict()
        __snake_case    			=	self.mask_decoder_config.to_dict()
        __snake_case    			=	self.__class__.model_type
        return output




