






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


UpperCamelCase__     =	{
    "configuration_groupvit": [
        "GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "GroupViTConfig",
        "GroupViTOnnxConfig",
        "GroupViTTextConfig",
        "GroupViTVisionConfig",
    ],
}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__     =	[
					    "GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "GroupViTModel",
					    "GroupViTPreTrainedModel",
					    "GroupViTTextModel",
					    "GroupViTVisionModel",
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__     =	[
					    "TF_GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "TFGroupViTModel",
					    "TFGroupViTPreTrainedModel",
					    "TFGroupViTTextModel",
					    "TFGroupViTVisionModel",
					]

if TYPE_CHECKING:
					from .configuration_groupvit import (
					    GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    GroupViTConfig,
					    GroupViTOnnxConfig,
					    GroupViTTextConfig,
					    GroupViTVisionConfig,
					)

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_groupvit import (
										    GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
										    GroupViTModel,
										    GroupViTPreTrainedModel,
										    GroupViTTextModel,
										    GroupViTVisionModel,
										)

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_groupvit import (
										    TF_GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFGroupViTModel,
										    TFGroupViTPreTrainedModel,
										    TFGroupViTTextModel,
										    TFGroupViTVisionModel,
										)

else:
					import sys

					UpperCamelCase__     =	_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)











import copy

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


UpperCamelCase__     =	logging.get_logger(__name__)

class     __SCREAMING_SNAKE_CASE   (       _a    ):
							snake_case       : List[Any]         =    """upernet"""






							def __init__(  self					,	__lowerCAmelCase=None					,	__lowerCAmelCase=512					,	__lowerCAmelCase=0.02					,	__lowerCAmelCase=[1, 2, 3, 6]					,	__lowerCAmelCase=True					,	__lowerCAmelCase=0.4					,	__lowerCAmelCase=384					,	__lowerCAmelCase=256					,	__lowerCAmelCase=1					,	__lowerCAmelCase=False					,	__lowerCAmelCase=255					,	**__lowerCAmelCase					,	):
														super().__init__(**__lowerCAmelCase					)

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

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







							def 			_lowerCamelCase						(  self					):
														UpperCamelCase__			       =     copy.deepcopy(self.__dict__					)
														UpperCamelCase__			       =     self.backbone_config.to_dict()
														UpperCamelCase__			       =     self.__class__.model_type
														return output




