





import functools
import operator

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


lowercase      :       List[Any]									=  logging.get_logger(__name__)

lowercase      :       str									=  {
    """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__    (							__UpperCAmelCase	):




   """simple docstring"""



   __A   :				int         =  '''unispeech-sat'''

   def __init__(					self					,  lowercase=32					,  lowercase=768					,  lowercase=12					,  lowercase=12					,  lowercase=3072					,  lowercase="gelu"					,  lowercase=0.1					,  lowercase=0.1					,  lowercase=0.1					,  lowercase=0.0					,  lowercase=0.0					,  lowercase=0.1					,  lowercase=0.1					,  lowercase=0.02					,  lowercase=1e-5					,  lowercase="group"					,  lowercase="gelu"					,  lowercase=(512, 512, 512, 512, 512, 512, 512)					,  lowercase=(5, 2, 2, 2, 2, 2, 2)					,  lowercase=(10, 3, 3, 3, 3, 2, 2)					,  lowercase=False					,  lowercase=128					,  lowercase=16					,  lowercase=False					,  lowercase=True					,  lowercase=0.05					,  lowercase=10					,  lowercase=2					,  lowercase=0.0					,  lowercase=10					,  lowercase=0					,  lowercase=320					,  lowercase=2					,  lowercase=0.1					,  lowercase=100					,  lowercase=256					,  lowercase=256					,  lowercase=0.1					,  lowercase="mean"					,  lowercase=False					,  lowercase=False					,  lowercase=256					,  lowercase=(512, 512, 512, 512, 1500)					,  lowercase=(5, 3, 3, 1, 1)					,  lowercase=(1, 2, 3, 1, 1)					,  lowercase=512					,  lowercase=0					,  lowercase=1					,  lowercase=2					,  lowercase=504					,  **lowercase					,  )			->						Dict:







          '''simple docstring'''

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

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

          # ctc loss
          a__						:	Any =				ctc_loss_reduction
          a__						:	List[str] =				ctc_zero_infinity

          # SequenceClassification-specific parameter. Feel free to ignore for other classes.
          a__						:	Optional[Any] =				classifier_proj_size

          # XVector-specific parameters. Feel free to ignore for other classes.
          a__						:	int =				list(lowercase)
          a__						:	Tuple =				list(lowercase)
          a__						:	str =				list(lowercase)
          a__						:	int =				xvector_output_dim

   @property
   def 							__lowercase		(					self)			->						int:







          '''simple docstring'''

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









import argparse
from collections import defaultdict

import yaml


lowercase      :       int									=  """docs/source/en/_toctree.yml"""



def A_	(		A__				)  ->		Tuple:
       a__						:	int =				defaultdict(A__				)
       a__						:	List[str] =				[]
       a__						:	Any =				[]
       for doc in doc_list:
              if "local" in doc:
                     counts[doc["local"]] += 1

              if doc["title"].lower() == "overview":
                     overview_doc.append({'local': doc['local'], 'title': doc['title']}				)
              else:
                     new_doc_list.append(A__				)

       a__						:	int =				new_doc_list
       a__						:	List[str] =				[key for key, value in counts.items() if value > 1]

       a__						:	Tuple =				[]
       for duplicate_key in duplicates:
              a__						:	int =				list({doc['title'] for doc in doc_list if doc['local'] == duplicate_key}				)
              if len(A__				) > 1:
                     raise ValueError(
                         F'{duplicate_key} is present several times in the documentation table of content at '
                         '`docs/source/en/_toctree.yml` with different *Title* values. Choose one of those and remove the '
                         'others.'				)
              # Only add this once
              new_doc.append({'local': duplicate_key, 'title': titles[0]}				)

       # Add none duplicate-keys
       new_doc.extend([doc for doc in doc_list if 'local' not in counts or counts[doc['local']] == 1]				)
       a__						:	Any =				sorted(A__		,      key=lambda A__				: s["title"].lower()				)

       # "overview" gets special treatment and is always first
       if len(A__				) > 1:
              raise ValueError('{doc_list} has two \'overview\' docs which is not allowed.'				)

       overview_doc.extend(A__				)

       # Sort
       return overview_doc



def A_	(		A__=False				)  ->		str:
       with open(A__		,      encoding='utf-8'				) as f:
              a__						:	int =				yaml.safe_load(f.read()				)

       # Get to the API doc
       a__						:	Tuple =				0
       while content[api_idx]["title"] != "API":
              api_idx += 1
       a__						:	Any =				content[api_idx]['sections']

       # Then to the model doc
       a__						:	List[str] =				0
       while api_doc[scheduler_idx]["title"] != "Schedulers":
              scheduler_idx += 1

       a__						:	Tuple =				api_doc[scheduler_idx]['sections']
       a__						:	Optional[int] =				clean_doc_toc(A__				)

       a__						:	int =				False
       if new_scheduler_doc != scheduler_doc:
              a__						:	int =				True
              if overwrite:
                     a__						:	int =				new_scheduler_doc

       if diff:
              if overwrite:
                     a__						:	Optional[Any] =				api_doc
                     with open(A__		,      'w'		,      encoding='utf-8'				) as f:
                            f.write(yaml.dump(A__		,      allow_unicode=A__				)				)
              else:
                     raise ValueError(
                         'The model doc part of the table of content is not properly sorted, run `make style` to fix this.'				)



def A_	(		A__=False				)  ->		Tuple:
       with open(A__		,      encoding='utf-8'				) as f:
              a__						:	Optional[Any] =				yaml.safe_load(f.read()				)

       # Get to the API doc
       a__						:	Optional[int] =				0
       while content[api_idx]["title"] != "API":
              api_idx += 1
       a__						:	int =				content[api_idx]['sections']

       # Then to the model doc
       a__						:	List[Any] =				0
       while api_doc[pipeline_idx]["title"] != "Pipelines":
              pipeline_idx += 1

       a__						:	Optional[int] =				False
       a__						:	Union[str, Any] =				api_doc[pipeline_idx]['sections']
       a__						:	List[str] =				[]

       # sort sub pipeline docs
       for pipeline_doc in pipeline_docs:
              if "section" in pipeline_doc:
                     a__						:	Any =				pipeline_doc['section']
                     a__						:	Dict =				clean_doc_toc(A__				)
                     if overwrite:
                            a__						:	Optional[Any] =				new_sub_pipeline_doc
              new_pipeline_docs.append(A__				)

       # sort overall pipeline doc
       a__						:	Optional[Any] =				clean_doc_toc(A__				)

       if new_pipeline_docs != pipeline_docs:
              a__						:	List[Any] =				True
              if overwrite:
                     a__						:	Union[str, Any] =				new_pipeline_docs

       if diff:
              if overwrite:
                     a__						:	Dict =				api_doc
                     with open(A__		,      'w'		,      encoding='utf-8'				) as f:
                            f.write(yaml.dump(A__		,      allow_unicode=A__				)				)
              else:
                     raise ValueError(
                         'The model doc part of the table of content is not properly sorted, run `make style` to fix this.'				)


if __name__ == "__main__":
    lowercase      :       List[Any]									=  argparse.ArgumentParser()
    parser.add_argument("""--fix_and_overwrite""", action="""store_true""", help="""Whether to fix inconsistencies.""")
    lowercase      :       str									=  parser.parse_args()

    check_scheduler_doc(args.fix_and_overwrite)
    check_pipeline_doc(args.fix_and_overwrite)


