





"""simple docstring"""
import functools
import operator

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


__UpperCamelCase     :						Dict						       =  logging.get_logger(__name__)

__UpperCamelCase     :						Union[str, Any]						       =  {
    '''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__  ):
 snake_case__             =       '''unispeech-sat'''



 def __init__(     self				,       _snake_case=32				,       _snake_case=7_68				,       _snake_case=12				,       _snake_case=12				,       _snake_case=30_72				,       _snake_case="gelu"				,       _snake_case=0.1				,       _snake_case=0.1				,       _snake_case=0.1				,       _snake_case=0.0				,       _snake_case=0.0				,       _snake_case=0.1				,       _snake_case=0.1				,       _snake_case=0.02				,       _snake_case=1E-5				,       _snake_case="group"				,       _snake_case="gelu"				,       _snake_case=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)				,       _snake_case=(5, 2, 2, 2, 2, 2, 2)				,       _snake_case=(10, 3, 3, 3, 3, 2, 2)				,       _snake_case=False				,       _snake_case=1_28				,       _snake_case=16				,       _snake_case=False				,       _snake_case=True				,       _snake_case=0.05				,       _snake_case=10				,       _snake_case=2				,       _snake_case=0.0				,       _snake_case=10				,       _snake_case=0				,       _snake_case=3_20				,       _snake_case=2				,       _snake_case=0.1				,       _snake_case=1_00				,       _snake_case=2_56				,       _snake_case=2_56				,       _snake_case=0.1				,       _snake_case="mean"				,       _snake_case=False				,       _snake_case=False				,       _snake_case=2_56				,       _snake_case=(5_12, 5_12, 5_12, 5_12, 15_00)				,       _snake_case=(5, 3, 3, 1, 1)				,       _snake_case=(1, 2, 3, 1, 1)				,       _snake_case=5_12				,       _snake_case=0				,       _snake_case=1				,       _snake_case=2				,       _snake_case=5_04				,       **_snake_case				,       ):







  """simple docstring"""






  super().__init__(**_snake_case				,       pad_token_id=_snake_case				,       bos_token_id=_snake_case				,       eos_token_id=_snake_case     )
  lowerCAmelCase    				= hidden_size
  lowerCAmelCase    				= feat_extract_norm
  lowerCAmelCase    				= feat_extract_activation
  lowerCAmelCase    				= list(_snake_case     )
  lowerCAmelCase    				= list(_snake_case     )
  lowerCAmelCase    				= list(_snake_case     )
  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    				= num_clusters
  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

  # 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(_snake_case     )
  lowerCAmelCase    				= list(_snake_case     )
  lowerCAmelCase    				= list(_snake_case     )
  lowerCAmelCase    				= xvector_output_dim



 @property
 def    UpperCamelCase__  (     self     ):







  """simple docstring"""






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













import importlib
import shutil
import threading
import warnings
from typing import List

import fsspec
import fsspec.asyn

from . import compression
from .hffilesystem import HfFileSystem


A__      :     int       =					importlib.util.find_spec('s3fs') is not None

if _has_safs:
							from .safilesystem import SaFileSystem  # noqa: F401

A__      :     List[compression.BaseCompressedFileFileSystem]       =					[
    compression.BzaFileSystem,
    compression.GzipFileSystem,
    compression.LzaFileSystem,
    compression.XzFileSystem,
    compression.ZstdFileSystem,
]

# Register custom filesystems
for fs_class in COMPRESSION_FILESYSTEMS + [HfFileSystem]:
							if fs_class.protocol in fsspec.registry and fsspec.registry[fs_class.protocol] is not fs_class:
														warnings.warn(F"A filesystem protocol was already set for {fs_class.protocol} and will be overwritten.")
							fsspec.register_implementation(fs_class.protocol, fs_class, clobber=True)






def     a     (		lowerCamelCase_							):






				'''simple docstring'''
				if "://" in dataset_path:
								lowercase__  					=     dataset_path.split('''://'''							)[1]
				return dataset_path






def     a     (		lowerCamelCase_							):






				'''simple docstring'''
				if fs is not None and fs.protocol != "file":
								return True
				else:
								return False






def     a     (		lowerCamelCase_						,  lowerCamelCase_						,  lowerCamelCase_							):






				'''simple docstring'''
				lowercase__  					=     not is_remote_filesystem(lowerCamelCase_							)
				if is_local:
								# LocalFileSystem.mv does copy + rm, it is more efficient to simply move a local directory
								shutil.move(fs._strip_protocol(lowerCamelCase_							)						,  fs._strip_protocol(lowerCamelCase_							)							)
				else:
								fs.mv(lowerCamelCase_						,  lowerCamelCase_						,  recursive=lowerCamelCase_							)






def     a     (		):






				'''simple docstring'''
				if hasattr(fsspec.asyn						,  '''reset_lock'''							):
								# for future fsspec>2022.05.0
								fsspec.asyn.reset_lock()
				else:
								lowercase__  					=     None
								lowercase__  					=     None
								lowercase__  					=     threading.Lock()




