
"""simple docstring"""






import functools
import operator

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


__SCREAMING_SNAKE_CASE							=     logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE							=     {
    '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 				a__					(						A__       ):
     UpperCAmelCase__         =      '''unispeech-sat'''



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







      '''simple docstring'''



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

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

      # ctc loss
      UpperCamelCase_     :					str   	=ctc_loss_reduction
      UpperCamelCase_     :					str   	=ctc_zero_infinity

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

      # XVector-specific parameters. Feel free to ignore for other classes.
      UpperCamelCase_     :					Dict   	=list(_lowerCamelCase   )
      UpperCamelCase_     :					Any   	=list(_lowerCamelCase   )
      UpperCamelCase_     :					Union[str, Any]   	=list(_lowerCamelCase   )
      UpperCamelCase_     :					Union[str, Any]   	=xvector_output_dim




     @property
     def  lowerCamelCase_						(							self :List[str]   ):







      '''simple docstring'''



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


"""simple docstring"""






# This code is adapted from OpenAI's release
# https://github.com/openai/human-eval/blob/master/human_eval/execution.py

import contextlib
import faulthandler
import io
import multiprocessing
import os
import platform
import signal
import tempfile




def       A_  (				__lowercase						,	__lowercase						,	__lowercase						,	__lowercase	):
 UpperCamelCase_     :					Tuple   	=multiprocessing.Manager()
 UpperCamelCase_     :					Dict   	=manager.list()

 UpperCamelCase_     :					Union[str, Any]   	=multiprocessing.Process(target=__lowercase						,	args=(check_program, result, timeout)	)
 p.start()
 p.join(timeout=timeout + 1	)
 if p.is_alive():
  p.kill()

 if not result:
  result.append('timed out'	)

 return {
     "task_id": task_id,
     "passed": result[0] == "passed",
     "result": result[0],
     "completion_id": completion_id,
 }




def       A_  (				__lowercase						,	__lowercase						,	__lowercase	):
 with create_tempdir():
  # These system calls are needed when cleaning up tempdir.
  import os
  import shutil

  UpperCamelCase_     :					Tuple   	=shutil.rmtree
  UpperCamelCase_     :					List[str]   	=os.rmdir
  UpperCamelCase_     :					Any   	=os.chdir

  # Disable functionalities that can make destructive changes to the test.
  reliability_guard()

  # Run program.
  try:
   UpperCamelCase_     :					List[str]   	={}
   with swallow_io():
    with time_limit(__lowercase	):
     exec(__lowercase						,	__lowercase	)
   result.append('passed'	)
  except TimeoutException:
   result.append('timed out'	)
  except BaseException as e:
   result.append(F'''failed: {e}'''	)

  # Needed for cleaning up.
  UpperCamelCase_     :					Optional[Any]   	=rmtree
  UpperCamelCase_     :					str   	=rmdir
  UpperCamelCase_     :					Dict   	=chdir




@contextlib.contextmanager
def       A_  (				__lowercase	):
 def signal_handler(__lowercase						,	__lowercase	):
  raise TimeoutException('Timed out!'	)

 signal.setitimer(signal.ITIMER_REAL						,	__lowercase	)
 signal.signal(signal.SIGALRM						,	__lowercase	)
 try:
  yield
 finally:
  signal.setitimer(signal.ITIMER_REAL						,	0	)




@contextlib.contextmanager
def       A_  (				):
 UpperCamelCase_     :					str   	=WriteOnlyStringIO()
 with contextlib.redirect_stdout(__lowercase	):
  with contextlib.redirect_stderr(__lowercase	):
   with redirect_stdin(__lowercase	):
    yield




@contextlib.contextmanager
def       A_  (				):
 with tempfile.TemporaryDirectory() as dirname:
  with chdir(__lowercase	):
   yield dirname





class 				a__					(						A__       ):
     pass





class 				a__					(						io.StringIO       ):



     def  lowerCamelCase_						(							self :Any      ,  *_lowerCamelCase :Any      ,  **_lowerCamelCase :Tuple   ):







      '''simple docstring'''



      raise OSError



     def  lowerCamelCase_						(							self :Union[str, Any]      ,  *_lowerCamelCase :Any      ,  **_lowerCamelCase :Tuple   ):







      '''simple docstring'''



      raise OSError



     def  lowerCamelCase_						(							self :Tuple      ,  *_lowerCamelCase :str      ,  **_lowerCamelCase :List[str]   ):







      '''simple docstring'''



      raise OSError




     def  lowerCamelCase_						(							self :List[str]      ,  *_lowerCamelCase :Optional[int]      ,  **_lowerCamelCase :str   ):







      '''simple docstring'''



      return False





class 				a__					(						contextlib._RedirectStream       ):  # type: ignore
     UpperCAmelCase__         =      '''stdin'''




@contextlib.contextmanager
def       A_  (				__lowercase	):
 if root == ".":
  yield
  return
 UpperCamelCase_     :					List[str]   	=os.getcwd()
 os.chdir(__lowercase	)
 try:
  yield
 except BaseException as exc:
  raise exc
 finally:
  os.chdir(__lowercase	)





def       A_  (				__lowercase=None	):

 if maximum_memory_bytes is not None:
  import resource

  resource.setrlimit(resource.RLIMIT_AS						,	(maximum_memory_bytes, maximum_memory_bytes)	)
  resource.setrlimit(resource.RLIMIT_DATA						,	(maximum_memory_bytes, maximum_memory_bytes)	)
  if not platform.uname().system == "Darwin":
   resource.setrlimit(resource.RLIMIT_STACK						,	(maximum_memory_bytes, maximum_memory_bytes)	)

 faulthandler.disable()

 import builtins

 UpperCamelCase_     :					Any   	=None
 UpperCamelCase_     :					Any   	=None

 import os

 UpperCamelCase_     :					Union[str, Any]   	='1'

 UpperCamelCase_     :					Union[str, Any]   	=None
 UpperCamelCase_     :					Optional[Any]   	=None
 UpperCamelCase_     :					Optional[Any]   	=None
 UpperCamelCase_     :					Optional[Any]   	=None
 UpperCamelCase_     :					Dict   	=None
 UpperCamelCase_     :					List[Any]   	=None
 UpperCamelCase_     :					Any   	=None
 UpperCamelCase_     :					str   	=None
 UpperCamelCase_     :					Optional[int]   	=None
 UpperCamelCase_     :					Union[str, Any]   	=None
 UpperCamelCase_     :					str   	=None
 UpperCamelCase_     :					str   	=None
 UpperCamelCase_     :					List[Any]   	=None
 UpperCamelCase_     :					Optional[Any]   	=None
 UpperCamelCase_     :					str   	=None
 UpperCamelCase_     :					List[str]   	=None
 UpperCamelCase_     :					Optional[Any]   	=None
 UpperCamelCase_     :					int   	=None
 UpperCamelCase_     :					Optional[Any]   	=None
 UpperCamelCase_     :					Tuple   	=None
 UpperCamelCase_     :					List[Any]   	=None
 UpperCamelCase_     :					Tuple   	=None
 UpperCamelCase_     :					Dict   	=None
 UpperCamelCase_     :					Optional[int]   	=None
 UpperCamelCase_     :					str   	=None
 UpperCamelCase_     :					Union[str, Any]   	=None
 UpperCamelCase_     :					int   	=None

 import shutil

 UpperCamelCase_     :					List[str]   	=None
 UpperCamelCase_     :					Optional[Any]   	=None
 UpperCamelCase_     :					Dict   	=None

 import subprocess

 UpperCamelCase_     :					Optional[int]   	=None  # type: ignore

 UpperCamelCase_     :					Union[str, Any]   	=None

 import sys

 UpperCamelCase_     :					Union[str, Any]   	=None
 UpperCamelCase_     :					Tuple   	=None
 UpperCamelCase_     :					Union[str, Any]   	=None
 UpperCamelCase_     :					Dict   	=None
 UpperCamelCase_     :					Any   	=None
