
import gc
import random
import tempfile
import unittest

import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMInverseScheduler,
    DDIMScheduler,
    DPMSolverMultistepInverseScheduler,
    DPMSolverMultistepScheduler,
    StableDiffusionDiffEditPipeline,
    UNetaDConditionModel,
)
from diffusers.utils import load_image, slow
from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, require_torch_gpu, torch_device

from ..pipeline_params import TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS, TEXT_GUIDED_IMAGE_INPAINTING_PARAMS
from ..test_pipelines_common import PipelineLatentTesterMixin, PipelineTesterMixin


enable_full_determinism()





class       __A(				__UpperCAmelCase     ,		__UpperCAmelCase     ,		unittest.TestCase       ):
					SCREAMING_SNAKE_CASE			    =    StableDiffusionDiffEditPipeline
					SCREAMING_SNAKE_CASE			    =    TEXT_GUIDED_IMAGE_INPAINTING_PARAMS - {'''height''', '''width''', '''image'''} | {'''image_latents'''}
					SCREAMING_SNAKE_CASE			    =    TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS - {'''image'''} | {'''image_latents'''}
					SCREAMING_SNAKE_CASE			    =    frozenset(
					    []       )  # TO-DO: update image_params once pipeline is refactored with VaeImageProcessor.preprocess
					SCREAMING_SNAKE_CASE			    =    frozenset([]       )

					def    lowercase__      (	self					:     List[str]   ):
												torch.manual_seed(0   )
												lowerCamelCase_							  =					UNetaDConditionModel(
												    block_out_channels=(3_2, 6_4)   ,					layers_per_block=2   ,					sample_size=3_2   ,					in_channels=4   ,					out_channels=4   ,					down_block_types=("""DownBlock2D""", """CrossAttnDownBlock2D""")   ,					up_block_types=("""CrossAttnUpBlock2D""", """UpBlock2D""")   ,					cross_attention_dim=3_2   ,					attention_head_dim=(2, 4)   ,					use_linear_projection=lowerCAmelCase_   ,					)
												lowerCamelCase_							  =					DDIMScheduler(
												    beta_start=0.00085   ,					beta_end=0.012   ,					beta_schedule="""scaled_linear"""   ,					clip_sample=lowerCAmelCase_   ,					set_alpha_to_one=lowerCAmelCase_   ,					)
												lowerCamelCase_							  =					DDIMInverseScheduler(
												    beta_start=0.00085   ,					beta_end=0.012   ,					beta_schedule="""scaled_linear"""   ,					clip_sample=lowerCAmelCase_   ,					set_alpha_to_zero=lowerCAmelCase_   ,					)
												torch.manual_seed(0   )
												lowerCamelCase_							  =					AutoencoderKL(
												    block_out_channels=[3_2, 6_4]   ,					in_channels=3   ,					out_channels=3   ,					down_block_types=["""DownEncoderBlock2D""", """DownEncoderBlock2D"""]   ,					up_block_types=["""UpDecoderBlock2D""", """UpDecoderBlock2D"""]   ,					latent_channels=4   ,					sample_size=1_2_8   ,					)
												torch.manual_seed(0   )
												lowerCamelCase_							  =					CLIPTextConfig(
												    bos_token_id=0   ,					eos_token_id=2   ,					hidden_size=3_2   ,					intermediate_size=3_7   ,					layer_norm_eps=1E-05   ,					num_attention_heads=4   ,					num_hidden_layers=5   ,					pad_token_id=1   ,					vocab_size=1_0_0_0   ,					hidden_act="""gelu"""   ,					projection_dim=5_1_2   ,					)
												lowerCamelCase_							  =					CLIPTextModel(lowerCAmelCase_   )
												lowerCamelCase_							  =					CLIPTokenizer.from_pretrained("""hf-internal-testing/tiny-random-clip"""   )

												lowerCamelCase_							  =					{
												    """unet""": unet,
												    """scheduler""": scheduler,
												    """inverse_scheduler""": inverse_scheduler,
												    """vae""": vae,
												    """text_encoder""": text_encoder,
												    """tokenizer""": tokenizer,
												    """safety_checker""": None,
												    """feature_extractor""": None,
												}

												return components

					def    lowercase__      (	self					:     int   ,					__UpperCamelCase					:     List[Any]   ,					__UpperCamelCase					:     Dict=0   ):
												lowerCamelCase_							  =					floats_tensor((1, 1_6, 1_6)   ,					rng=random.Random(lowerCAmelCase_   )   ).to(lowerCAmelCase_   )
												lowerCamelCase_							  =					floats_tensor((1, 2, 4, 1_6, 1_6)   ,					rng=random.Random(lowerCAmelCase_   )   ).to(lowerCAmelCase_   )
												if str(lowerCAmelCase_   ).startswith("""mps"""   ):
																			lowerCamelCase_							  =					torch.manual_seed(lowerCAmelCase_   )
												else:
																			lowerCamelCase_							  =					torch.Generator(device=lowerCAmelCase_   ).manual_seed(lowerCAmelCase_   )
												lowerCamelCase_							  =					{
												    """prompt""": """a dog and a newt""",
												    """mask_image""": mask,
												    """image_latents""": latents,
												    """generator""": generator,
												    """num_inference_steps""": 2,
												    """inpaint_strength""": 1.0,
												    """guidance_scale""": 6.0,
												    """output_type""": """numpy""",
												}

												return inputs

					def    lowercase__      (	self					:     List[str]   ,					__UpperCamelCase					:     List[Any]   ,					__UpperCamelCase					:     str=0   ):
												lowerCamelCase_							  =					floats_tensor((1, 3, 3_2, 3_2)   ,					rng=random.Random(lowerCAmelCase_   )   ).to(lowerCAmelCase_   )
												lowerCamelCase_							  =					image.cpu().permute(0   ,					2   ,					3   ,					1   )[0]
												lowerCamelCase_							  =					Image.fromarray(np.uinta(lowerCAmelCase_   )   ).convert("""RGB"""   )
												if str(lowerCAmelCase_   ).startswith("""mps"""   ):
																			lowerCamelCase_							  =					torch.manual_seed(lowerCAmelCase_   )
												else:
																			lowerCamelCase_							  =					torch.Generator(device=lowerCAmelCase_   ).manual_seed(lowerCAmelCase_   )
												lowerCamelCase_							  =					{
												    """image""": image,
												    """source_prompt""": """a cat and a frog""",
												    """target_prompt""": """a dog and a newt""",
												    """generator""": generator,
												    """num_inference_steps""": 2,
												    """num_maps_per_mask""": 2,
												    """mask_encode_strength""": 1.0,
												    """guidance_scale""": 6.0,
												    """output_type""": """numpy""",
												}

												return inputs

					def    lowercase__      (	self					:     int   ,					__UpperCamelCase					:     Tuple   ,					__UpperCamelCase					:     Optional[Any]=0   ):
												lowerCamelCase_							  =					floats_tensor((1, 3, 3_2, 3_2)   ,					rng=random.Random(lowerCAmelCase_   )   ).to(lowerCAmelCase_   )
												lowerCamelCase_							  =					image.cpu().permute(0   ,					2   ,					3   ,					1   )[0]
												lowerCamelCase_							  =					Image.fromarray(np.uinta(lowerCAmelCase_   )   ).convert("""RGB"""   )
												if str(lowerCAmelCase_   ).startswith("""mps"""   ):
																			lowerCamelCase_							  =					torch.manual_seed(lowerCAmelCase_   )
												else:
																			lowerCamelCase_							  =					torch.Generator(device=lowerCAmelCase_   ).manual_seed(lowerCAmelCase_   )
												lowerCamelCase_							  =					{
												    """image""": image,
												    """prompt""": """a cat and a frog""",
												    """generator""": generator,
												    """num_inference_steps""": 2,
												    """inpaint_strength""": 1.0,
												    """guidance_scale""": 6.0,
												    """decode_latents""": True,
												    """output_type""": """numpy""",
												}
												return inputs

					def    lowercase__      (	self					:     Dict   ):







												if not hasattr(self.pipeline_class   ,					"""_optional_components"""   ):
																			return

												lowerCamelCase_							  =					self.get_dummy_components()
												lowerCamelCase_							  =					self.pipeline_class(**lowerCAmelCase_   )
												pipe.to(lowerCAmelCase_   )
												pipe.set_progress_bar_config(disable=lowerCAmelCase_   )

												# set all optional components to None and update pipeline config accordingly
												for optional_component in pipe._optional_components:
																			setattr(lowerCAmelCase_   ,					lowerCAmelCase_   ,					lowerCAmelCase_   )
												pipe.register_modules(**{optional_component: None for optional_component in pipe._optional_components}   )

												lowerCamelCase_							  =					self.get_dummy_inputs(lowerCAmelCase_   )
												lowerCamelCase_							  =					pipe(**lowerCAmelCase_   )[0]

												with tempfile.TemporaryDirectory() as tmpdir:
																			pipe.save_pretrained(lowerCAmelCase_   )
																			lowerCamelCase_							  =					self.pipeline_class.from_pretrained(lowerCAmelCase_   )
																			pipe_loaded.to(lowerCAmelCase_   )
																			pipe_loaded.set_progress_bar_config(disable=lowerCAmelCase_   )

												for optional_component in pipe._optional_components:
																			self.assertTrue(
																			    getattr(lowerCAmelCase_   ,					lowerCAmelCase_   ) is None   ,					F'''`{optional_component}` did not stay set to None after loading.'''   ,					)

												lowerCamelCase_							  =					self.get_dummy_inputs(lowerCAmelCase_   )
												lowerCamelCase_							  =					pipe_loaded(**lowerCAmelCase_   )[0]

												lowerCamelCase_							  =					np.abs(output - output_loaded   ).max()
												self.assertLess(lowerCAmelCase_   ,					1E-4   )

					def    lowercase__      (	self					:     List[str]   ):
												lowerCamelCase_							  =					"""cpu"""

												lowerCamelCase_							  =					self.get_dummy_components()
												lowerCamelCase_							  =					self.pipeline_class(**lowerCAmelCase_   )
												pipe.to(lowerCAmelCase_   )
												pipe.set_progress_bar_config(disable=lowerCAmelCase_   )

												lowerCamelCase_							  =					self.get_dummy_mask_inputs(lowerCAmelCase_   )
												lowerCamelCase_							  =					pipe.generate_mask(**lowerCAmelCase_   )
												lowerCamelCase_							  =					mask[0, -3:, -3:]

												self.assertEqual(mask.shape   ,					(1, 1_6, 1_6)   )
												lowerCamelCase_							  =					np.array([0] * 9   )
												lowerCamelCase_							  =					np.abs(mask_slice.flatten() - expected_slice   ).max()
												self.assertLessEqual(lowerCAmelCase_   ,					1E-3   )
												self.assertEqual(mask[0, -3, -4]   ,					0   )

					def    lowercase__      (	self					:     Any   ):
												lowerCamelCase_							  =					"""cpu"""

												lowerCamelCase_							  =					self.get_dummy_components()
												lowerCamelCase_							  =					self.pipeline_class(**lowerCAmelCase_   )
												pipe.to(lowerCAmelCase_   )
												pipe.set_progress_bar_config(disable=lowerCAmelCase_   )

												lowerCamelCase_							  =					self.get_dummy_inversion_inputs(lowerCAmelCase_   )
												lowerCamelCase_							  =					pipe.invert(**lowerCAmelCase_   ).images
												lowerCamelCase_							  =					image[0, -1, -3:, -3:]

												self.assertEqual(image.shape   ,					(2, 3_2, 3_2, 3)   )
												lowerCamelCase_							  =					np.array(
												    [0.5150, 0.5134, 0.5043, 0.5376, 0.4694, 0.51050, 0.5015, 0.4407, 0.4799]   ,					)
												lowerCamelCase_							  =					np.abs(image_slice.flatten() - expected_slice   ).max()
												self.assertLessEqual(lowerCAmelCase_   ,					1E-3   )

					def    lowercase__      (	self					:     Optional[int]   ):
												super().test_inference_batch_single_identical(expected_max_diff=5E-3   )



					def    lowercase__      (	self					:     List[Any]   ):
												lowerCamelCase_							  =					"""cpu"""

												lowerCamelCase_							  =					self.get_dummy_components()

												lowerCamelCase_							  =					{"""beta_start""": 0.00085, """beta_end""": 0.012, """beta_schedule""": """scaled_linear"""}
												lowerCamelCase_							  =					DPMSolverMultistepScheduler(**lowerCAmelCase_   )
												lowerCamelCase_							  =					DPMSolverMultistepInverseScheduler(**lowerCAmelCase_   )

												lowerCamelCase_							  =					self.pipeline_class(**lowerCAmelCase_   )
												pipe.to(lowerCAmelCase_   )
												pipe.set_progress_bar_config(disable=lowerCAmelCase_   )

												lowerCamelCase_							  =					self.get_dummy_inversion_inputs(lowerCAmelCase_   )
												lowerCamelCase_							  =					pipe.invert(**lowerCAmelCase_   ).images
												lowerCamelCase_							  =					image[0, -1, -3:, -3:]

												self.assertEqual(image.shape   ,					(2, 3_2, 3_2, 3)   )
												lowerCamelCase_							  =					np.array(
												    [0.5150, 0.5134, 0.5043, 0.5376, 0.4694, 0.51050, 0.5015, 0.4407, 0.4799]   ,					)
												lowerCamelCase_							  =					np.abs(image_slice.flatten() - expected_slice   ).max()
												self.assertLessEqual(lowerCAmelCase_   ,					1E-3   )





@require_torch_gpu
@slow
class       __A(				unittest.TestCase       ):

					def    lowercase__      (	self					:     Any   ):
												super().tearDown()
												gc.collect()
												torch.cuda.empty_cache()

					@classmethod
					def    lowercase__      (	cls					:     int   ):
												lowerCamelCase_							  =					load_image(
												    """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/diffedit/fruit.png"""   )

												lowerCamelCase_							  =					raw_image.convert("""RGB"""   ).resize((7_6_8, 7_6_8)   )

												lowerCamelCase_							  =					raw_image

					def    lowercase__      (	self					:     int   ):
												lowerCamelCase_							  =					torch.manual_seed(0   )

												lowerCamelCase_							  =					StableDiffusionDiffEditPipeline.from_pretrained(
												    """stabilityai/stable-diffusion-2-1"""   ,					safety_checker=lowerCAmelCase_   ,					torch_dtype=torch.floataa   )
												lowerCamelCase_							  =					DDIMScheduler.from_config(pipe.scheduler.config   )
												lowerCamelCase_							  =					DDIMInverseScheduler.from_config(pipe.scheduler.config   )
												pipe.enable_model_cpu_offload()
												pipe.set_progress_bar_config(disable=lowerCAmelCase_   )

												lowerCamelCase_							  =					"""a bowl of fruit"""
												lowerCamelCase_							  =					"""a bowl of pears"""

												lowerCamelCase_							  =					pipe.generate_mask(
												    image=self.raw_image   ,					source_prompt=lowerCAmelCase_   ,					target_prompt=lowerCAmelCase_   ,					generator=lowerCAmelCase_   ,					)

												lowerCamelCase_							  =					pipe.invert(
												    prompt=lowerCAmelCase_   ,					image=self.raw_image   ,					inpaint_strength=0.7   ,					generator=lowerCAmelCase_   ).latents

												lowerCamelCase_							  =					pipe(
												    prompt=lowerCAmelCase_   ,					mask_image=lowerCAmelCase_   ,					image_latents=lowerCAmelCase_   ,					generator=lowerCAmelCase_   ,					negative_prompt=lowerCAmelCase_   ,					inpaint_strength=0.7   ,					output_type="""numpy"""   ,					).images[0]

												lowerCamelCase_							  =					(
												    np.array(
												        load_image(
												            """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"""
												            """/diffedit/pears.png"""   ).resize((7_6_8, 7_6_8)   )   )
												    / 2_5_5
												)
												assert np.abs((expected_image - image).max()   ) < 5E-1



					def    lowercase__      (	self					:     Any   ):
												lowerCamelCase_							  =					torch.manual_seed(0   )

												lowerCamelCase_							  =					StableDiffusionDiffEditPipeline.from_pretrained(
												    """stabilityai/stable-diffusion-2-1"""   ,					safety_checker=lowerCAmelCase_   ,					torch_dtype=torch.floataa   )
												lowerCamelCase_							  =					DPMSolverMultistepScheduler.from_config(pipe.scheduler.config   )
												lowerCamelCase_							  =					DPMSolverMultistepInverseScheduler.from_config(pipe.scheduler.config   )
												pipe.enable_model_cpu_offload()
												pipe.set_progress_bar_config(disable=lowerCAmelCase_   )

												lowerCamelCase_							  =					"""a bowl of fruit"""
												lowerCamelCase_							  =					"""a bowl of pears"""

												lowerCamelCase_							  =					pipe.generate_mask(
												    image=self.raw_image   ,					source_prompt=lowerCAmelCase_   ,					target_prompt=lowerCAmelCase_   ,					generator=lowerCAmelCase_   ,					)

												lowerCamelCase_							  =					pipe.invert(
												    prompt=lowerCAmelCase_   ,					image=self.raw_image   ,					inpaint_strength=0.7   ,					generator=lowerCAmelCase_   ,					num_inference_steps=2_5   ,					).latents

												lowerCamelCase_							  =					pipe(
												    prompt=lowerCAmelCase_   ,					mask_image=lowerCAmelCase_   ,					image_latents=lowerCAmelCase_   ,					generator=lowerCAmelCase_   ,					negative_prompt=lowerCAmelCase_   ,					inpaint_strength=0.7   ,					num_inference_steps=2_5   ,					output_type="""numpy"""   ,					).images[0]

												lowerCamelCase_							  =					(
												    np.array(
												        load_image(
												            """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"""
												            """/diffedit/pears.png"""   ).resize((7_6_8, 7_6_8)   )   )
												    / 2_5_5
												)
												assert np.abs((expected_image - image).max()   ) < 5E-1







import functools
import operator

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


lowercase        =  logging.get_logger(__name__)

lowercase        =  {
    '''facebook/wav2vec2-base-960h''': '''https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json''',
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}





class       __A(				UpperCAmelCase       ):
					SCREAMING_SNAKE_CASE			    =    '''wav2vec2'''

					def __init__(	self					:     Tuple   ,					__UpperCamelCase					:     Optional[int]=3_2   ,					__UpperCamelCase					:     List[str]=7_6_8   ,					__UpperCamelCase					:     Tuple=1_2   ,					__UpperCamelCase					:     str=1_2   ,					__UpperCamelCase					:     Any=3_0_7_2   ,					__UpperCamelCase					:     Tuple="gelu"   ,					__UpperCamelCase					:     Tuple=0.1   ,					__UpperCamelCase					:     Any=0.1   ,					__UpperCamelCase					:     List[str]=0.1   ,					__UpperCamelCase					:     List[Any]=0.0   ,					__UpperCamelCase					:     str=0.0   ,					__UpperCamelCase					:     str=0.1   ,					__UpperCamelCase					:     List[Any]=0.1   ,					__UpperCamelCase					:     Dict=0.02   ,					__UpperCamelCase					:     int=1E-5   ,					__UpperCamelCase					:     Dict="group"   ,					__UpperCamelCase					:     Tuple="gelu"   ,					__UpperCamelCase					:     Optional[int]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)   ,					__UpperCamelCase					:     Union[str, Any]=(5, 2, 2, 2, 2, 2, 2)   ,					__UpperCamelCase					:     int=(1_0, 3, 3, 3, 3, 2, 2)   ,					__UpperCamelCase					:     List[Any]=False   ,					__UpperCamelCase					:     Tuple=1_2_8   ,					__UpperCamelCase					:     Any=1_6   ,					__UpperCamelCase					:     List[str]=False   ,					__UpperCamelCase					:     List[str]=True   ,					__UpperCamelCase					:     Dict=0.05   ,					__UpperCamelCase					:     Union[str, Any]=1_0   ,					__UpperCamelCase					:     int=2   ,					__UpperCamelCase					:     List[Any]=0.0   ,					__UpperCamelCase					:     List[Any]=1_0   ,					__UpperCamelCase					:     List[str]=0   ,					__UpperCamelCase					:     Optional[Any]=3_2_0   ,					__UpperCamelCase					:     Optional[int]=2   ,					__UpperCamelCase					:     List[Any]=0.1   ,					__UpperCamelCase					:     int=1_0_0   ,					__UpperCamelCase					:     int=2_5_6   ,					__UpperCamelCase					:     str=2_5_6   ,					__UpperCamelCase					:     Dict=0.1   ,					__UpperCamelCase					:     Union[str, Any]="sum"   ,					__UpperCamelCase					:     Optional[int]=False   ,					__UpperCamelCase					:     Optional[int]=False   ,					__UpperCamelCase					:     Dict=2_5_6   ,					__UpperCamelCase					:     List[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)   ,					__UpperCamelCase					:     int=(5, 3, 3, 1, 1)   ,					__UpperCamelCase					:     Optional[Any]=(1, 2, 3, 1, 1)   ,					__UpperCamelCase					:     Dict=5_1_2   ,					__UpperCamelCase					:     Any=0   ,					__UpperCamelCase					:     Union[str, Any]=1   ,					__UpperCamelCase					:     List[str]=2   ,					__UpperCamelCase					:     List[str]=False   ,					__UpperCamelCase					:     int=3   ,					__UpperCamelCase					:     Dict=2   ,					__UpperCamelCase					:     Optional[Any]=3   ,					__UpperCamelCase					:     Optional[int]=None   ,					__UpperCamelCase					:     Tuple=None   ,					**__UpperCamelCase					:     Tuple   ,					):
												super().__init__(**__UpperCamelCase   ,					pad_token_id=__UpperCamelCase   ,					bos_token_id=__UpperCamelCase   ,					eos_token_id=__UpperCamelCase   )
												lowerCamelCase_							  =					hidden_size
												lowerCamelCase_							  =					feat_extract_norm
												lowerCamelCase_							  =					feat_extract_activation
												lowerCamelCase_							  =					list(__UpperCamelCase   )
												lowerCamelCase_							  =					list(__UpperCamelCase   )
												lowerCamelCase_							  =					list(__UpperCamelCase   )
												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_							  =					vocab_size
												lowerCamelCase_							  =					do_stable_layer_norm
												lowerCamelCase_							  =					use_weighted_layer_sum

												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

												# adapter
												lowerCamelCase_							  =					add_adapter
												lowerCamelCase_							  =					adapter_kernel_size
												lowerCamelCase_							  =					adapter_stride
												lowerCamelCase_							  =					num_adapter_layers
												lowerCamelCase_							  =					output_hidden_size or hidden_size
												lowerCamelCase_							  =					adapter_attn_dim

												# SequenceClassification-specific parameter. Feel free to ignore for other classes.
												lowerCamelCase_							  =					classifier_proj_size

												# XVector-specific parameters. Feel free to ignore for other classes.
												lowerCamelCase_							  =					list(__UpperCamelCase   )
												lowerCamelCase_							  =					list(__UpperCamelCase   )
												lowerCamelCase_							  =					list(__UpperCamelCase   )
												lowerCamelCase_							  =					xvector_output_dim



					@property
					def    lowercase__      (	self					:     Dict   ):
												return functools.reduce(operator.mul   ,					self.conv_stride   ,					1   )





