






"""simple docstring"""



import warnings

from ...configuration_utils import PretrainedConfig
from ...utils import logging


A__       :				int 					=					logging.get_logger(__name__)

A__       :				Optional[int] 					=					{
    'xlnet-base-cased': 'https://huggingface.co/xlnet-base-cased/resolve/main/config.json',
    'xlnet-large-cased': 'https://huggingface.co/xlnet-large-cased/resolve/main/config.json',
}







class    lowercase__			(							A__   ):
			_UpperCAmelCase		:Optional[Any]   			= "xlnet"
			_UpperCAmelCase		:Any   			= ["mems"]
			_UpperCAmelCase		:Dict   			= {
			    "n_token": "vocab_size",  # Backward compatibility
			    "hidden_size": "d_model",
			    "num_attention_heads": "n_head",
			    "num_hidden_layers": "n_layer",
			}


			def __init__(      self     :  Optional[Any]   ,       snake_case__     :  List[str]=3_2000   ,       snake_case__     :  str=1024   ,       snake_case__     :  Dict=24   ,       snake_case__     :  int=16   ,       snake_case__     :  Optional[int]=4096   ,       snake_case__     :  Union[str, Any]="gelu"   ,       snake_case__     :  Any=True   ,       snake_case__     :  List[str]="bi"   ,       snake_case__     :  List[str]=0.02   ,       snake_case__     :  Optional[int]=1E-12   ,       snake_case__     :  str=0.1   ,       snake_case__     :  List[str]=512   ,       snake_case__     :  Dict=None   ,       snake_case__     :  str=True   ,       snake_case__     :  Any=False   ,       snake_case__     :  Optional[int]=False   ,       snake_case__     :  List[Any]=-1   ,       snake_case__     :  List[str]=False   ,       snake_case__     :  List[Any]="last"   ,       snake_case__     :  Union[str, Any]=True   ,       snake_case__     :  Optional[int]="tanh"   ,       snake_case__     :  Tuple=0.1   ,       snake_case__     :  Dict=5   ,       snake_case__     :  int=5   ,       snake_case__     :  Any=5   ,       snake_case__     :  Dict=1   ,       snake_case__     :  List[str]=2   ,       **snake_case__     :  List[Any]   ,       ):
										lowerCamelCase_       :							Union[str, Any]									=vocab_size
										lowerCamelCase_       :							List[str]									=d_model
										lowerCamelCase_       :							Dict									=n_layer
										lowerCamelCase_       :							Any									=n_head
										if d_model % n_head != 0:
																	raise ValueError(F"""\'d_model % n_head\' ({d_model % n_head}) should be equal to 0"""					)
										if "d_head" in kwargs:
																	if kwargs["d_head"] != d_model // n_head:
																								raise ValueError(
																								    F"""`d_head` ({kwargs['d_head']}) should be equal to `d_model // n_head` ({d_model // n_head})"""					)
										lowerCamelCase_       :							List[Any]									=d_model // n_head
										lowerCamelCase_       :							str									=ff_activation
										lowerCamelCase_       :							Optional[int]									=d_inner
										lowerCamelCase_       :							int									=untie_r
										lowerCamelCase_       :							Optional[int]									=attn_type

										lowerCamelCase_       :							Optional[int]									=initializer_range
										lowerCamelCase_       :							Optional[int]									=layer_norm_eps

										lowerCamelCase_       :							Tuple									=dropout
										lowerCamelCase_       :							Union[str, Any]									=mem_len
										lowerCamelCase_       :							Optional[int]									=reuse_len
										lowerCamelCase_       :							Optional[Any]									=bi_data
										lowerCamelCase_       :							Optional[Any]									=clamp_len
										lowerCamelCase_       :							Optional[Any]									=same_length

										lowerCamelCase_       :							List[str]									=summary_type
										lowerCamelCase_       :							Optional[Any]									=summary_use_proj
										lowerCamelCase_       :							Optional[Any]									=summary_activation
										lowerCamelCase_       :							int									=summary_last_dropout
										lowerCamelCase_       :							Dict									=start_n_top
										lowerCamelCase_       :							Union[str, Any]									=end_n_top

										lowerCamelCase_       :							Any									=bos_token_id
										lowerCamelCase_       :							int									=pad_token_id
										lowerCamelCase_       :							Optional[int]									=eos_token_id

										if "use_cache" in kwargs:
																	warnings.warn(
																	    "The `use_cache` argument is deprecated and will be removed in a future version, use `use_mems_eval`"
																	    " instead."   ,       UpperCamelCase_   ,       )
																	lowerCamelCase_       :							Optional[Any]									=kwargs['''use_cache''']

										lowerCamelCase_       :							List[Any]									=use_mems_eval
										lowerCamelCase_       :							Any									=use_mems_train
										super().__init__(pad_token_id=UpperCamelCase_   ,       bos_token_id=UpperCamelCase_   ,       eos_token_id=UpperCamelCase_   ,       **UpperCamelCase_					)


			@property
			def 	UpperCAmelCase__						(      self     :  List[str]					):
										logger.info(F"""The model {self.model_type} is one of the few models that has no sequence length limit."""					)
										return -1


			@max_position_embeddings.setter
			def 	UpperCAmelCase__						(      self     :  Union[str, Any]   ,       snake_case__     :  Any					):
										raise NotImplementedError(
										    F"""The model {self.model_type} is one of the few models that has no sequence length limit."""					)







'''simple docstring'''
from ...utils import (
    OptionalDependencyNotAvailable,
    is_flax_available,
    is_torch_available,
    is_transformers_available,
)


try:
		if not (is_transformers_available() and is_torch_available()):
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		from ...utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
		from .multicontrolnet import MultiControlNetModel
		from .pipeline_controlnet import StableDiffusionControlNetPipeline
		from .pipeline_controlnet_imgaimg import StableDiffusionControlNetImgaImgPipeline
		from .pipeline_controlnet_inpaint import StableDiffusionControlNetInpaintPipeline


if is_transformers_available() and is_flax_available():
		from .pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline