


'''simple docstring'''




import numpy as np

from transformers import Pipeline


def    UpperCAmelCase_  (       A      ):
   '''simple docstring'''





   _a					:  str						=  np.max(A		,	axis=-1		,	keepdims=A      )
   _a					:  List[str]						=  np.exp(outputs - maxes      )
   return shifted_exp / shifted_exp.sum(axis=-1		,	keepdims=A      )







class 					a			(				snake_case__  ):
 '''simple docstring'''




 def   __UpperCamelCase   (    self		,      **lowerCamelCase_      )      ->    List[str]:
    _a					:  Optional[Any]						=  {}
    if "second_text" in kwargs:
       _a					:  Any						=  kwargs['second_text']
    return preprocess_kwargs, {}, {}




 def   __UpperCamelCase   (    self		,      lowerCamelCase_		,      lowerCamelCase_=None      )      ->    str:
    return self.tokenizer(lowerCamelCase_		,      text_pair=lowerCamelCase_		,      return_tensors=self.framework      )




 def   __UpperCamelCase   (    self		,      lowerCamelCase_      )      ->    Union[str, Any]:
    return self.model(**lowerCamelCase_      )




 def   __UpperCamelCase   (    self		,      lowerCamelCase_      )      ->    Dict:
    _a					:  Optional[Any]						=  model_outputs.logits[0].numpy()
    _a					:  Any						=  softmax(lowerCamelCase_      )

    _a					:  Optional[int]						=  np.argmax(lowerCamelCase_      )
    _a					:  Tuple						=  self.model.config.idalabel[best_class]
    _a					:  str						=  probabilities[best_class].item()
    _a					:  int						=  logits.tolist()
    return {"label": label, "score": score, "logits": logits}






'''simple docstring'''




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


UpperCAmelCase_      :		Optional[int]          =		logging.get_logger(__name__)

UpperCAmelCase_      :		List[str]          =		{
    "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 					a			(				snake_case__  ):
 '''simple docstring'''




 __lowerCAmelCase						: str							  =		"""vivit"""




 def __init__(    self		,      lowerCamelCase_=2_2_4		,      lowerCamelCase_=3_2		,      lowerCamelCase_=[2, 1_6, 1_6]		,      lowerCamelCase_=3		,      lowerCamelCase_=7_6_8		,      lowerCamelCase_=1_2		,      lowerCamelCase_=1_2		,      lowerCamelCase_=3_0_7_2		,      lowerCamelCase_="gelu_fast"		,      lowerCamelCase_=0.0		,      lowerCamelCase_=0.0		,      lowerCamelCase_=0.02		,      lowerCamelCase_=1e-06		,      lowerCamelCase_=True		,      **lowerCamelCase_		,      )      ->    int:
    _a					:  Tuple						=  hidden_size
    _a					:  Dict						=  num_hidden_layers
    _a					:  List[str]						=  num_attention_heads
    _a					:  int						=  intermediate_size
    _a					:  Optional[int]						=  hidden_act
    _a					:  Dict						=  hidden_dropout_prob
    _a					:  List[str]						=  attention_probs_dropout_prob
    _a					:  List[str]						=  initializer_range
    _a					:  List[str]						=  layer_norm_eps

    _a					:  Any						=  image_size
    _a					:  Optional[Any]						=  num_frames
    _a					:  Dict						=  tubelet_size
    _a					:  Union[str, Any]						=  num_channels
    _a					:  Optional[int]						=  qkv_bias

    super().__init__(**lowerCamelCase_      )


