




SCREAMING_SNAKE_CASE_:List[Any]					=						"""0.18.2"""

from .configuration_utils import ConfigMixin
from .utils import (
    OptionalDependencyNotAvailable,
    is_flax_available,
    is_inflect_available,
    is_invisible_watermark_available,
    is_k_diffusion_available,
    is_k_diffusion_version,
    is_librosa_available,
    is_note_seq_available,
    is_onnx_available,
    is_scipy_available,
    is_torch_available,
    is_torchsde_available,
    is_transformers_available,
    is_transformers_version,
    is_unidecode_available,
    logging,
)


try:
     if not is_onnx_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_onnx_objects import *  # noqa F403
else:
     from .pipelines import OnnxRuntimeModel

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_pt_objects import *  # noqa F403
else:
     from .models import (
         AutoencoderKL,
         ControlNetModel,
         ModelMixin,
         PriorTransformer,
         TaFilmDecoder,
         TransformeraDModel,
         UNetaDModel,
         UNetaDConditionModel,
         UNetaDModel,
         UNetaDConditionModel,
         VQModel,
     )
     from .optimization import (
         get_constant_schedule,
         get_constant_schedule_with_warmup,
         get_cosine_schedule_with_warmup,
         get_cosine_with_hard_restarts_schedule_with_warmup,
         get_linear_schedule_with_warmup,
         get_polynomial_decay_schedule_with_warmup,
         get_scheduler,
     )
     from .pipelines import (
         AudioPipelineOutput,
         ConsistencyModelPipeline,
         DanceDiffusionPipeline,
         DDIMPipeline,
         DDPMPipeline,
         DiffusionPipeline,
         DiTPipeline,
         ImagePipelineOutput,
         KarrasVePipeline,
         LDMPipeline,
         LDMSuperResolutionPipeline,
         PNDMPipeline,
         RePaintPipeline,
         ScoreSdeVePipeline,
     )
     from .schedulers import (
         CMStochasticIterativeScheduler,
         DDIMInverseScheduler,
         DDIMParallelScheduler,
         DDIMScheduler,
         DDPMParallelScheduler,
         DDPMScheduler,
         DEISMultistepScheduler,
         DPMSolverMultistepInverseScheduler,
         DPMSolverMultistepScheduler,
         DPMSolverSinglestepScheduler,
         EulerAncestralDiscreteScheduler,
         EulerDiscreteScheduler,
         HeunDiscreteScheduler,
         IPNDMScheduler,
         KarrasVeScheduler,
         KDPMaAncestralDiscreteScheduler,
         KDPMaDiscreteScheduler,
         PNDMScheduler,
         RePaintScheduler,
         SchedulerMixin,
         ScoreSdeVeScheduler,
         UnCLIPScheduler,
         UniPCMultistepScheduler,
         VQDiffusionScheduler,
     )
     from .training_utils import EMAModel

try:
     if not (is_torch_available() and is_scipy_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_torch_and_scipy_objects import *  # noqa F403
else:
     from .schedulers import LMSDiscreteScheduler

try:
     if not (is_torch_available() and is_torchsde_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_torch_and_torchsde_objects import *  # noqa F403
else:
     from .schedulers import DPMSolverSDEScheduler

try:
     if not (is_torch_available() and is_transformers_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
     from .pipelines import (
         AltDiffusionImgaImgPipeline,
         AltDiffusionPipeline,
         AudioLDMPipeline,
         CycleDiffusionPipeline,
         IFImgaImgPipeline,
         IFImgaImgSuperResolutionPipeline,
         IFInpaintingPipeline,
         IFInpaintingSuperResolutionPipeline,
         IFPipeline,
         IFSuperResolutionPipeline,
         ImageTextPipelineOutput,
         KandinskyImgaImgPipeline,
         KandinskyInpaintPipeline,
         KandinskyPipeline,
         KandinskyPriorPipeline,
         KandinskyVaaControlnetImgaImgPipeline,
         KandinskyVaaControlnetPipeline,
         KandinskyVaaImgaImgPipeline,
         KandinskyVaaInpaintPipeline,
         KandinskyVaaPipeline,
         KandinskyVaaPriorEmbaEmbPipeline,
         KandinskyVaaPriorPipeline,
         LDMTextToImagePipeline,
         PaintByExamplePipeline,
         SemanticStableDiffusionPipeline,
         ShapEImgaImgPipeline,
         ShapEPipeline,
         StableDiffusionAttendAndExcitePipeline,
         StableDiffusionControlNetImgaImgPipeline,
         StableDiffusionControlNetInpaintPipeline,
         StableDiffusionControlNetPipeline,
         StableDiffusionDepthaImgPipeline,
         StableDiffusionDiffEditPipeline,
         StableDiffusionImageVariationPipeline,
         StableDiffusionImgaImgPipeline,
         StableDiffusionInpaintPipeline,
         StableDiffusionInpaintPipelineLegacy,
         StableDiffusionInstructPixaPixPipeline,
         StableDiffusionLatentUpscalePipeline,
         StableDiffusionLDMaDPipeline,
         StableDiffusionModelEditingPipeline,
         StableDiffusionPanoramaPipeline,
         StableDiffusionParadigmsPipeline,
         StableDiffusionPipeline,
         StableDiffusionPipelineSafe,
         StableDiffusionPixaPixZeroPipeline,
         StableDiffusionSAGPipeline,
         StableDiffusionUpscalePipeline,
         StableUnCLIPImgaImgPipeline,
         StableUnCLIPPipeline,
         TextToVideoSDPipeline,
         TextToVideoZeroPipeline,
         UnCLIPImageVariationPipeline,
         UnCLIPPipeline,
         UniDiffuserModel,
         UniDiffuserPipeline,
         UniDiffuserTextDecoder,
         VersatileDiffusionDualGuidedPipeline,
         VersatileDiffusionImageVariationPipeline,
         VersatileDiffusionPipeline,
         VersatileDiffusionTextToImagePipeline,
         VideoToVideoSDPipeline,
         VQDiffusionPipeline,
     )

try:
     if not (is_torch_available() and is_transformers_available() and is_invisible_watermark_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_torch_and_transformers_and_invisible_watermark_objects import *  # noqa F403
else:
     from .pipelines import StableDiffusionXLImgaImgPipeline, StableDiffusionXLPipeline

try:
     if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_torch_and_transformers_and_k_diffusion_objects import *  # noqa F403
else:
     from .pipelines import StableDiffusionKDiffusionPipeline

try:
     if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_torch_and_transformers_and_onnx_objects import *  # noqa F403
else:
     from .pipelines import (
         OnnxStableDiffusionImgaImgPipeline,
         OnnxStableDiffusionInpaintPipeline,
         OnnxStableDiffusionInpaintPipelineLegacy,
         OnnxStableDiffusionPipeline,
         OnnxStableDiffusionUpscalePipeline,
         StableDiffusionOnnxPipeline,
     )

try:
     if not (is_torch_available() and is_librosa_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_torch_and_librosa_objects import *  # noqa F403
else:
     from .pipelines import AudioDiffusionPipeline, Mel

try:
     if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_transformers_and_torch_and_note_seq_objects import *  # noqa F403
else:
     from .pipelines import SpectrogramDiffusionPipeline

try:
     if not is_flax_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_flax_objects import *  # noqa F403
else:
     from .models.controlnet_flax import FlaxControlNetModel
     from .models.modeling_flax_utils import FlaxModelMixin
     from .models.unet_ad_condition_flax import FlaxUNetaDConditionModel
     from .models.vae_flax import FlaxAutoencoderKL
     from .pipelines import FlaxDiffusionPipeline
     from .schedulers import (
         FlaxDDIMScheduler,
         FlaxDDPMScheduler,
         FlaxDPMSolverMultistepScheduler,
         FlaxKarrasVeScheduler,
         FlaxLMSDiscreteScheduler,
         FlaxPNDMScheduler,
         FlaxSchedulerMixin,
         FlaxScoreSdeVeScheduler,
     )


try:
     if not (is_flax_available() and is_transformers_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_flax_and_transformers_objects import *  # noqa F403
else:
     from .pipelines import (
         FlaxStableDiffusionControlNetPipeline,
         FlaxStableDiffusionImgaImgPipeline,
         FlaxStableDiffusionInpaintPipeline,
         FlaxStableDiffusionPipeline,
     )

try:
     if not (is_note_seq_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from .utils.dummy_note_seq_objects import *  # noqa F403
else:
     from .pipelines import MidiProcessor







from collections import OrderedDict
from typing import Mapping

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


SCREAMING_SNAKE_CASE_:Any					=						logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_:Any					=						{
    """xlm-mlm-en-2048""": """https://huggingface.co/xlm-mlm-en-2048/resolve/main/config.json""",
    """xlm-mlm-ende-1024""": """https://huggingface.co/xlm-mlm-ende-1024/resolve/main/config.json""",
    """xlm-mlm-enfr-1024""": """https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/config.json""",
    """xlm-mlm-enro-1024""": """https://huggingface.co/xlm-mlm-enro-1024/resolve/main/config.json""",
    """xlm-mlm-tlm-xnli15-1024""": """https://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/config.json""",
    """xlm-mlm-xnli15-1024""": """https://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/config.json""",
    """xlm-clm-enfr-1024""": """https://huggingface.co/xlm-clm-enfr-1024/resolve/main/config.json""",
    """xlm-clm-ende-1024""": """https://huggingface.co/xlm-clm-ende-1024/resolve/main/config.json""",
    """xlm-mlm-17-1280""": """https://huggingface.co/xlm-mlm-17-1280/resolve/main/config.json""",
    """xlm-mlm-100-1280""": """https://huggingface.co/xlm-mlm-100-1280/resolve/main/config.json""",
}






class SCREAMING_SNAKE_CASE__					(		SCREAMING_SNAKE_CASE__   ):




    '''simple docstring'''






    __lowerCamelCase      :			List[str] =				"xlm"
    __lowerCamelCase      :			Tuple =				{
        "hidden_size": "emb_dim",
        "num_attention_heads": "n_heads",
        "num_hidden_layers": "n_layers",
        "n_words": "vocab_size",  # For backward compatibility
    }






    def __init__(	self,		lowerCamelCase__=3_0145,		lowerCamelCase__=2048,		lowerCamelCase__=12,		lowerCamelCase__=16,		lowerCamelCase__=0.1,		lowerCamelCase__=0.1,		lowerCamelCase__=True,		lowerCamelCase__=False,		lowerCamelCase__=False,		lowerCamelCase__=False,		lowerCamelCase__=1,		lowerCamelCase__=True,		lowerCamelCase__=512,		lowerCamelCase__=2048**-0.5,		lowerCamelCase__=1e-12,		lowerCamelCase__=0.02,		lowerCamelCase__=0,		lowerCamelCase__=1,		lowerCamelCase__=2,		lowerCamelCase__=3,		lowerCamelCase__=5,		lowerCamelCase__=True,		lowerCamelCase__="first",		lowerCamelCase__=True,		lowerCamelCase__=None,		lowerCamelCase__=True,		lowerCamelCase__=0.1,		lowerCamelCase__=5,		lowerCamelCase__=5,		lowerCamelCase__=0,		lowerCamelCase__=0,		lowerCamelCase__=2,		lowerCamelCase__=0,		**lowerCamelCase__,		):
        A			:	Dict										=       vocab_size
        A			:	int										=       emb_dim
        A			:	str										=       n_layers
        A			:	Union[str, Any]										=       n_heads
        A			:	Optional[int]										=       dropout
        A			:	Union[str, Any]										=       attention_dropout
        A			:	Optional[Any]										=       gelu_activation
        A			:	Dict										=       sinusoidal_embeddings
        A			:	int										=       causal
        A			:	Optional[Any]										=       asm
        A			:	Any										=       n_langs
        A			:	List[str]										=       use_lang_emb
        A			:	Union[str, Any]										=       layer_norm_eps
        A			:	str										=       bos_index
        A			:	int										=       eos_index
        A			:	Tuple										=       pad_index
        A			:	str										=       unk_index
        A			:	Optional[Any]										=       mask_index
        A			:	Union[str, Any]										=       is_encoder
        A			:	Tuple										=       max_position_embeddings
        A			:	List[str]										=       embed_init_std
        A			:	Tuple										=       init_std
        A			:	Tuple										=       summary_type
        A			:	int										=       summary_use_proj
        A			:	List[Any]										=       summary_activation
        A			:	Optional[Any]										=       summary_proj_to_labels
        A			:	Optional[Any]										=       summary_first_dropout
        A			:	Optional[int]										=       start_n_top
        A			:	Optional[Any]										=       end_n_top
        A			:	List[str]										=       mask_token_id
        A			:	Tuple										=       lang_id

        if "n_words" in kwargs:
            A			:	List[str]										=       kwargs["""n_words"""]

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






class SCREAMING_SNAKE_CASE__					(		SCREAMING_SNAKE_CASE__   ):




    '''simple docstring'''






    @property
    def       _lowerCAmelCase (	self		):
        if self.task == "multiple-choice":
            A			:	Any										=       {0: """batch""", 1: """choice""", 2: """sequence"""}
        else:
            A			:	Union[str, Any]										=       {0: """batch""", 1: """sequence"""}
        return OrderedDict(
            [
                ("""input_ids""", dynamic_axis),
                ("""attention_mask""", dynamic_axis),
                ("""token_type_ids""", dynamic_axis),
            ]		)


