






import copy
from typing import Dict, List, Optional

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


a_						:  Dict									=			{
    "facebook/mask2former-swin-small-coco-instance": (
        "https://huggingface.co/facebook/mask2former-swin-small-coco-instance/blob/main/config.json"
    )
    # See all Mask2Former models at https://huggingface.co/models?filter=mask2former
}

a_						:  Dict									=			logging.get_logger(__name__)

class 						_snake_case     (     A__    ):
			_lowercase						:			Union[str, Any]	   =							'''mask2former'''
			_lowercase						:			Optional[Any]	   =							['''swin''']
			_lowercase						:			List[str]	   =							{'''hidden_size''': '''hidden_dim'''}






			def __init__(				self						,    a = None						,    a = 256						,    a = 256						,    a = 256						,    a = 1024						,    a = "relu"						,    a = 6						,    a = 10						,    a = 8						,    a = 0.0						,    a = 2048						,    a = False						,    a = False						,    a = 4						,    a = 255						,    a = 100						,    a = 0.1						,    a = 2.0						,    a = 5.0						,    a = 5.0						,    a = 1_2544						,    a = 3.0						,    a = 0.75						,    a = 0.02						,    a = 1.0						,    a = True						,    a = [4, 8, 16, 32]						,    a = None						,    **a						,    )					->				Optional[Any]:







						if backbone_config is None:
									logger.info('`backbone_config` is `None`. Initializing the config with the default `Swin` backbone.')
									SCREAMING_SNAKE_CASE						 =       CONFIG_MAPPING['swin'](
									    image_size=224						,    in_channels=3						,    patch_size=4						,    embed_dim=96						,    depths=[2, 2, 18, 2]						,    num_heads=[3, 6, 12, 24]						,    window_size=7						,    drop_path_rate=0.3						,    use_absolute_embeddings=a						,    out_features=['stage1', 'stage2', 'stage3', 'stage4']						,    )

						if isinstance(a						,    a):
									SCREAMING_SNAKE_CASE						 =       backbone_config.pop('model_type')
									SCREAMING_SNAKE_CASE						 =       CONFIG_MAPPING[backbone_model_type]
									SCREAMING_SNAKE_CASE						 =       config_class.from_dict(a)

						# verify that the backbone is supported
						if backbone_config.model_type not in self.backbones_supported:
									logger.warning_once(
									    f'''Backbone {backbone_config.model_type} is not a supported model and may not be compatible with Mask2Former. '''
									    f'''Supported model types: {','.join(self.backbones_supported)}''')

						SCREAMING_SNAKE_CASE						 =       backbone_config
						SCREAMING_SNAKE_CASE						 =       feature_size
						SCREAMING_SNAKE_CASE						 =       mask_feature_size
						SCREAMING_SNAKE_CASE						 =       hidden_dim
						SCREAMING_SNAKE_CASE						 =       encoder_feedforward_dim
						SCREAMING_SNAKE_CASE						 =       activation_function
						SCREAMING_SNAKE_CASE						 =       encoder_layers
						SCREAMING_SNAKE_CASE						 =       decoder_layers
						SCREAMING_SNAKE_CASE						 =       num_attention_heads
						SCREAMING_SNAKE_CASE						 =       dropout
						SCREAMING_SNAKE_CASE						 =       dim_feedforward
						SCREAMING_SNAKE_CASE						 =       pre_norm
						SCREAMING_SNAKE_CASE						 =       enforce_input_projection
						SCREAMING_SNAKE_CASE						 =       common_stride
						SCREAMING_SNAKE_CASE						 =       ignore_value
						SCREAMING_SNAKE_CASE						 =       num_queries
						SCREAMING_SNAKE_CASE						 =       no_object_weight
						SCREAMING_SNAKE_CASE						 =       class_weight
						SCREAMING_SNAKE_CASE						 =       mask_weight
						SCREAMING_SNAKE_CASE						 =       dice_weight
						SCREAMING_SNAKE_CASE						 =       train_num_points
						SCREAMING_SNAKE_CASE						 =       oversample_ratio
						SCREAMING_SNAKE_CASE						 =       importance_sample_ratio
						SCREAMING_SNAKE_CASE						 =       init_std
						SCREAMING_SNAKE_CASE						 =       init_xavier_std
						SCREAMING_SNAKE_CASE						 =       use_auxiliary_loss
						SCREAMING_SNAKE_CASE						 =       feature_strides
						SCREAMING_SNAKE_CASE						 =       output_auxiliary_logits
						SCREAMING_SNAKE_CASE						 =       decoder_layers

						super().__init__(**a)






			@classmethod
			def       SCREAMING_SNAKE_CASE__			(				cls						,    a						,    **a)					->				int:
						return cls(
						    backbone_config=a						,    **a						,    )







			def       SCREAMING_SNAKE_CASE__			(				self)					->				Dict:
						SCREAMING_SNAKE_CASE						 =       copy.deepcopy(self.__dict__)
						SCREAMING_SNAKE_CASE						 =       self.backbone_config.to_dict()
						SCREAMING_SNAKE_CASE						 =       self.__class__.model_type
						return output










from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__UpperCamelCase					:       Optional[Any]    					=      {
    "configuration_jukebox": [
        "JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "JukeboxConfig",
        "JukeboxPriorConfig",
        "JukeboxVQVAEConfig",
    ],
    "tokenization_jukebox": ["JukeboxTokenizer"],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__UpperCamelCase					:       Tuple    					=      [
		    "JUKEBOX_PRETRAINED_MODEL_ARCHIVE_LIST",
		    "JukeboxModel",
		    "JukeboxPreTrainedModel",
		    "JukeboxVQVAE",
		    "JukeboxPrior",
		]

if TYPE_CHECKING:
		from .configuration_jukebox import (
		    JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    JukeboxConfig,
		    JukeboxPriorConfig,
		    JukeboxVQVAEConfig,
		)
		from .tokenization_jukebox import JukeboxTokenizer

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_jukebox import (
				    JUKEBOX_PRETRAINED_MODEL_ARCHIVE_LIST,
				    JukeboxModel,
				    JukeboxPreTrainedModel,
				    JukeboxPrior,
				    JukeboxVQVAE,
				)

else:
		import sys

		__UpperCamelCase					:       List[Any]    					=      _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)

