

import argparse
from collections import defaultdict

import yaml


_SCREAMING_SNAKE_CASE					:  Optional[int]             =      '''docs/source/en/_toctree.yml'''
def     UpperCAmelCase_       (						_A    ):





     '''simple docstring'''




     SCREAMING_SNAKE_CASE__   =   defaultdict(_A    )
     SCREAMING_SNAKE_CASE__   =   []
     SCREAMING_SNAKE_CASE__   =   []
     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    )

     SCREAMING_SNAKE_CASE__   =   new_doc_list
     SCREAMING_SNAKE_CASE__   =   [key for key, value in counts.items() if value > 1]

     SCREAMING_SNAKE_CASE__   =   []
     for duplicate_key in duplicates:
          SCREAMING_SNAKE_CASE__   =   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]    )
     SCREAMING_SNAKE_CASE__   =   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     UpperCAmelCase_       (						_A=False    ):





     '''simple docstring'''




     with open(_A				,		encoding='''utf-8'''    ) as f:
          SCREAMING_SNAKE_CASE__   =   yaml.safe_load(f.read()    )

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

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

     SCREAMING_SNAKE_CASE__   =   api_doc[scheduler_idx]['''sections''']
     SCREAMING_SNAKE_CASE__   =   clean_doc_toc(_A    )

     SCREAMING_SNAKE_CASE__   =   False
     if new_scheduler_doc != scheduler_doc:
          SCREAMING_SNAKE_CASE__   =   True
          if overwrite:
               SCREAMING_SNAKE_CASE__   =   new_scheduler_doc

     if diff:
          if overwrite:
               SCREAMING_SNAKE_CASE__   =   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     UpperCAmelCase_       (						_A=False    ):





     '''simple docstring'''




     with open(_A				,		encoding='''utf-8'''    ) as f:
          SCREAMING_SNAKE_CASE__   =   yaml.safe_load(f.read()    )

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

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

     SCREAMING_SNAKE_CASE__   =   False
     SCREAMING_SNAKE_CASE__   =   api_doc[pipeline_idx]['''sections''']
     SCREAMING_SNAKE_CASE__   =   []

     # sort sub pipeline docs
     for pipeline_doc in pipeline_docs:
          if "section" in pipeline_doc:
               SCREAMING_SNAKE_CASE__   =   pipeline_doc['''section''']
               SCREAMING_SNAKE_CASE__   =   clean_doc_toc(_A    )
               if overwrite:
                    SCREAMING_SNAKE_CASE__   =   new_sub_pipeline_doc
          new_pipeline_docs.append(_A    )

     # sort overall pipeline doc
     SCREAMING_SNAKE_CASE__   =   clean_doc_toc(_A    )

     if new_pipeline_docs != pipeline_docs:
          SCREAMING_SNAKE_CASE__   =   True
          if overwrite:
               SCREAMING_SNAKE_CASE__   =   new_pipeline_docs

     if diff:
          if overwrite:
               SCREAMING_SNAKE_CASE__   =   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__":
   _SCREAMING_SNAKE_CASE					:  List[Any]             =      argparse.ArgumentParser()
   parser.add_argument('''--fix_and_overwrite''', action='''store_true''', help='''Whether to fix inconsistencies.''')
   _SCREAMING_SNAKE_CASE					:  Tuple             =      parser.parse_args()

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





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


_SCREAMING_SNAKE_CASE					:  Any             =      logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE					:  Optional[Any]             =      {
    '''google/vivit-b-16x2-kinetics400''': (
        '''https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json'''
    ),
    # See all Vivit models at https://huggingface.co/models?filter=vivit
}






class 	UpperCAmelCase__		(	A__	):






  """simple docstring"""


  a									= "vivit"






  def __init__(							self						:		str     ,       __lowerCamelCase						:		List[Any]=224     ,       __lowerCamelCase						:		Optional[int]=32     ,       __lowerCamelCase						:		Tuple=[2, 16, 16]     ,       __lowerCamelCase						:		Union[str, Any]=3     ,       __lowerCamelCase						:		Optional[Any]=768     ,       __lowerCamelCase						:		Any=12     ,       __lowerCamelCase						:		Optional[Any]=12     ,       __lowerCamelCase						:		List[str]=3072     ,       __lowerCamelCase						:		Any="gelu_fast"     ,       __lowerCamelCase						:		Union[str, Any]=0.0     ,       __lowerCamelCase						:		int=0.0     ,       __lowerCamelCase						:		str=0.02     ,       __lowerCamelCase						:		Any=1e-06     ,       __lowerCamelCase						:		Dict=True     ,       **__lowerCamelCase						:		Any     ,       )		->							List[str]:
       SCREAMING_SNAKE_CASE__   =   hidden_size
       SCREAMING_SNAKE_CASE__   =   num_hidden_layers
       SCREAMING_SNAKE_CASE__   =   num_attention_heads
       SCREAMING_SNAKE_CASE__   =   intermediate_size
       SCREAMING_SNAKE_CASE__   =   hidden_act
       SCREAMING_SNAKE_CASE__   =   hidden_dropout_prob
       SCREAMING_SNAKE_CASE__   =   attention_probs_dropout_prob
       SCREAMING_SNAKE_CASE__   =   initializer_range
       SCREAMING_SNAKE_CASE__   =   layer_norm_eps

       SCREAMING_SNAKE_CASE__   =   image_size
       SCREAMING_SNAKE_CASE__   =   num_frames
       SCREAMING_SNAKE_CASE__   =   tubelet_size
       SCREAMING_SNAKE_CASE__   =   num_channels
       SCREAMING_SNAKE_CASE__   =   qkv_bias

       super().__init__(**__lowerCamelCase )


