

'''simple docstring'''



_UpperCamelCase						:  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






"""simple docstring"""



import functools
import operator

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


_UpperCamelCase								=		logging.get_logger(__name__)

_UpperCamelCase								=		{
    "asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json",
    # See all SEW models at https://huggingface.co/models?filter=sew
}
class 						__UpperCAmelCase    (__A     ):







			'''simple docstring'''
			_UpperCamelCase  :						Dict					     =				'sew'





			def __init__(			self   ,      snake_case_=32   ,      snake_case_=768   ,      snake_case_=12   ,      snake_case_=12   ,      snake_case_=3_072   ,      snake_case_=2   ,      snake_case_="gelu"   ,      snake_case_=0.1   ,      snake_case_=0.1   ,      snake_case_=0.1   ,      snake_case_=0.0   ,      snake_case_=0.1   ,      snake_case_=0.1   ,      snake_case_=0.02   ,      snake_case_=1E-5   ,      snake_case_="group"   ,      snake_case_="gelu"   ,      snake_case_=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)   ,      snake_case_=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)   ,      snake_case_=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)   ,      snake_case_=False   ,      snake_case_=128   ,      snake_case_=16   ,      snake_case_=True   ,      snake_case_=0.05   ,      snake_case_=10   ,      snake_case_=2   ,      snake_case_=0.0   ,      snake_case_=10   ,      snake_case_=0   ,      snake_case_="mean"   ,      snake_case_=False   ,      snake_case_=False   ,      snake_case_=256   ,      snake_case_=0   ,      snake_case_=1   ,      snake_case_=2   ,      **snake_case_   ,      ):







										'''simple docstring'''


										super().__init__(**snake_case_   ,      pad_token_id=snake_case_   ,      bos_token_id=snake_case_   ,      eos_token_id=snake_case_							)
										A__       :     Dict								=			hidden_size
										A__       :     Dict								=			feat_extract_norm
										A__       :     str								=			feat_extract_activation
										A__       :     Optional[Any]								=			list(snake_case_							)
										A__       :     str								=			list(snake_case_							)
										A__       :     Any								=			list(snake_case_							)
										A__       :     Any								=			conv_bias
										A__       :     Any								=			num_conv_pos_embeddings
										A__       :     Any								=			num_conv_pos_embedding_groups
										A__       :     str								=			len(self.conv_dim							)
										A__       :     Tuple								=			num_hidden_layers
										A__       :     int								=			intermediate_size
										A__       :     Union[str, Any]								=			squeeze_factor
										A__       :     Union[str, Any]								=			hidden_act
										A__       :     List[str]								=			num_attention_heads
										A__       :     List[str]								=			hidden_dropout
										A__       :     Dict								=			attention_dropout
										A__       :     Tuple								=			activation_dropout
										A__       :     Optional[int]								=			feat_proj_dropout
										A__       :     Optional[Any]								=			final_dropout
										A__       :     int								=			layerdrop
										A__       :     List[Any]								=			layer_norm_eps
										A__       :     int								=			initializer_range
										A__       :     Dict								=			vocab_size

										if (
										    (len(self.conv_stride							) != self.num_feat_extract_layers)
										    or (len(self.conv_kernel							) != self.num_feat_extract_layers)
										    or (len(self.conv_dim							) != self.num_feat_extract_layers)
										):
																	raise ValueError(
																	    """Configuration for convolutional layers is incorrect."""
																	    """It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`,"""
																	    F'''but is `len(config.conv_dim) = {len(self.conv_dim							)}`, `len(config.conv_stride)'''
																	    F'''= {len(self.conv_stride							)}`, `len(config.conv_kernel) = {len(self.conv_kernel							)}`.'''							)

										# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
										A__       :     Optional[Any]								=			apply_spec_augment
										A__       :     int								=			mask_time_prob
										A__       :     Tuple								=			mask_time_length
										A__       :     Optional[Any]								=			mask_time_min_masks
										A__       :     Any								=			mask_feature_prob
										A__       :     List[Any]								=			mask_feature_length
										A__       :     Any								=			mask_feature_min_masks

										# ctc loss
										A__       :     str								=			ctc_loss_reduction
										A__       :     List[Any]								=			ctc_zero_infinity

										# sequence classification
										A__       :     Union[str, Any]								=			use_weighted_layer_sum
										A__       :     str								=			classifier_proj_size





			@property
			def 		lowerCamelCase					(			self							):







										'''simple docstring'''


										return functools.reduce(operator.mul   ,      self.conv_stride   ,      1							)





