"""simple docstring"""






import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..bit import BitConfig


lowerCAmelCase__						:						Any		  =			logging.get_logger(__name__)

lowerCAmelCase__						:						str		  =			{
    'Intel/dpt-large': 'https://huggingface.co/Intel/dpt-large/resolve/main/config.json',
    # See all DPT models at https://huggingface.co/models?filter=dpt
}
class        snake_case (				__UpperCAmelCase       ):




					"""simple docstring"""

					snake_case__       					=				"dpt"







					def __init__(       self     :			List[str]					,lowerCamelCase__     :			int=768					,lowerCamelCase__     :			List[Any]=12					,lowerCamelCase__     :			Union[str, Any]=12					,lowerCamelCase__     :			List[Any]=3_072					,lowerCamelCase__     :			List[str]="gelu"					,lowerCamelCase__     :			Optional[Any]=0.0					,lowerCamelCase__     :			Union[str, Any]=0.0					,lowerCamelCase__     :			Any=0.0_2					,lowerCamelCase__     :			Dict=1e-12					,lowerCamelCase__     :			Union[str, Any]=384					,lowerCamelCase__     :			str=16					,lowerCamelCase__     :			int=3					,lowerCamelCase__     :			List[Any]=False					,lowerCamelCase__     :			List[Any]=True					,lowerCamelCase__     :			Optional[int]=[2, 5, 8, 11]					,lowerCamelCase__     :			Union[str, Any]="project"					,lowerCamelCase__     :			str=[4, 2, 1, 0.5]					,lowerCamelCase__     :			str=[96, 192, 384, 768]					,lowerCamelCase__     :			Optional[int]=256					,lowerCamelCase__     :			Tuple=-1					,lowerCamelCase__     :			Optional[Any]=False					,lowerCamelCase__     :			Union[str, Any]=True					,lowerCamelCase__     :			Optional[int]=0.4					,lowerCamelCase__     :			Any=255					,lowerCamelCase__     :			List[Any]=0.1					,lowerCamelCase__     :			List[Any]=[1, 1_024, 24, 24]					,lowerCamelCase__     :			Any=[0, 1]					,lowerCamelCase__     :			List[Any]=None					,**lowerCamelCase__     :			List[str]					,):
									super().__init__(**lowerCamelCase__    )

									UpperCAmelCase__    =							hidden_size
									UpperCAmelCase__    =							is_hybrid

									if self.is_hybrid:
													if backbone_config is None:
																	logger.info('Initializing the config with a `BiT` backbone.'    )
																	UpperCAmelCase__    =							{
																	    'global_padding': 'same',
																	    'layer_type': 'bottleneck',
																	    'depths': [3, 4, 9],
																	    'out_features': ['stage1', 'stage2', 'stage3'],
																	    'embedding_dynamic_padding': True,
																	}
																	UpperCAmelCase__    =							BitConfig(**lowerCamelCase__    )
													elif isinstance(lowerCamelCase__					,lowerCamelCase__    ):
																	logger.info('Initializing the config with a `BiT` backbone.'    )
																	UpperCAmelCase__    =							BitConfig(**lowerCamelCase__    )
													elif isinstance(lowerCamelCase__					,lowerCamelCase__    ):
																	UpperCAmelCase__    =							backbone_config
													else:
																	raise ValueError(
																	    f'''backbone_config must be a dictionary or a `PretrainedConfig`, got {backbone_config.__class__}.'''    )

													UpperCAmelCase__    =							backbone_featmap_shape
													UpperCAmelCase__    =							neck_ignore_stages

													if readout_type != "project":
																	raise ValueError('Readout type must be \'project\' when using `DPT-hybrid` mode.'    )
									else:
													UpperCAmelCase__    =							None
													UpperCAmelCase__    =							None
													UpperCAmelCase__    =							[]

									UpperCAmelCase__    =							num_hidden_layers
									UpperCAmelCase__    =							num_attention_heads
									UpperCAmelCase__    =							intermediate_size
									UpperCAmelCase__    =							hidden_act
									UpperCAmelCase__    =							hidden_dropout_prob
									UpperCAmelCase__    =							attention_probs_dropout_prob
									UpperCAmelCase__    =							initializer_range
									UpperCAmelCase__    =							layer_norm_eps
									UpperCAmelCase__    =							image_size
									UpperCAmelCase__    =							patch_size
									UpperCAmelCase__    =							num_channels
									UpperCAmelCase__    =							qkv_bias
									UpperCAmelCase__    =							backbone_out_indices
									if readout_type not in ["ignore", "add", "project"]:
													raise ValueError('Readout_type must be one of [\'ignore\', \'add\', \'project\']'    )
									UpperCAmelCase__    =							readout_type
									UpperCAmelCase__    =							reassemble_factors
									UpperCAmelCase__    =							neck_hidden_sizes
									UpperCAmelCase__    =							fusion_hidden_size
									UpperCAmelCase__    =							head_in_index
									UpperCAmelCase__    =							use_batch_norm_in_fusion_residual
									# auxiliary head attributes (semantic segmentation)
									UpperCAmelCase__    =							use_auxiliary_head
									UpperCAmelCase__    =							auxiliary_loss_weight
									UpperCAmelCase__    =							semantic_loss_ignore_index
									UpperCAmelCase__    =							semantic_classifier_dropout







					def 	__lowerCAmelCase		(       self     :			Optional[Any]    ):
									UpperCAmelCase__    =							copy.deepcopy(self.__dict__    )

									if output["backbone_config"] is not None:
													UpperCAmelCase__    =							self.backbone_config.to_dict()

									UpperCAmelCase__    =							self.__class__.model_type
									return output




"""simple docstring"""






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


lowerCAmelCase__						:						Any		  =			logging.get_logger(__name__)

lowerCAmelCase__						:						str		  =			{'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'}
class        snake_case (				__UpperCAmelCase       ):




					"""simple docstring"""

					snake_case__       					=				"ctrl"
					snake_case__       					=				["past_key_values"]
					snake_case__       					=				{
					    "max_position_embeddings": "n_positions",
					    "hidden_size": "n_embd",
					    "num_attention_heads": "n_head",
					    "num_hidden_layers": "n_layer",
					}







					def __init__(       self     :			Any					,lowerCamelCase__     :			str=246_534					,lowerCamelCase__     :			List[str]=256					,lowerCamelCase__     :			Optional[int]=1_280					,lowerCamelCase__     :			Any=8_192					,lowerCamelCase__     :			int=48					,lowerCamelCase__     :			Optional[Any]=16					,lowerCamelCase__     :			Union[str, Any]=0.1					,lowerCamelCase__     :			Dict=0.1					,lowerCamelCase__     :			List[str]=1e-6					,lowerCamelCase__     :			List[str]=0.0_2					,lowerCamelCase__     :			Tuple=True					,**lowerCamelCase__     :			Optional[Any]					,):
									UpperCAmelCase__    =							vocab_size
									UpperCAmelCase__    =							n_positions
									UpperCAmelCase__    =							n_embd
									UpperCAmelCase__    =							n_layer
									UpperCAmelCase__    =							n_head
									UpperCAmelCase__    =							dff
									UpperCAmelCase__    =							resid_pdrop
									UpperCAmelCase__    =							embd_pdrop
									UpperCAmelCase__    =							layer_norm_epsilon
									UpperCAmelCase__    =							initializer_range

									UpperCAmelCase__    =							use_cache

									super().__init__(**lowerCamelCase__    )



