


import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING


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







class  snake_case_     (lowerCamelCase_   ):
					UpperCAmelCase__      :					Optional[Any]					   =    '''upernet'''
					def __init__(   self     :Union[str, Any]    ,__snake_case     :Optional[Any]=None    ,__snake_case     :Optional[Any]=5_12    ,__snake_case     :List[Any]=0.02    ,__snake_case     :List[Any]=[1, 2, 3, 6]    ,__snake_case     :Union[str, Any]=True    ,__snake_case     :Union[str, Any]=0.4    ,__snake_case     :List[str]=3_84    ,__snake_case     :Union[str, Any]=2_56    ,__snake_case     :int=1    ,__snake_case     :Any=False    ,__snake_case     :str=2_55    ,**__snake_case     :List[str]    ,)      ->					List[str]:
												super().__init__(**__snake_case   )

												if backbone_config is None:
																			logger.info('`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.'   )
																			a__    =  CONFIG_MAPPING['resnet'](out_features=['stage1', 'stage2', 'stage3', 'stage4']   )
												elif isinstance(__snake_case    ,__snake_case   ):
																			a__    =  backbone_config.get('model_type'   )
																			a__    =  CONFIG_MAPPING[backbone_model_type]
																			a__    =  config_class.from_dict(__snake_case   )

												a__    =  backbone_config
												a__    =  hidden_size
												a__    =  initializer_range
												a__    =  pool_scales
												a__    =  use_auxiliary_head
												a__    =  auxiliary_loss_weight
												a__    =  auxiliary_in_channels
												a__    =  auxiliary_channels
												a__    =  auxiliary_num_convs
												a__    =  auxiliary_concat_input
												a__    =  loss_ignore_index



					def 				lowerCamelCase__(   self     :List[str]   )      ->					str:
												a__    =  copy.deepcopy(self.__dict__   )
												a__    =  self.backbone_config.to_dict()
												a__    =  self.__class__.model_type
												return output








from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


snake_case							: Optional[Any]      =   {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FocalNetConfig''']}


try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						snake_case							: Optional[int]      =   [
						    '''FOCALNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''FocalNetForImageClassification''',
						    '''FocalNetForMaskedImageModeling''',
						    '''FocalNetBackbone''',
						    '''FocalNetModel''',
						    '''FocalNetPreTrainedModel''',
						]

if TYPE_CHECKING:
						from .configuration_focalnet import FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP, FocalNetConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_focalnet import (
												    FOCALNET_PRETRAINED_MODEL_ARCHIVE_LIST,
												    FocalNetBackbone,
												    FocalNetForImageClassification,
												    FocalNetForMaskedImageModeling,
												    FocalNetModel,
												    FocalNetPreTrainedModel,
												)

else:
						import sys

						snake_case							: Union[str, Any]      =   _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




