

'''simple docstring'''





import copy

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


_lowerCAmelCase      :    Dict						       =    logging.get_logger(__name__)

_lowerCAmelCase      :    Tuple						       =    {
    '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 			__magic_name__					(    lowercase_   ):





			def __init__(	self      ,						__snake_case=256      ,						__snake_case=1024      ,						__snake_case=16      ,						__snake_case=16      ,						__snake_case=4      ,						__snake_case="gelu"      ,						__snake_case=1e-6      ,						**__snake_case      ,						)     ->				int:




						'''simple docstring'''
						super().__init__(**__snake_case      )
						__a						   =hidden_size
						__a						   =image_size
						__a						   =patch_size
						__a						   =image_size // patch_size
						__a						   =mask_input_channels
						__a						   =num_point_embeddings
						__a						   =hidden_act
						__a						   =layer_norm_eps






class 			__magic_name__					(    lowercase_   ):





			def __init__(	self      ,						__snake_case=256      ,						__snake_case="relu"      ,						__snake_case=2048      ,						__snake_case=2      ,						__snake_case=8      ,						__snake_case=2      ,						__snake_case=3      ,						__snake_case=3      ,						__snake_case=256      ,						__snake_case=1e-6      ,						**__snake_case      ,						)     ->				Optional[Any]:




						'''simple docstring'''
						super().__init__(**__snake_case      )
						__a						   =hidden_size
						__a						   =hidden_act
						__a						   =mlp_dim
						__a						   =num_hidden_layers
						__a						   =num_attention_heads
						__a						   =attention_downsample_rate
						__a						   =num_multimask_outputs
						__a						   =iou_head_depth
						__a						   =iou_head_hidden_dim
						__a						   =layer_norm_eps






class 			__magic_name__					(    lowercase_   ):





			def __init__(	self      ,						__snake_case=768      ,						__snake_case=256      ,						__snake_case=12      ,						__snake_case=12      ,						__snake_case=3      ,						__snake_case=1024      ,						__snake_case=16      ,						__snake_case="gelu"      ,						__snake_case=1e-06      ,						__snake_case=0.0      ,						__snake_case=1e-10      ,						__snake_case=True      ,						__snake_case=4.0      ,						__snake_case=True      ,						__snake_case=True      ,						__snake_case=14      ,						__snake_case=[2, 5, 8, 11]      ,						__snake_case=128      ,						__snake_case=None      ,						**__snake_case      ,						)     ->				Any:




						'''simple docstring'''
						super().__init__(**__snake_case      )

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






class 			__magic_name__					(    lowercase_   ):
			SCREAMING_SNAKE_CASE							     =		"""sam"""
			SCREAMING_SNAKE_CASE							     =		True





			def __init__(	self      ,						__snake_case=None      ,						__snake_case=None      ,						__snake_case=None      ,						__snake_case=0.02      ,						**__snake_case      ,						)     ->				Any:




						'''simple docstring'''
						super().__init__(**__snake_case      )
						__a						   =vision_config if vision_config is not None else {}
						__a						   =prompt_encoder_config if prompt_encoder_config is not None else {}
						__a						   =mask_decoder_config if mask_decoder_config is not None else {}

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

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





			def 	__magic_name__					(	self      )     ->				Optional[int]:




						'''simple docstring'''
						__a						   =copy.deepcopy(self.__dict__      )
						__a						   =self.vision_config.to_dict()
						__a						   =self.prompt_encoder_config.to_dict()
						__a						   =self.mask_decoder_config.to_dict()
						__a						   =self.__class__.model_type
						return output









import os
import sys
import time

from . import transposition_cipher as trans_cipher






def  UpperCamelCase_(							):




			"""simple docstring"""






			__a						   ='Prehistoric Men.txt'
			__a						   ='Output.txt'
			__a						   =int(input('Enter key: '			)			)
			__a						   =input('Encrypt/Decrypt [e/d]: '			)

			if not os.path.exists(_snake_case			):
						print(F'File {input_file} does not exist. Quitting...'			)
						sys.exit()
			if os.path.exists(_snake_case			):
						print(F'Overwrite {output_file}? [y/n]'			)
						__a						   =input('> '			)
						if not response.lower().startswith('y'			):
									sys.exit()

			__a						   =time.time()
			if mode.lower().startswith('e'			):
						with open(_snake_case			) as f:
									__a						   =f.read()
						__a						   =trans_cipher.encrypt_message(_snake_case ,  _snake_case			)
			elif mode.lower().startswith('d'			):
						with open(_snake_case			) as f:
									__a						   =f.read()
						__a						   =trans_cipher.decrypt_message(_snake_case ,  _snake_case			)

			with open(_snake_case ,  'w'			) as output_obj:
						output_obj.write(_snake_case			)

			__a						   =round(time.time() - start_time ,  2			)
			print(('Done (', total_time, 'seconds )')			)


if __name__ == "__main__":
						main()






