




import functools
import operator

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


UpperCamelCase__         =      logging.get_logger(__name__)

UpperCamelCase__         =      {
    """microsoft/unispeech-large-1500h-cv""": (
        """https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json"""
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}
class       a__   ( snake_case__				):
						_a							:   Tuple =   """unispeech"""






						def __init__(       self		,      _A=3_2		,      _A=7_6_8		,      _A=1_2		,      _A=1_2		,      _A=3_0_7_2		,      _A="gelu"		,      _A=0.1		,      _A=0.1		,      _A=0.1		,      _A=0.0		,      _A=0.0		,      _A=0.1		,      _A=0.1		,      _A=0.02		,      _A=1E-5		,      _A="group"		,      _A="gelu"		,      _A=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)		,      _A=(5, 2, 2, 2, 2, 2, 2)		,      _A=(1_0, 3, 3, 3, 3, 2, 2)		,      _A=False		,      _A=1_2_8		,      _A=1_6		,      _A=False		,      _A=True		,      _A=0.05		,      _A=1_0		,      _A=2		,      _A=0.0		,      _A=1_0		,      _A=0		,      _A=3_2_0		,      _A=2		,      _A=0.1		,      _A=1_0_0		,      _A=2_5_6		,      _A=2_5_6		,      _A=0.1		,      _A="mean"		,      _A=False		,      _A=False		,      _A=2_5_6		,      _A=8_0		,      _A=0		,      _A=1		,      _A=2		,      _A=0.5		,      **_A		,      ):




											"""simple docstring"""



											super().__init__(**_A		,      pad_token_id=_A		,      bos_token_id=_A		,      eos_token_id=_A      )
											__lowerCAmelCase           =	hidden_size
											__lowerCAmelCase           =	feat_extract_norm
											__lowerCAmelCase           =	feat_extract_activation
											__lowerCAmelCase           =	list(_A      )
											__lowerCAmelCase           =	list(_A      )
											__lowerCAmelCase           =	list(_A      )
											__lowerCAmelCase           =	conv_bias
											__lowerCAmelCase           =	num_conv_pos_embeddings
											__lowerCAmelCase           =	num_conv_pos_embedding_groups
											__lowerCAmelCase           =	len(self.conv_dim      )
											__lowerCAmelCase           =	num_hidden_layers
											__lowerCAmelCase           =	intermediate_size
											__lowerCAmelCase           =	hidden_act
											__lowerCAmelCase           =	num_attention_heads
											__lowerCAmelCase           =	hidden_dropout
											__lowerCAmelCase           =	attention_dropout
											__lowerCAmelCase           =	activation_dropout
											__lowerCAmelCase           =	feat_proj_dropout
											__lowerCAmelCase           =	final_dropout
											__lowerCAmelCase           =	layerdrop
											__lowerCAmelCase           =	layer_norm_eps
											__lowerCAmelCase           =	initializer_range
											__lowerCAmelCase           =	num_ctc_classes
											__lowerCAmelCase           =	vocab_size
											__lowerCAmelCase           =	do_stable_layer_norm
											__lowerCAmelCase           =	use_weighted_layer_sum
											__lowerCAmelCase           =	classifier_proj_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)`, but is `len(config.conv_dim) ="
																    f""" {len(self.conv_dim      )}`, `len(config.conv_stride) = {len(self.conv_stride      )}`,"""
																    f""" `len(config.conv_kernel) = {len(self.conv_kernel      )}`."""      )

											# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
											__lowerCAmelCase           =	apply_spec_augment
											__lowerCAmelCase           =	mask_time_prob
											__lowerCAmelCase           =	mask_time_length
											__lowerCAmelCase           =	mask_time_min_masks
											__lowerCAmelCase           =	mask_feature_prob
											__lowerCAmelCase           =	mask_feature_length
											__lowerCAmelCase           =	mask_feature_min_masks

											# parameters for pretraining with codevector quantized representations
											__lowerCAmelCase           =	num_codevectors_per_group
											__lowerCAmelCase           =	num_codevector_groups
											__lowerCAmelCase           =	contrastive_logits_temperature
											__lowerCAmelCase           =	feat_quantizer_dropout
											__lowerCAmelCase           =	num_negatives
											__lowerCAmelCase           =	codevector_dim
											__lowerCAmelCase           =	proj_codevector_dim
											__lowerCAmelCase           =	diversity_loss_weight

											# ctc loss
											__lowerCAmelCase           =	ctc_loss_reduction
											__lowerCAmelCase           =	ctc_zero_infinity

											# pretraining loss
											__lowerCAmelCase           =	replace_prob






						@property
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



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










UpperCamelCase__         =      """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




