

from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


_a:      str								=     logging.get_logger(__name__)

_a:      List[str]								=     {
    """flaubert/flaubert_small_cased""": """https://huggingface.co/flaubert/flaubert_small_cased/resolve/main/config.json""",
    """flaubert/flaubert_base_uncased""": """https://huggingface.co/flaubert/flaubert_base_uncased/resolve/main/config.json""",
    """flaubert/flaubert_base_cased""": """https://huggingface.co/flaubert/flaubert_base_cased/resolve/main/config.json""",
    """flaubert/flaubert_large_cased""": """https://huggingface.co/flaubert/flaubert_large_cased/resolve/main/config.json""",
}

class   __UpperCamelCase      (   lowercase  ):
	SCREAMING_SNAKE_CASE__      			=       'flaubert'
	SCREAMING_SNAKE_CASE__      			=       {
	    'hidden_size': 'emb_dim',
	    'num_attention_heads': 'n_heads',
	    'num_hidden_layers': 'n_layers',
	    'n_words': 'vocab_size',  # For backward compatibility
	}




	def __init__(						self		:  str						,		lowerCAmelCase		:  str=False						,		lowerCAmelCase		:  int=0.0						,		lowerCAmelCase		:  Optional[Any]=30_145						,		lowerCAmelCase		:  Dict=2_048						,		lowerCAmelCase		:  Optional[Any]=12						,		lowerCAmelCase		:  Optional[int]=16						,		lowerCAmelCase		:  Any=0.1						,		lowerCAmelCase		:  Any=0.1						,		lowerCAmelCase		:  Tuple=True						,		lowerCAmelCase		:  int=False						,		lowerCAmelCase		:  List[str]=False						,		lowerCAmelCase		:  str=False						,		lowerCAmelCase		:  int=1						,		lowerCAmelCase		:  int=True						,		lowerCAmelCase		:  Dict=512						,		lowerCAmelCase		:  List[str]=2_048**-0.5						,		lowerCAmelCase		:  Any=1e-12						,		lowerCAmelCase		:  Optional[Any]=0.02						,		lowerCAmelCase		:  Tuple=0						,		lowerCAmelCase		:  int=1						,		lowerCAmelCase		:  Optional[Any]=2						,		lowerCAmelCase		:  str=3						,		lowerCAmelCase		:  Dict=5						,		lowerCAmelCase		:  Union[str, Any]=True						,		lowerCAmelCase		:  List[Any]="first"						,		lowerCAmelCase		:  int=True						,		lowerCAmelCase		:  Tuple=None						,		lowerCAmelCase		:  str=True						,		lowerCAmelCase		:  List[Any]=0.1						,		lowerCAmelCase		:  Tuple=5						,		lowerCAmelCase		:  List[str]=5						,		lowerCAmelCase		:  str=0						,		lowerCAmelCase		:  int=0						,		lowerCAmelCase		:  Dict=2						,		lowerCAmelCase		:  Optional[Any]=0						,		**lowerCAmelCase		:  Any						,		):


		'''simple docstring'''







		UpperCAmelCase_    			=     pre_norm
		UpperCAmelCase_    			=     layerdrop
		UpperCAmelCase_    			=     vocab_size
		UpperCAmelCase_    			=     emb_dim
		UpperCAmelCase_    			=     n_layers
		UpperCAmelCase_    			=     n_heads
		UpperCAmelCase_    			=     dropout
		UpperCAmelCase_    			=     attention_dropout
		UpperCAmelCase_    			=     gelu_activation
		UpperCAmelCase_    			=     sinusoidal_embeddings
		UpperCAmelCase_    			=     causal
		UpperCAmelCase_    			=     asm
		UpperCAmelCase_    			=     n_langs
		UpperCAmelCase_    			=     use_lang_emb
		UpperCAmelCase_    			=     layer_norm_eps
		UpperCAmelCase_    			=     bos_index
		UpperCAmelCase_    			=     eos_index
		UpperCAmelCase_    			=     pad_index
		UpperCAmelCase_    			=     unk_index
		UpperCAmelCase_    			=     mask_index
		UpperCAmelCase_    			=     is_encoder
		UpperCAmelCase_    			=     max_position_embeddings
		UpperCAmelCase_    			=     embed_init_std
		UpperCAmelCase_    			=     init_std
		UpperCAmelCase_    			=     summary_type
		UpperCAmelCase_    			=     summary_use_proj
		UpperCAmelCase_    			=     summary_activation
		UpperCAmelCase_    			=     summary_proj_to_labels
		UpperCAmelCase_    			=     summary_first_dropout
		UpperCAmelCase_    			=     start_n_top
		UpperCAmelCase_    			=     end_n_top
		UpperCAmelCase_    			=     mask_token_id
		UpperCAmelCase_    			=     lang_id

		if "n_words" in kwargs:
			UpperCAmelCase_    			=     kwargs["n_words"]

		super().__init__(pad_token_id=lowerCAmelCase						,		bos_token_id=lowerCAmelCase						,		**lowerCAmelCase							)


class   __UpperCamelCase      (   lowercase  ):




	@property
	def  __A   (						self		:  Dict							):


		'''simple docstring'''







		if self.task == "multiple-choice":
			UpperCAmelCase_    			=     {0: "batch", 1: "choice", 2: "sequence"}
		else:
			UpperCAmelCase_    			=     {0: "batch", 1: "sequence"}
		return OrderedDict(
		    [
		        ("input_ids", dynamic_axis),
		        ("attention_mask", dynamic_axis),
		    ]							)


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


_a:      Tuple								=     {
    """configuration_segformer""": ["""SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SegformerConfig""", """SegformerOnnxConfig"""]
}

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_a:      List[str]								=     ["""SegformerFeatureExtractor"""]
				_a:      Union[str, Any]								=     ["""SegformerImageProcessor"""]

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_a:      Any								=     [
				    """SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """SegformerDecodeHead""",
				    """SegformerForImageClassification""",
				    """SegformerForSemanticSegmentation""",
				    """SegformerLayer""",
				    """SegformerModel""",
				    """SegformerPreTrainedModel""",
				]

try:
				if not is_tf_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_a:      Optional[Any]								=     [
				    """TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """TFSegformerDecodeHead""",
				    """TFSegformerForImageClassification""",
				    """TFSegformerForSemanticSegmentation""",
				    """TFSegformerModel""",
				    """TFSegformerPreTrainedModel""",
				]


if TYPE_CHECKING:
				from .configuration_segformer import SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, SegformerConfig, SegformerOnnxConfig

				try:
								if not is_vision_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .feature_extraction_segformer import SegformerFeatureExtractor
								from .image_processing_segformer import SegformerImageProcessor

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_segformer import (
								    SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    SegformerDecodeHead,
								    SegformerForImageClassification,
								    SegformerForSemanticSegmentation,
								    SegformerLayer,
								    SegformerModel,
								    SegformerPreTrainedModel,
								)
				try:
								if not is_tf_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_tf_segformer import (
								    TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    TFSegformerDecodeHead,
								    TFSegformerForImageClassification,
								    TFSegformerForSemanticSegmentation,
								    TFSegformerModel,
								    TFSegformerPreTrainedModel,
								)

else:
				import sys

				_a:      Optional[int]								=     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)