


'''simple docstring'''



import functools
import operator

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


__lowercase     :						Any	=     logging.get_logger(__name__)

__lowercase     :						str	=     {
    '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 							__UpperCamelCase    (		lowerCAmelCase_ ):
 A_           =   "sew-d"




 def __init__(       self						,    __a=32						,    __a=768						,    __a=12						,    __a=12						,    __a=3072						,    __a=2						,    __a=512						,    __a=256						,    __a=True						,    __a=True						,    __a=("p2c", "c2p")						,    __a="layer_norm"						,    __a="gelu_python"						,    __a=0.1						,    __a=0.1						,    __a=0.1						,    __a=0.0						,    __a=0.1						,    __a=0.02						,    __a=1E-7						,    __a=1E-5						,    __a="group"						,    __a="gelu"						,    __a=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)						,    __a=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)						,    __a=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)						,    __a=False						,    __a=128						,    __a=16						,    __a=True						,    __a=0.05						,    __a=10						,    __a=2						,    __a=0.0						,    __a=10						,    __a=0						,    __a="mean"						,    __a=False						,    __a=False						,    __a=256						,    __a=0						,    __a=1						,    __a=2						,    **__a						,    ):

      '''simple docstring'''





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

      # ctc loss
      __a      :	Optional[Any]    =  ctc_loss_reduction
      __a      :	int    =  ctc_zero_infinity

      # sequence classification
      __a      :	int    =  use_weighted_layer_sum
      __a      :	Any    =  classifier_proj_size





 @property
 def 				__UpperCAmelCase							(       self							):

      '''simple docstring'''





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







'''simple docstring'''



import re

from filelock import FileLock


try:
	import nltk

	__lowercase     :						Optional[Any]	=     True
except (ImportError, ModuleNotFoundError):
	__lowercase     :						Dict	=     False

if NLTK_AVAILABLE:
	with FileLock('.lock') as lock:
		nltk.download('punkt', quiet=True)






def   lowerCamelCase							(_SCREAMING_SNAKE_CASE				:       str       ):
					re.sub('<n>'						,				''						,				_SCREAMING_SNAKE_CASE       )  # remove pegasus newline char
					assert NLTK_AVAILABLE, "nltk must be installed to separate newlines between sentences. (pip install nltk)"
					return "\n".join(nltk.sent_tokenize(_SCREAMING_SNAKE_CASE       )       )



