





# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse

from ...utils.dataclasses import (
    ComputeEnvironment,
    DistributedType,
    DynamoBackend,
    PrecisionType,
    SageMakerDistributedType,
)
from ..menu import BulletMenu


_A :   str  			=  [
    'EAGER',
    'AOT_EAGER',
    'INDUCTOR',
    'NVFUSER',
    'AOT_NVFUSER',
    'AOT_CUDAGRAPHS',
    'OFI',
    'FX2TRT',
    'ONNXRT',
    'IPEX',
]



def 	_a						(   UpperCAmelCase      ,  UpperCAmelCase=None      ,  UpperCAmelCase=None      ,  UpperCAmelCase=None					)    ->    Optional[Any]:







   """simple docstring"""
   lowerCamelCase__       :						Optional[Any]        =							True
   while ask_again:
      lowerCamelCase__       :						List[Any]        =							input(UpperCAmelCase					)
      try:
         if default is not None and len(UpperCAmelCase					) == 0:
            return default
         return convert_value(UpperCAmelCase					) if convert_value is not None else result
      except Exception:
         if error_message is not None:
            print(UpperCAmelCase					)



def 	_a						(   UpperCAmelCase      ,  UpperCAmelCase=[]      ,  UpperCAmelCase=None      ,  UpperCAmelCase=0					)    ->    Optional[int]:







   """simple docstring"""
   lowerCamelCase__       :						List[Any]        =							BulletMenu(UpperCAmelCase      ,  UpperCAmelCase					)
   lowerCamelCase__       :						Union[str, Any]        =							menu.run(default_choice=UpperCAmelCase					)
   return convert_value(UpperCAmelCase					) if convert_value is not None else result



def 	_a						(   UpperCAmelCase					)    ->    str:







   """simple docstring"""
   lowerCamelCase__       :						Union[str, Any]        =							int(UpperCAmelCase					)
   return ComputeEnvironment(['''LOCAL_MACHINE''', '''AMAZON_SAGEMAKER'''][value]					)



def 	_a						(   UpperCAmelCase					)    ->    int:







   """simple docstring"""
   lowerCamelCase__       :						str        =							int(UpperCAmelCase					)
   return DistributedType(['''NO''', '''MULTI_CPU''', '''MULTI_XPU''', '''MULTI_GPU''', '''MULTI_NPU''', '''TPU'''][value]					)



def 	_a						(   UpperCAmelCase					)    ->    Optional[Any]:







   """simple docstring"""
   lowerCamelCase__       :						Dict        =							int(UpperCAmelCase					)
   return DynamoBackend(DYNAMO_BACKENDS[value]					).value



def 	_a						(   UpperCAmelCase					)    ->    Union[str, Any]:







   """simple docstring"""
   lowerCamelCase__       :						Union[str, Any]        =							int(UpperCAmelCase					)
   return PrecisionType(['''no''', '''fp16''', '''bf16''', '''fp8'''][value]					)



def 	_a						(   UpperCAmelCase					)    ->    str:







   """simple docstring"""
   lowerCamelCase__       :						Union[str, Any]        =							int(UpperCAmelCase					)
   return SageMakerDistributedType(['''NO''', '''DATA_PARALLEL''', '''MODEL_PARALLEL'''][value]					)



def 	_a						(   UpperCAmelCase					)    ->    Any:







   """simple docstring"""
   return {"yes": True, "no": False}[value.lower()]




class        __SCREAMING_SNAKE_CASE      (			argparse.RawDescriptionHelpFormatter ):







       def 						__lowerCamelCase   (				self					:     str		, A					:     Optional[Any]		, A					:     List[str]		, A					:     int		, A					:     Tuple      )       ->List[str]:
          lowerCamelCase__       :						List[str]        =							super()._format_usage(A		, A		, A		, A      )
          lowerCamelCase__       :						Optional[Any]        =							usage.replace('''<command> [<args>] '''		, ''''''      )
          return usage










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


_A :   Any  			=  logging.get_logger(__name__)

_A :   int  			=  {
    'facebook/timesformer': 'https://huggingface.co/facebook/timesformer/resolve/main/config.json',
}


class        __SCREAMING_SNAKE_CASE      (			lowerCAmelCase_ ):
       _UpperCAmelCase				:  Dict			   =   "timesformer"







       def __init__(				self					:     List[str]		, A					:     int=2_2_4		, A					:     Optional[Any]=1_6		, A					:     str=3		, A					:     str=8		, A					:     Any=7_6_8		, A					:     Dict=1_2		, A					:     Optional[Any]=1_2		, A					:     Any=3_0_7_2		, A					:     str="gelu"		, A					:     Optional[int]=0.0		, A					:     Union[str, Any]=0.0		, A					:     List[Any]=0.02		, A					:     int=1e-6		, A					:     Tuple=True		, A					:     Any="divided_space_time"		, A					:     Optional[Any]=0		, **A					:     Tuple		, )       ->str:
          super().__init__(**A      )

          lowerCamelCase__       :						Optional[Any]        =							image_size
          lowerCamelCase__       :						int        =							patch_size
          lowerCamelCase__       :						Any        =							num_channels
          lowerCamelCase__       :						Optional[int]        =							num_frames

          lowerCamelCase__       :						Optional[Any]        =							hidden_size
          lowerCamelCase__       :						Optional[int]        =							num_hidden_layers
          lowerCamelCase__       :						Optional[int]        =							num_attention_heads
          lowerCamelCase__       :						Dict        =							intermediate_size
          lowerCamelCase__       :						Optional[Any]        =							hidden_act
          lowerCamelCase__       :						Union[str, Any]        =							hidden_dropout_prob
          lowerCamelCase__       :						Dict        =							attention_probs_dropout_prob
          lowerCamelCase__       :						List[Any]        =							initializer_range
          lowerCamelCase__       :						str        =							layer_norm_eps
          lowerCamelCase__       :						Union[str, Any]        =							qkv_bias

          lowerCamelCase__       :						str        =							attention_type
          lowerCamelCase__       :						List[str]        =							drop_path_rate



