import functools
import operator

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


SCREAMING_SNAKE_CASE :	Tuple							     =		logging.get_logger(__name__)

SCREAMING_SNAKE_CASE :	Union[str, Any]							     =		{
    """asapp/sew-d-tiny-100k""": """https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json""",
    # See all SEW-D models at https://huggingface.co/models?filter=sew-d
}
class    A_ (       a_ ):
  _SCREAMING_SNAKE_CASE    				=			"""sew-d"""

  def __init__(		self :      Dict     ,							__SCREAMING_SNAKE_CASE :      List[Any]=32     ,							__SCREAMING_SNAKE_CASE :      List[str]=7_68     ,							__SCREAMING_SNAKE_CASE :      Any=12     ,							__SCREAMING_SNAKE_CASE :      str=12     ,							__SCREAMING_SNAKE_CASE :      Union[str, Any]=30_72     ,							__SCREAMING_SNAKE_CASE :      Dict=2     ,							__SCREAMING_SNAKE_CASE :      Any=5_12     ,							__SCREAMING_SNAKE_CASE :      Optional[int]=2_56     ,							__SCREAMING_SNAKE_CASE :      Any=True     ,							__SCREAMING_SNAKE_CASE :      Optional[Any]=True     ,							__SCREAMING_SNAKE_CASE :      List[Any]=("p2c", "c2p")     ,							__SCREAMING_SNAKE_CASE :      Optional[int]="layer_norm"     ,							__SCREAMING_SNAKE_CASE :      List[str]="gelu_python"     ,							__SCREAMING_SNAKE_CASE :      Optional[Any]=0.1     ,							__SCREAMING_SNAKE_CASE :      str=0.1     ,							__SCREAMING_SNAKE_CASE :      Optional[int]=0.1     ,							__SCREAMING_SNAKE_CASE :      str=0.0     ,							__SCREAMING_SNAKE_CASE :      List[Any]=0.1     ,							__SCREAMING_SNAKE_CASE :      Union[str, Any]=0.02     ,							__SCREAMING_SNAKE_CASE :      Dict=1E-7     ,							__SCREAMING_SNAKE_CASE :      List[Any]=1E-5     ,							__SCREAMING_SNAKE_CASE :      List[str]="group"     ,							__SCREAMING_SNAKE_CASE :      Dict="gelu"     ,							__SCREAMING_SNAKE_CASE :      List[Any]=(64, 1_28, 1_28, 1_28, 1_28, 2_56, 2_56, 2_56, 2_56, 5_12, 5_12, 5_12, 5_12)     ,							__SCREAMING_SNAKE_CASE :      List[str]=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)     ,							__SCREAMING_SNAKE_CASE :      Union[str, Any]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)     ,							__SCREAMING_SNAKE_CASE :      Union[str, Any]=False     ,							__SCREAMING_SNAKE_CASE :      List[str]=1_28     ,							__SCREAMING_SNAKE_CASE :      Dict=16     ,							__SCREAMING_SNAKE_CASE :      Dict=True     ,							__SCREAMING_SNAKE_CASE :      Any=0.05     ,							__SCREAMING_SNAKE_CASE :      Dict=10     ,							__SCREAMING_SNAKE_CASE :      List[Any]=2     ,							__SCREAMING_SNAKE_CASE :      List[Any]=0.0     ,							__SCREAMING_SNAKE_CASE :      Any=10     ,							__SCREAMING_SNAKE_CASE :      List[str]=0     ,							__SCREAMING_SNAKE_CASE :      str="mean"     ,							__SCREAMING_SNAKE_CASE :      str=False     ,							__SCREAMING_SNAKE_CASE :      Optional[Any]=False     ,							__SCREAMING_SNAKE_CASE :      str=2_56     ,							__SCREAMING_SNAKE_CASE :      List[Any]=0     ,							__SCREAMING_SNAKE_CASE :      Optional[int]=1     ,							__SCREAMING_SNAKE_CASE :      Any=2     ,							**__SCREAMING_SNAKE_CASE :      Tuple     ,							):
   super().__init__(**__SCREAMING_SNAKE_CASE     ,							pad_token_id=__SCREAMING_SNAKE_CASE     ,							bos_token_id=__SCREAMING_SNAKE_CASE     ,							eos_token_id=__SCREAMING_SNAKE_CASE       )
   __a       =  hidden_size
   __a       =  feat_extract_norm
   __a       =  feat_extract_activation
   __a       =  list(__SCREAMING_SNAKE_CASE       )
   __a       =  list(__SCREAMING_SNAKE_CASE       )
   __a       =  list(__SCREAMING_SNAKE_CASE       )
   __a       =  conv_bias
   __a       =  num_conv_pos_embeddings
   __a       =  num_conv_pos_embedding_groups
   __a       =  len(self.conv_dim       )
   __a       =  num_hidden_layers
   __a       =  intermediate_size
   __a       =  squeeze_factor
   __a       =  max_position_embeddings
   __a       =  position_buckets
   __a       =  share_att_key
   __a       =  relative_attention
   __a       =  norm_rel_ebd
   __a       =  list(__SCREAMING_SNAKE_CASE       )
   __a       =  hidden_act
   __a       =  num_attention_heads
   __a       =  hidden_dropout
   __a       =  attention_dropout
   __a       =  activation_dropout
   __a       =  feat_proj_dropout
   __a       =  final_dropout
   __a       =  layer_norm_eps
   __a       =  feature_layer_norm_eps
   __a       =  initializer_range
   __a       =  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       =  apply_spec_augment
   __a       =  mask_time_prob
   __a       =  mask_time_length
   __a       =  mask_time_min_masks
   __a       =  mask_feature_prob
   __a       =  mask_feature_length
   __a       =  mask_feature_min_masks

   # ctc loss
   __a       =  ctc_loss_reduction
   __a       =  ctc_zero_infinity

   # sequence classification
   __a       =  use_weighted_layer_sum
   __a       =  classifier_proj_size

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



from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
  if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")):
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  from ...utils.dummy_torch_and_transformers_objects import UnCLIPImageVariationPipeline, UnCLIPPipeline
else:
  from .pipeline_unclip import UnCLIPPipeline
  from .pipeline_unclip_image_variation import UnCLIPImageVariationPipeline
  from .text_proj import UnCLIPTextProjModel


