'''simple docstring'''




import copy

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


_A										= logging.get_logger(__name__)

_A										= {
    '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    UpperCAmelCase__	(							lowercase__      ):






   """simple docstring"""
   def __init__(self							,					_a=256							,					_a=1_024							,					_a=16							,					_a=16							,					_a=4							,					_a="gelu"							,					_a=1e-6							,					**_a							,					)     ->  Any:
        super().__init__(**lowerCAmelCase__					)
        lowercase_       :							Dict  					=       hidden_size
        lowercase_       :							Tuple  					=       image_size
        lowercase_       :							Tuple  					=       patch_size
        lowercase_       :							List[Any]  					=       image_size // patch_size
        lowercase_       :							List[Any]  					=       mask_input_channels
        lowercase_       :							Any  					=       num_point_embeddings
        lowercase_       :							List[Any]  					=       hidden_act
        lowercase_       :							Optional[int]  					=       layer_norm_eps



class    UpperCAmelCase__	(							lowercase__      ):






   """simple docstring"""
   def __init__(self							,					_a=256							,					_a="relu"							,					_a=2_048							,					_a=2							,					_a=8							,					_a=2							,					_a=3							,					_a=3							,					_a=256							,					_a=1e-6							,					**_a							,					)     ->  Dict:
        super().__init__(**lowerCAmelCase__					)
        lowercase_       :							List[str]  					=       hidden_size
        lowercase_       :							Dict  					=       hidden_act
        lowercase_       :							List[str]  					=       mlp_dim
        lowercase_       :							Optional[int]  					=       num_hidden_layers
        lowercase_       :							int  					=       num_attention_heads
        lowercase_       :							List[Any]  					=       attention_downsample_rate
        lowercase_       :							Dict  					=       num_multimask_outputs
        lowercase_       :							Optional[Any]  					=       iou_head_depth
        lowercase_       :							Any  					=       iou_head_hidden_dim
        lowercase_       :							Tuple  					=       layer_norm_eps



class    UpperCAmelCase__	(							lowercase__      ):






   """simple docstring"""
   def __init__(self							,					_a=768							,					_a=256							,					_a=12							,					_a=12							,					_a=3							,					_a=1_024							,					_a=16							,					_a="gelu"							,					_a=1e-06							,					_a=0.0							,					_a=1e-10							,					_a=True							,					_a=4.0							,					_a=True							,					_a=True							,					_a=14							,					_a=[2, 5, 8, 11]							,					_a=128							,					_a=None							,					**_a							,					)     ->  int:
        super().__init__(**lowerCAmelCase__					)

        lowercase_       :							Any  					=       hidden_size
        lowercase_       :							List[str]  					=       output_channels
        lowercase_       :							Union[str, Any]  					=       num_hidden_layers
        lowercase_       :							Union[str, Any]  					=       num_attention_heads
        lowercase_       :							str  					=       num_channels
        lowercase_       :							List[Any]  					=       image_size
        lowercase_       :							List[str]  					=       patch_size
        lowercase_       :							Optional[int]  					=       hidden_act
        lowercase_       :							Optional[int]  					=       layer_norm_eps
        lowercase_       :							List[str]  					=       attention_dropout
        lowercase_       :							Any  					=       initializer_range
        lowercase_       :							int  					=       qkv_bias
        lowercase_       :							Optional[int]  					=       mlp_ratio
        lowercase_       :							Optional[int]  					=       use_abs_pos
        lowercase_       :							int  					=       use_rel_pos
        lowercase_       :							Dict  					=       window_size
        lowercase_       :							str  					=       global_attn_indexes
        lowercase_       :							List[str]  					=       num_pos_feats
        lowercase_       :							Tuple  					=       int(hidden_size * mlp_ratio					) if mlp_dim is None else mlp_dim



class    UpperCAmelCase__	(							lowercase__      ):






   """simple docstring"""
   A				:							Optional[Any]			     =     '''sam'''
   A				:							Optional[Any]			     =     True
   def __init__(self							,					_a=None							,					_a=None							,					_a=None							,					_a=0.02							,					**_a							,					)     ->  List[str]:
        super().__init__(**lowerCAmelCase__					)
        lowercase_       :							int  					=       vision_config if vision_config is not None else {}
        lowercase_       :							Optional[Any]  					=       prompt_encoder_config if prompt_encoder_config is not None else {}
        lowercase_       :							int  					=       mask_decoder_config if mask_decoder_config is not None else {}

        if isinstance(lowerCAmelCase__							,					lowerCAmelCase__					):
             lowercase_       :							Union[str, Any]  					=       vision_config.to_dict()
        if isinstance(lowerCAmelCase__							,					lowerCAmelCase__					):
             lowercase_       :							Tuple  					=       prompt_encoder_config.to_dict()
        if isinstance(lowerCAmelCase__							,					lowerCAmelCase__					):
             lowercase_       :							List[Any]  					=       mask_decoder_config.to_dict()

        lowercase_       :							str  					=       SamVisionConfig(**lowerCAmelCase__					)
        lowercase_       :							Tuple  					=       SamPromptEncoderConfig(**lowerCAmelCase__					)
        lowercase_       :							List[Any]  					=       SamMaskDecoderConfig(**lowerCAmelCase__					)
        lowercase_       :							Dict  					=       initializer_range





   def 		_lowerCamelCase			(self					)     ->  List[str]:
        lowercase_       :							Optional[Any]  					=       copy.deepcopy(self.__dict__					)
        lowercase_       :							Optional[Any]  					=       self.vision_config.to_dict()
        lowercase_       :							List[Any]  					=       self.prompt_encoder_config.to_dict()
        lowercase_       :							Optional[int]  					=       self.mask_decoder_config.to_dict()
        lowercase_       :							Optional[Any]  					=       self.__class__.model_type
        return output












# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
__UpperCAmelCase      =				abspath(join(dirname(dirname(dirname(__file__))), "src"))
sys.path.insert(1, git_repo_path)


# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action="ignore", category=FutureWarning)





def 						A_					(						lowercase_			)				->str:







 """simple docstring"""

 from transformers.testing_utils import pytest_addoption_shared

 pytest_addoption_shared(lowercase_			)





def 						A_					(						lowercase_			)				->Tuple:







 """simple docstring"""

 from transformers.testing_utils import pytest_terminal_summary_main

 SCREAMING_SNAKE_CASE				    =		terminalreporter.config.getoption('--make-reports'			)
 if make_reports:
  pytest_terminal_summary_main(lowercase_	,  id=lowercase_			)




