





import gc
import random
import tempfile
import unittest

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

from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel
from diffusers.pipelines.stable_diffusion_safe import StableDiffusionPipelineSafe as StableDiffusionPipeline
from diffusers.utils import floats_tensor, nightly, torch_device
from diffusers.utils.testing_utils import require_torch_gpu






class        snake_case_    (		unittest.TestCase						):






  def 				UpperCAmelCase__						(							self			:					Any      )->Tuple:






   '''simple docstring'''

   super().tearDown()
   gc.collect()
   torch.cuda.empty_cache()






  @property
  def 				UpperCAmelCase__						(							self			:					Optional[Any]      )->List[Any]:






   '''simple docstring'''

   __lowerCAmelCase					:	Union[str, Any]      =       1
   __lowerCAmelCase					:	List[str]      =       3
   __lowerCAmelCase					:	str      =       (32, 32)

   __lowerCAmelCase					:	List[str]      =       floats_tensor((batch_size, num_channels) + sizes       ,  rng=random.Random(0      )      ).to(_snake_case      )
   return image






  @property
  def 				UpperCAmelCase__						(							self			:					int      )->List[Any]:






   '''simple docstring'''

   torch.manual_seed(0      )
   __lowerCAmelCase					:	List[str]      =       UNetaDConditionModel(
       block_out_channels=(32, 64)       ,  layers_per_block=2       ,  sample_size=32       ,  in_channels=4       ,  out_channels=4       ,  down_block_types=("""DownBlock2D""", """CrossAttnDownBlock2D""")       ,  up_block_types=("""CrossAttnUpBlock2D""", """UpBlock2D""")       ,  cross_attention_dim=32       ,  )
   return model






  @property
  def 				UpperCAmelCase__						(							self			:					Optional[Any]      )->List[str]:






   '''simple docstring'''

   torch.manual_seed(0      )
   __lowerCAmelCase					:	str      =       AutoencoderKL(
       block_out_channels=[32, 64]       ,  in_channels=3       ,  out_channels=3       ,  down_block_types=["""DownEncoderBlock2D""", """DownEncoderBlock2D"""]       ,  up_block_types=["""UpDecoderBlock2D""", """UpDecoderBlock2D"""]       ,  latent_channels=4       ,  )
   return model






  @property
  def 				UpperCAmelCase__						(							self			:					str      )->int:






   '''simple docstring'''

   torch.manual_seed(0      )
   __lowerCAmelCase					:	Optional[int]      =       CLIPTextConfig(
       bos_token_id=0       ,  eos_token_id=2       ,  hidden_size=32       ,  intermediate_size=37       ,  layer_norm_eps=1E-05       ,  num_attention_heads=4       ,  num_hidden_layers=5       ,  pad_token_id=1       ,  vocab_size=1000       ,  )
   return CLIPTextModel(_snake_case      )






  @property
  def 				UpperCAmelCase__						(							self			:					Optional[int]      )->int:






   '''simple docstring'''

   def extract(*_snake_case			:					Any       ,  **_snake_case			:					Dict      ):






    class        snake_case_    :






      def __init__(							self			:					Dict      )->str:






       '''simple docstring'''

       __lowerCAmelCase					:	List[str]      =       torch.ones([0]      )






      def 				UpperCAmelCase__						(							self			:					Tuple       ,  _snake_case			:					Dict      )->Union[str, Any]:






       '''simple docstring'''

       self.pixel_values.to(_snake_case      )
       return self



    return Out()

   return extract






  def 				UpperCAmelCase__						(							self			:					int      )->Union[str, Any]:






   '''simple docstring'''

   __lowerCAmelCase					:	Union[str, Any]      =       """cpu"""  # ensure determinism for the device-dependent torch.Generator
   __lowerCAmelCase					:	Dict      =       self.dummy_cond_unet
   __lowerCAmelCase					:	Union[str, Any]      =       DDIMScheduler(
       beta_start=0.00_085       ,  beta_end=0.012       ,  beta_schedule="""scaled_linear"""       ,  clip_sample=_snake_case       ,  set_alpha_to_one=_snake_case       ,  )

   __lowerCAmelCase					:	int      =       self.dummy_vae
   __lowerCAmelCase					:	Dict      =       self.dummy_text_encoder
   __lowerCAmelCase					:	str      =       CLIPTokenizer.from_pretrained("""hf-internal-testing/tiny-random-clip"""      )

   # make sure here that pndm scheduler skips prk
   __lowerCAmelCase					:	int      =       StableDiffusionPipeline(
       unet=_snake_case       ,  scheduler=_snake_case       ,  vae=_snake_case       ,  text_encoder=_snake_case       ,  tokenizer=_snake_case       ,  safety_checker=_snake_case       ,  feature_extractor=self.dummy_extractor       ,  )
   __lowerCAmelCase					:	List[str]      =       sd_pipe.to(_snake_case      )
   sd_pipe.set_progress_bar_config(disable=_snake_case      )

   __lowerCAmelCase					:	Optional[int]      =       """A painting of a squirrel eating a burger"""

   __lowerCAmelCase					:	List[Any]      =       torch.Generator(device=_snake_case      ).manual_seed(0      )
   __lowerCAmelCase					:	Optional[Any]      =       sd_pipe([prompt]       ,  generator=_snake_case       ,  guidance_scale=6.0       ,  num_inference_steps=2       ,  output_type="""np"""      )
   __lowerCAmelCase					:	List[Any]      =       output.images

   __lowerCAmelCase					:	Tuple      =       torch.Generator(device=_snake_case      ).manual_seed(0      )
   __lowerCAmelCase					:	Any      =       sd_pipe(
       [prompt]       ,  generator=_snake_case       ,  guidance_scale=6.0       ,  num_inference_steps=2       ,  output_type="""np"""       ,  return_dict=_snake_case       ,  )[0]

   __lowerCAmelCase					:	List[Any]      =       image[0, -3:, -3:, -1]
   __lowerCAmelCase					:	int      =       image_from_tuple[0, -3:, -3:, -1]

   assert image.shape == (1, 64, 64, 3)
   __lowerCAmelCase					:	List[Any]      =       np.array([0.5_756, 0.6_118, 0.5_005, 0.5_041, 0.5_471, 0.4_726, 0.4_976, 0.4_865, 0.4_864]      )

   assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1E-2
   assert np.abs(image_from_tuple_slice.flatten() - expected_slice      ).max() < 1E-2






  def 				UpperCAmelCase__						(							self			:					str      )->List[Any]:






   '''simple docstring'''

   __lowerCAmelCase					:	Dict      =       """cpu"""  # ensure determinism for the device-dependent torch.Generator
   __lowerCAmelCase					:	Dict      =       self.dummy_cond_unet
   __lowerCAmelCase					:	str      =       PNDMScheduler(skip_prk_steps=_snake_case      )
   __lowerCAmelCase					:	int      =       self.dummy_vae
   __lowerCAmelCase					:	Dict      =       self.dummy_text_encoder
   __lowerCAmelCase					:	Dict      =       CLIPTokenizer.from_pretrained("""hf-internal-testing/tiny-random-clip"""      )

   # make sure here that pndm scheduler skips prk
   __lowerCAmelCase					:	Any      =       StableDiffusionPipeline(
       unet=_snake_case       ,  scheduler=_snake_case       ,  vae=_snake_case       ,  text_encoder=_snake_case       ,  tokenizer=_snake_case       ,  safety_checker=_snake_case       ,  feature_extractor=self.dummy_extractor       ,  )
   __lowerCAmelCase					:	Optional[Any]      =       sd_pipe.to(_snake_case      )
   sd_pipe.set_progress_bar_config(disable=_snake_case      )

   __lowerCAmelCase					:	Any      =       """A painting of a squirrel eating a burger"""
   __lowerCAmelCase					:	List[str]      =       torch.Generator(device=_snake_case      ).manual_seed(0      )
   __lowerCAmelCase					:	Dict      =       sd_pipe([prompt]       ,  generator=_snake_case       ,  guidance_scale=6.0       ,  num_inference_steps=2       ,  output_type="""np"""      )

   __lowerCAmelCase					:	Optional[int]      =       output.images

   __lowerCAmelCase					:	Union[str, Any]      =       torch.Generator(device=_snake_case      ).manual_seed(0      )
   __lowerCAmelCase					:	Optional[int]      =       sd_pipe(
       [prompt]       ,  generator=_snake_case       ,  guidance_scale=6.0       ,  num_inference_steps=2       ,  output_type="""np"""       ,  return_dict=_snake_case       ,  )[0]

   __lowerCAmelCase					:	Optional[Any]      =       image[0, -3:, -3:, -1]
   __lowerCAmelCase					:	Optional[int]      =       image_from_tuple[0, -3:, -3:, -1]

   assert image.shape == (1, 64, 64, 3)
   __lowerCAmelCase					:	Dict      =       np.array([0.5_125, 0.5_716, 0.4_828, 0.5_060, 0.5_650, 0.4_768, 0.5_185, 0.4_895, 0.4_993]      )

   assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1E-2
   assert np.abs(image_from_tuple_slice.flatten() - expected_slice      ).max() < 1E-2






  def 				UpperCAmelCase__						(							self			:					Tuple      )->Union[str, Any]:






   '''simple docstring'''

   __lowerCAmelCase					:	Union[str, Any]      =       StableDiffusionPipeline.from_pretrained(
       """hf-internal-testing/tiny-stable-diffusion-lms-pipe"""       ,  safety_checker=_snake_case      )
   assert isinstance(_snake_case       ,  _snake_case      )
   assert isinstance(pipe.scheduler       ,  _snake_case      )
   assert pipe.safety_checker is None

   __lowerCAmelCase					:	str      =       pipe("""example prompt"""       ,  num_inference_steps=2      ).images[0]
   assert image is not None

   # check that there's no error when saving a pipeline with one of the models being None
   with tempfile.TemporaryDirectory() as tmpdirname:
    pipe.save_pretrained(_snake_case      )
    __lowerCAmelCase					:	Optional[Any]      =       StableDiffusionPipeline.from_pretrained(_snake_case      )

   # sanity check that the pipeline still works
   assert pipe.safety_checker is None
   __lowerCAmelCase					:	List[Any]      =       pipe("""example prompt"""       ,  num_inference_steps=2      ).images[0]
   assert image is not None






  @unittest.skipIf(torch_device != """cuda"""       ,  """This test requires a GPU"""      )
  def 				UpperCAmelCase__						(							self			:					str      )->List[str]:






   '''simple docstring'''

   __lowerCAmelCase					:	List[Any]      =       self.dummy_cond_unet
   __lowerCAmelCase					:	str      =       PNDMScheduler(skip_prk_steps=_snake_case      )
   __lowerCAmelCase					:	List[str]      =       self.dummy_vae
   __lowerCAmelCase					:	str      =       self.dummy_text_encoder
   __lowerCAmelCase					:	Any      =       CLIPTokenizer.from_pretrained("""hf-internal-testing/tiny-random-clip"""      )

   # put models in fp16
   __lowerCAmelCase					:	int      =       unet.half()
   __lowerCAmelCase					:	Optional[Any]      =       vae.half()
   __lowerCAmelCase					:	Tuple      =       bert.half()

   # make sure here that pndm scheduler skips prk
   __lowerCAmelCase					:	int      =       StableDiffusionPipeline(
       unet=_snake_case       ,  scheduler=_snake_case       ,  vae=_snake_case       ,  text_encoder=_snake_case       ,  tokenizer=_snake_case       ,  safety_checker=_snake_case       ,  feature_extractor=self.dummy_extractor       ,  )
   __lowerCAmelCase					:	Tuple      =       sd_pipe.to(_snake_case      )
   sd_pipe.set_progress_bar_config(disable=_snake_case      )

   __lowerCAmelCase					:	Optional[Any]      =       """A painting of a squirrel eating a burger"""
   __lowerCAmelCase					:	Dict      =       sd_pipe([prompt]       ,  num_inference_steps=2       ,  output_type="""np"""      ).images

   assert image.shape == (1, 64, 64, 3)






@nightly
@require_torch_gpu
class        snake_case_    (		unittest.TestCase						):






  def 				UpperCAmelCase__						(							self			:					str      )->Dict:






   '''simple docstring'''

   super().tearDown()
   gc.collect()
   torch.cuda.empty_cache()






  def 				UpperCAmelCase__						(							self			:					Tuple      )->Tuple:






   '''simple docstring'''

   __lowerCAmelCase					:	Tuple      =       StableDiffusionPipeline.from_pretrained("""runwayml/stable-diffusion-v1-5"""       ,  safety_checker=_snake_case      )
   __lowerCAmelCase					:	str      =       LMSDiscreteScheduler.from_config(sd_pipe.scheduler.config      )
   __lowerCAmelCase					:	Tuple      =       sd_pipe.to(_snake_case      )
   sd_pipe.set_progress_bar_config(disable=_snake_case      )

   __lowerCAmelCase					:	List[str]      =       (
       """portrait of girl with smokey eyes makeup in abandoned hotel, grange clothes, redshift, wide high angle"""
       """ coloured polaroid photograph with flash, kodak film, hyper real, stunning moody cinematography, with"""
       """ anamorphic lenses, by maripol, fallen angels by wong kar - wai, style of suspiria and neon demon and"""
       """ children from bahnhof zoo, detailed """
   )
   __lowerCAmelCase					:	List[str]      =       4003660346
   __lowerCAmelCase					:	List[str]      =       7

   # without safety guidance (sld_guidance_scale = 0)
   __lowerCAmelCase					:	int      =       torch.manual_seed(_snake_case      )
   __lowerCAmelCase					:	Optional[int]      =       sd_pipe(
       [prompt]       ,  generator=_snake_case       ,  guidance_scale=_snake_case       ,  num_inference_steps=50       ,  output_type="""np"""       ,  width=512       ,  height=512       ,  sld_guidance_scale=0       ,  )

   __lowerCAmelCase					:	Optional[int]      =       output.images
   __lowerCAmelCase					:	List[str]      =       image[0, -3:, -3:, -1]
   __lowerCAmelCase					:	str      =       [0.2_278, 0.2_231, 0.2_249, 0.2_333, 0.2_303, 0.1_885, 0.2_273, 0.2_144, 0.2_176]

   assert image.shape == (1, 512, 512, 3)

   assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1E-2

   # without safety guidance (strong configuration)
   __lowerCAmelCase					:	List[Any]      =       torch.manual_seed(_snake_case      )
   __lowerCAmelCase					:	Union[str, Any]      =       sd_pipe(
       [prompt]       ,  generator=_snake_case       ,  guidance_scale=_snake_case       ,  num_inference_steps=50       ,  output_type="""np"""       ,  width=512       ,  height=512       ,  sld_guidance_scale=2000       ,  sld_warmup_steps=7       ,  sld_threshold=0.025       ,  sld_momentum_scale=0.5       ,  sld_mom_beta=0.7       ,  )

   __lowerCAmelCase					:	Any      =       output.images
   __lowerCAmelCase					:	Dict      =       image[0, -3:, -3:, -1]
   __lowerCAmelCase					:	Any      =       [0.2_383, 0.2_276, 0.236, 0.2_192, 0.2_186, 0.2_053, 0.1_971, 0.1_901, 0.1_719]

   assert image.shape == (1, 512, 512, 3)

   assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1E-2






  def 				UpperCAmelCase__						(							self			:					Union[str, Any]      )->Union[str, Any]:






   '''simple docstring'''

   __lowerCAmelCase					:	int      =       StableDiffusionPipeline.from_pretrained("""runwayml/stable-diffusion-v1-5"""       ,  safety_checker=_snake_case      )
   __lowerCAmelCase					:	Tuple      =       LMSDiscreteScheduler.from_config(sd_pipe.scheduler.config      )
   __lowerCAmelCase					:	List[Any]      =       sd_pipe.to(_snake_case      )
   sd_pipe.set_progress_bar_config(disable=_snake_case      )

   __lowerCAmelCase					:	str      =       """padme amidala taking a bath artwork, safe for work, no nudity"""
   __lowerCAmelCase					:	Tuple      =       2734971755
   __lowerCAmelCase					:	Dict      =       7

   __lowerCAmelCase					:	int      =       torch.manual_seed(_snake_case      )
   __lowerCAmelCase					:	List[str]      =       sd_pipe(
       [prompt]       ,  generator=_snake_case       ,  guidance_scale=_snake_case       ,  num_inference_steps=50       ,  output_type="""np"""       ,  width=512       ,  height=512       ,  sld_guidance_scale=0       ,  )

   __lowerCAmelCase					:	List[Any]      =       output.images
   __lowerCAmelCase					:	List[str]      =       image[0, -3:, -3:, -1]
   __lowerCAmelCase					:	Optional[Any]      =       [0.3_502, 0.3_622, 0.3_396, 0.3_642, 0.3_478, 0.3_318, 0.35, 0.3_348, 0.3_297]

   assert image.shape == (1, 512, 512, 3)

   assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1E-2

   __lowerCAmelCase					:	Union[str, Any]      =       torch.manual_seed(_snake_case      )
   __lowerCAmelCase					:	Optional[Any]      =       sd_pipe(
       [prompt]       ,  generator=_snake_case       ,  guidance_scale=_snake_case       ,  num_inference_steps=50       ,  output_type="""np"""       ,  width=512       ,  height=512       ,  sld_guidance_scale=2000       ,  sld_warmup_steps=7       ,  sld_threshold=0.025       ,  sld_momentum_scale=0.5       ,  sld_mom_beta=0.7       ,  )

   __lowerCAmelCase					:	Tuple      =       output.images
   __lowerCAmelCase					:	Optional[Any]      =       image[0, -3:, -3:, -1]
   __lowerCAmelCase					:	int      =       [0.5_531, 0.5_206, 0.4_895, 0.5_156, 0.5_182, 0.4_751, 0.4_802, 0.4_803, 0.4_443]

   assert image.shape == (1, 512, 512, 3)

   assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1E-2






  def 				UpperCAmelCase__						(							self			:					Tuple      )->Union[str, Any]:






   '''simple docstring'''

   __lowerCAmelCase					:	Union[str, Any]      =       StableDiffusionPipeline.from_pretrained("""runwayml/stable-diffusion-v1-5"""      )
   __lowerCAmelCase					:	Optional[int]      =       sd_pipe.to(_snake_case      )
   sd_pipe.set_progress_bar_config(disable=_snake_case      )

   __lowerCAmelCase					:	List[Any]      =       (
       """the four horsewomen of the apocalypse, painting by tom of finland, gaston bussiere, craig mullins, j. c."""
       """ leyendecker"""
   )
   __lowerCAmelCase					:	Optional[int]      =       1044355234
   __lowerCAmelCase					:	Optional[int]      =       12

   __lowerCAmelCase					:	Tuple      =       torch.manual_seed(_snake_case      )
   __lowerCAmelCase					:	List[Any]      =       sd_pipe(
       [prompt]       ,  generator=_snake_case       ,  guidance_scale=_snake_case       ,  num_inference_steps=50       ,  output_type="""np"""       ,  width=512       ,  height=512       ,  sld_guidance_scale=0       ,  )

   __lowerCAmelCase					:	Optional[int]      =       output.images
   __lowerCAmelCase					:	List[Any]      =       image[0, -3:, -3:, -1]
   __lowerCAmelCase					:	Union[str, Any]      =       np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]      )

   assert image.shape == (1, 512, 512, 3)

   assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1E-7

   __lowerCAmelCase					:	List[str]      =       torch.manual_seed(_snake_case      )
   __lowerCAmelCase					:	Tuple      =       sd_pipe(
       [prompt]       ,  generator=_snake_case       ,  guidance_scale=_snake_case       ,  num_inference_steps=50       ,  output_type="""np"""       ,  width=512       ,  height=512       ,  sld_guidance_scale=2000       ,  sld_warmup_steps=7       ,  sld_threshold=0.025       ,  sld_momentum_scale=0.5       ,  sld_mom_beta=0.7       ,  )

   __lowerCAmelCase					:	Tuple      =       output.images
   __lowerCAmelCase					:	Optional[Any]      =       image[0, -3:, -3:, -1]
   __lowerCAmelCase					:	Any      =       np.array([0.5_818, 0.6_285, 0.6_835, 0.6_019, 0.625, 0.6_754, 0.6_096, 0.6_334, 0.6_561]      )
   assert image.shape == (1, 512, 512, 3)

   assert np.abs(image_slice.flatten() - expected_slice      ).max() < 1E-2






import functools
import operator

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


_UpperCAmelCase             =							logging.get_logger(__name__)

_UpperCAmelCase             =							{
    'microsoft/unispeech-sat-base-100h-libri-ft': (
        'https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json'
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}






class        snake_case_    (		__lowercase						):
  A_      							=   'unispeech-sat'






  def __init__(							self			:					str       ,  _snake_case			:					List[Any]=32       ,  _snake_case			:					Union[str, Any]=768       ,  _snake_case			:					Tuple=12       ,  _snake_case			:					Optional[int]=12       ,  _snake_case			:					Optional[Any]=3072       ,  _snake_case			:					Tuple="gelu"       ,  _snake_case			:					int=0.1       ,  _snake_case			:					List[Any]=0.1       ,  _snake_case			:					Union[str, Any]=0.1       ,  _snake_case			:					str=0.0       ,  _snake_case			:					List[str]=0.0       ,  _snake_case			:					int=0.1       ,  _snake_case			:					Optional[Any]=0.1       ,  _snake_case			:					Optional[Any]=0.02       ,  _snake_case			:					int=1E-5       ,  _snake_case			:					Dict="group"       ,  _snake_case			:					Optional[Any]="gelu"       ,  _snake_case			:					Optional[Any]=(512, 512, 512, 512, 512, 512, 512)       ,  _snake_case			:					int=(5, 2, 2, 2, 2, 2, 2)       ,  _snake_case			:					int=(10, 3, 3, 3, 3, 2, 2)       ,  _snake_case			:					Any=False       ,  _snake_case			:					Optional[Any]=128       ,  _snake_case			:					Tuple=16       ,  _snake_case			:					str=False       ,  _snake_case			:					Dict=True       ,  _snake_case			:					Tuple=0.05       ,  _snake_case			:					str=10       ,  _snake_case			:					Tuple=2       ,  _snake_case			:					List[Any]=0.0       ,  _snake_case			:					str=10       ,  _snake_case			:					Any=0       ,  _snake_case			:					List[Any]=320       ,  _snake_case			:					Union[str, Any]=2       ,  _snake_case			:					Dict=0.1       ,  _snake_case			:					Dict=100       ,  _snake_case			:					Union[str, Any]=256       ,  _snake_case			:					int=256       ,  _snake_case			:					Union[str, Any]=0.1       ,  _snake_case			:					Optional[Any]="mean"       ,  _snake_case			:					int=False       ,  _snake_case			:					str=False       ,  _snake_case			:					str=256       ,  _snake_case			:					List[Any]=(512, 512, 512, 512, 1500)       ,  _snake_case			:					Optional[int]=(5, 3, 3, 1, 1)       ,  _snake_case			:					Tuple=(1, 2, 3, 1, 1)       ,  _snake_case			:					Dict=512       ,  _snake_case			:					Union[str, Any]=0       ,  _snake_case			:					List[str]=1       ,  _snake_case			:					Optional[Any]=2       ,  _snake_case			:					Optional[int]=504       ,  **_snake_case			:					Optional[int]       ,  )->Union[str, Any]:






   '''simple docstring'''

   super().__init__(**_snake_case       ,  pad_token_id=_snake_case       ,  bos_token_id=_snake_case       ,  eos_token_id=_snake_case      )
   __lowerCAmelCase					:	Dict      =       hidden_size
   __lowerCAmelCase					:	List[Any]      =       feat_extract_norm
   __lowerCAmelCase					:	int      =       feat_extract_activation
   __lowerCAmelCase					:	Union[str, Any]      =       list(_snake_case      )
   __lowerCAmelCase					:	str      =       list(_snake_case      )
   __lowerCAmelCase					:	Optional[Any]      =       list(_snake_case      )
   __lowerCAmelCase					:	Optional[int]      =       conv_bias
   __lowerCAmelCase					:	Dict      =       num_conv_pos_embeddings
   __lowerCAmelCase					:	List[Any]      =       num_conv_pos_embedding_groups
   __lowerCAmelCase					:	Tuple      =       len(self.conv_dim      )
   __lowerCAmelCase					:	int      =       num_hidden_layers
   __lowerCAmelCase					:	str      =       intermediate_size
   __lowerCAmelCase					:	str      =       hidden_act
   __lowerCAmelCase					:	Any      =       num_attention_heads
   __lowerCAmelCase					:	Optional[int]      =       hidden_dropout
   __lowerCAmelCase					:	str      =       attention_dropout
   __lowerCAmelCase					:	int      =       activation_dropout
   __lowerCAmelCase					:	Union[str, Any]      =       feat_proj_dropout
   __lowerCAmelCase					:	List[str]      =       final_dropout
   __lowerCAmelCase					:	Dict      =       layerdrop
   __lowerCAmelCase					:	Tuple      =       layer_norm_eps
   __lowerCAmelCase					:	Optional[Any]      =       initializer_range
   __lowerCAmelCase					:	str      =       vocab_size
   __lowerCAmelCase					:	Optional[int]      =       num_clusters
   __lowerCAmelCase					:	List[Any]      =       do_stable_layer_norm
   __lowerCAmelCase					:	Tuple      =       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					:	Dict      =       apply_spec_augment
   __lowerCAmelCase					:	List[Any]      =       mask_time_prob
   __lowerCAmelCase					:	List[str]      =       mask_time_length
   __lowerCAmelCase					:	Dict      =       mask_time_min_masks
   __lowerCAmelCase					:	Tuple      =       mask_feature_prob
   __lowerCAmelCase					:	List[str]      =       mask_feature_length
   __lowerCAmelCase					:	str      =       mask_feature_min_masks

   # parameters for pretraining with codevector quantized representations
   __lowerCAmelCase					:	Optional[int]      =       num_codevectors_per_group
   __lowerCAmelCase					:	List[Any]      =       num_codevector_groups
   __lowerCAmelCase					:	int      =       contrastive_logits_temperature
   __lowerCAmelCase					:	str      =       feat_quantizer_dropout
   __lowerCAmelCase					:	int      =       num_negatives
   __lowerCAmelCase					:	str      =       codevector_dim
   __lowerCAmelCase					:	Any      =       proj_codevector_dim
   __lowerCAmelCase					:	Any      =       diversity_loss_weight

   # ctc loss
   __lowerCAmelCase					:	Tuple      =       ctc_loss_reduction
   __lowerCAmelCase					:	Any      =       ctc_zero_infinity

   # SequenceClassification-specific parameter. Feel free to ignore for other classes.
   __lowerCAmelCase					:	Any      =       classifier_proj_size

   # XVector-specific parameters. Feel free to ignore for other classes.
   __lowerCAmelCase					:	List[str]      =       list(_snake_case      )
   __lowerCAmelCase					:	List[str]      =       list(_snake_case      )
   __lowerCAmelCase					:	Optional[int]      =       list(_snake_case      )
   __lowerCAmelCase					:	Optional[int]      =       xvector_output_dim






  @property
  def 				UpperCAmelCase__						(							self			:					Optional[Any]      )->Any:






   '''simple docstring'''

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