






import copy
from typing import Dict, List, Optional

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


__lowerCamelCase      :    Any   		=   {
    """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
}

__lowerCamelCase      :    Union[str, Any]   		=   logging.get_logger(__name__)



class 							SCREAMING_SNAKE_CASE__		(       UpperCamelCase_		):





					"""simple docstring"""






					a_			=	"mask2former"
					a_			=	["swin"]
					a_			=	{"hidden_size": "hidden_dim"}



					def __init__(      self  :						Any							,	__A  :						Optional[Dict] = None							,	__A  :						int = 2_5_6							,	__A  :						int = 2_5_6							,	__A  :						int = 2_5_6							,	__A  :						int = 1_0_2_4							,	__A  :						str = "relu"							,	__A  :						int = 6							,	__A  :						int = 1_0							,	__A  :						int = 8							,	__A  :						float = 0.0							,	__A  :						int = 2_0_4_8							,	__A  :						bool = False							,	__A  :						bool = False							,	__A  :						int = 4							,	__A  :						int = 2_5_5							,	__A  :						int = 1_0_0							,	__A  :						float = 0.1							,	__A  :						float = 2.0							,	__A  :						float = 5.0							,	__A  :						float = 5.0							,	__A  :						int = 1_2_5_4_4							,	__A  :						float = 3.0							,	__A  :						float = 0.7_5							,	__A  :						float = 0.0_2							,	__A  :						float = 1.0							,	__A  :						bool = True							,	__A  :						List[int] = [4, 8, 1_6, 3_2]							,	__A  :						bool = None							,	**__A  :						Tuple							,	):
						if backbone_config is None:
							logger.info("`backbone_config` is `None`. Initializing the config with the default `Swin` backbone." )
							snake_case__				:   List[Any]     =						CONFIG_MAPPING["swin"](
							    image_size=2_2_4							,	in_channels=3							,	patch_size=4							,	embed_dim=9_6							,	depths=[2, 2, 1_8, 2]							,	num_heads=[3, 6, 1_2, 2_4]							,	window_size=7							,	drop_path_rate=0.3							,	use_absolute_embeddings=__A							,	out_features=["stage1", "stage2", "stage3", "stage4"]							,	)

						if isinstance(__A							,	__A ):
							snake_case__				:   Tuple     =						backbone_config.pop("model_type" )
							snake_case__				:   Optional[int]     =						CONFIG_MAPPING[backbone_model_type]
							snake_case__				:   Optional[int]     =						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 )}''' )

						snake_case__				:   Any     =						backbone_config
						snake_case__				:   Dict     =						feature_size
						snake_case__				:   List[str]     =						mask_feature_size
						snake_case__				:   Any     =						hidden_dim
						snake_case__				:   Tuple     =						encoder_feedforward_dim
						snake_case__				:   Tuple     =						activation_function
						snake_case__				:   int     =						encoder_layers
						snake_case__				:   Any     =						decoder_layers
						snake_case__				:   Tuple     =						num_attention_heads
						snake_case__				:   Optional[int]     =						dropout
						snake_case__				:   Tuple     =						dim_feedforward
						snake_case__				:   List[Any]     =						pre_norm
						snake_case__				:   List[str]     =						enforce_input_projection
						snake_case__				:   List[str]     =						common_stride
						snake_case__				:   Union[str, Any]     =						ignore_value
						snake_case__				:   Union[str, Any]     =						num_queries
						snake_case__				:   int     =						no_object_weight
						snake_case__				:   Dict     =						class_weight
						snake_case__				:   List[Any]     =						mask_weight
						snake_case__				:   str     =						dice_weight
						snake_case__				:   Optional[int]     =						train_num_points
						snake_case__				:   List[str]     =						oversample_ratio
						snake_case__				:   Dict     =						importance_sample_ratio
						snake_case__				:   int     =						init_std
						snake_case__				:   Dict     =						init_xavier_std
						snake_case__				:   Tuple     =						use_auxiliary_loss
						snake_case__				:   Optional[Any]     =						feature_strides
						snake_case__				:   Tuple     =						output_auxiliary_logits
						snake_case__				:   str     =						decoder_layers

						super().__init__(**__A )



					@classmethod
					def  _lowercase  (      cls  :						Any							,	__A  :						PretrainedConfig							,	**__A  :						Dict ):
						return cls(
						    backbone_config=__A							,	**__A							,	)






					def  _lowercase  (      self  :						Union[str, Any] ):
						snake_case__				:   Dict     =						copy.deepcopy(self.__dict__ )
						snake_case__				:   int     =						self.backbone_config.to_dict()
						snake_case__				:   Any     =						self.__class__.model_type
						return output











# Lint as: python3
# pylint: enable=line-too-long
# pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position

__lowerCamelCase      :    Union[str, Any]   		=   """2.13.1"""

import platform

import pyarrow
from packaging import version


if version.parse(platform.python_version()) < version.parse("""3.7"""):
	raise ImportWarning(
	    """To use `datasets`, Python>=3.7 is required, and the current version of Python doesn't match this condition."""
	)

if version.parse(pyarrow.__version__).major < 8:
	raise ImportWarning(
	    """To use `datasets`, the module `pyarrow>=8.0.0` is required, and the current version of `pyarrow` doesn't match this condition.\n"""
	    """If you are running this in a Google Colab, you should probably just restart the runtime to use the right version of `pyarrow`."""
	)

del platform
del pyarrow
del version

from .arrow_dataset import Dataset
from .arrow_reader import ReadInstruction
from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder
from .combine import concatenate_datasets, interleave_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .download import *
from .features import *
from .fingerprint import disable_caching, enable_caching, is_caching_enabled, set_caching_enabled
from .info import DatasetInfo, MetricInfo
from .inspect import (
    get_dataset_config_info,
    get_dataset_config_names,
    get_dataset_infos,
    get_dataset_split_names,
    inspect_dataset,
    inspect_metric,
    list_datasets,
    list_metrics,
)
from .iterable_dataset import IterableDataset
from .load import load_dataset, load_dataset_builder, load_from_disk, load_metric
from .metric import Metric
from .splits import (
    NamedSplit,
    NamedSplitAll,
    Split,
    SplitBase,
    SplitDict,
    SplitGenerator,
    SplitInfo,
    SubSplitInfo,
    percent,
)
from .tasks import *
from .utils import *
from .utils import logging


# deprecated modules
from datasets import arrow_dataset as _arrow_dataset  # isort:skip
from datasets import utils as _utils  # isort:skip
from datasets.utils import download_manager as _deprecated_download_manager  # isort:skip

__lowerCamelCase      :    List[Any]   		=   concatenate_datasets
__lowerCamelCase      :    List[str]   		=   DownloadConfig
__lowerCamelCase      :    Union[str, Any]   		=   DownloadManager
__lowerCamelCase      :    str   		=   DownloadMode
__lowerCamelCase      :    Union[str, Any]   		=   DownloadConfig
__lowerCamelCase      :    List[str]   		=   DownloadMode
__lowerCamelCase      :    Dict   		=   DownloadManager

del _arrow_dataset, _utils, _deprecated_download_manager



