'''simple docstring'''




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


_lowercase		:				Optional[Any]	       =		logging.get_logger(__name__)

_lowercase		:				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 					__magic_name__		(					_UpperCAmelCase):
			UpperCamelCase__       = '''vivit'''







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

										lowercase_      :    Union[str, Any]       		= image_size
										lowercase_      :    Tuple       		= num_frames
										lowercase_      :    Tuple       		= tubelet_size
										lowercase_      :    Union[str, Any]       		= num_channels
										lowercase_      :    str       		= qkv_bias

										super().__init__(**lowercase_					)






'''simple docstring'''




from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow


if is_tf_available():
						import tensorflow as tf

						from transformers import AutoTokenizer, TFAutoModelForSeqaSeqLM





@require_tf
@require_sentencepiece
@require_tokenizers
class 					__magic_name__		(					unittest.TestCase):







			@slow
			def 			SCREAMING_SNAKE_CASE_  (			self       :						str					):
										lowercase_      :    Any       		= TFAutoModelForSeqaSeqLM.from_pretrained("""google/mt5-small"""					)
										lowercase_      :    Dict       		= AutoTokenizer.from_pretrained("""google/mt5-small"""					)

										lowercase_      :    Union[str, Any]       		= tokenizer("""Hello there"""       ,    return_tensors="""tf"""					).input_ids
										lowercase_      :    List[str]       		= tokenizer("""Hi I am"""       ,    return_tensors="""tf"""					).input_ids

										lowercase_      :    Optional[Any]       		= model(lowercase_       ,    labels=lowercase_					).loss
										lowercase_      :    Optional[int]       		= -tf.math.reduce_mean(lowercase_					).numpy()

										lowercase_      :    Optional[int]       		= -21.22_81_68
										self.assertTrue(abs(mtf_score - EXPECTED_SCORE					) < 2E-4					)





