





"""simple docstring"""
import os
import sys
import unittest


lowerCamelCase_       =		os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, "utils"))

import check_dummies  # noqa: E402
from check_dummies import create_dummy_files, create_dummy_object, find_backend, read_init  # noqa: E402


# Align TRANSFORMERS_PATH in check_dummies with the current path
lowerCamelCase_       =		os.path.join(git_repo_path, "src", "diffusers")






class  _SCREAMING_SNAKE_CASE(       unittest.TestCase  ):




       def    _UpperCamelCase					(						self							)      ->				List[Any]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :int		    =  find_backend('''    if not is_torch_available():'''							)
             self.assertEqual(SCREAMING_SNAKE_CASE__		,'''torch'''							)

             # backend_with_underscore = find_backend("    if not is_tensorflow_text_available():")
             # self.assertEqual(backend_with_underscore, "tensorflow_text")

             __SCREAMING_SNAKE_CASE       :List[Any]		    =  find_backend('''    if not (is_torch_available() and is_transformers_available()):'''							)
             self.assertEqual(SCREAMING_SNAKE_CASE__		,'''torch_and_transformers'''							)

             # double_backend_with_underscore = find_backend(
             #    "    if not (is_sentencepiece_available() and is_tensorflow_text_available()):"
             # )
             # self.assertEqual(double_backend_with_underscore, "sentencepiece_and_tensorflow_text")

             __SCREAMING_SNAKE_CASE       :Any		    =  find_backend(
                 '''    if not (is_torch_available() and is_transformers_available() and is_onnx_available()):'''							)
             self.assertEqual(SCREAMING_SNAKE_CASE__		,'''torch_and_transformers_and_onnx'''							)




       def    _UpperCamelCase					(						self							)      ->				str:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Any		    =  read_init()
             # We don't assert on the exact list of keys to allow for smooth grow of backend-specific objects
             self.assertIn('''torch'''		,SCREAMING_SNAKE_CASE__							)
             self.assertIn('''torch_and_transformers'''		,SCREAMING_SNAKE_CASE__							)
             self.assertIn('''flax_and_transformers'''		,SCREAMING_SNAKE_CASE__							)
             self.assertIn('''torch_and_transformers_and_onnx'''		,SCREAMING_SNAKE_CASE__							)

             # Likewise, we can't assert on the exact content of a key
             self.assertIn('''UNet2DModel'''		,objects['''torch''']							)
             self.assertIn('''FlaxUNet2DConditionModel'''		,objects['''flax''']							)
             self.assertIn('''StableDiffusionPipeline'''		,objects['''torch_and_transformers''']							)
             self.assertIn('''FlaxStableDiffusionPipeline'''		,objects['''flax_and_transformers''']							)
             self.assertIn('''LMSDiscreteScheduler'''		,objects['''torch_and_scipy''']							)
             self.assertIn('''OnnxStableDiffusionPipeline'''		,objects['''torch_and_transformers_and_onnx''']							)




       def    _UpperCamelCase					(						self							)      ->				Dict:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :str		    =  create_dummy_object('''CONSTANT'''		,'''\'torch\''''							)
             self.assertEqual(SCREAMING_SNAKE_CASE__		,'''\nCONSTANT = None\n'''							)

             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  create_dummy_object('''function'''		,'''\'torch\''''							)
             self.assertEqual(
                 SCREAMING_SNAKE_CASE__		,'''\ndef function(*args, **kwargs):\n    requires_backends(function, \'torch\')\n'''							)

             __SCREAMING_SNAKE_CASE       :List[Any]		    =  '''
class FakeClass(metaclass=DummyObject):
    _backends = \'torch\'

    def __init__(self, *args, **kwargs):
        requires_backends(self, \'torch\')

    @classmethod
    def from_config(cls, *args, **kwargs):
        requires_backends(cls, \'torch\')

    @classmethod
    def from_pretrained(cls, *args, **kwargs):
        requires_backends(cls, \'torch\')
'''
             __SCREAMING_SNAKE_CASE       :str		    =  create_dummy_object('''FakeClass'''		,'''\'torch\''''							)
             self.assertEqual(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)




       def    _UpperCamelCase					(						self							)      ->				Optional[Any]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :List[Any]		    =  '''# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends


CONSTANT = None


def function(*args, **kwargs):
    requires_backends(function, ["torch"])


class FakeClass(metaclass=DummyObject):
    _backends = ["torch"]

    def __init__(self, *args, **kwargs):
        requires_backends(self, ["torch"])

    @classmethod
    def from_config(cls, *args, **kwargs):
        requires_backends(cls, ["torch"])

    @classmethod
    def from_pretrained(cls, *args, **kwargs):
        requires_backends(cls, ["torch"])
'''
             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  create_dummy_files({'''torch''': ['''CONSTANT''', '''function''', '''FakeClass''']}							)
             self.assertEqual(dummy_files['''torch''']		,SCREAMING_SNAKE_CASE__							)






"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase_       =		logging.get_logger(__name__)

lowerCamelCase_       =		{
    "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  _SCREAMING_SNAKE_CASE(       A  ):
       SCREAMING_SNAKE_CASE_       :				Optional[Any]     						=  '''vivit'''




       def __init__(						self		,SCREAMING_SNAKE_CASE__=2_24		,SCREAMING_SNAKE_CASE__=32		,SCREAMING_SNAKE_CASE__=[2, 16, 16]		,SCREAMING_SNAKE_CASE__=3		,SCREAMING_SNAKE_CASE__=7_68		,SCREAMING_SNAKE_CASE__=12		,SCREAMING_SNAKE_CASE__=12		,SCREAMING_SNAKE_CASE__=30_72		,SCREAMING_SNAKE_CASE__="gelu_fast"		,SCREAMING_SNAKE_CASE__=0.0		,SCREAMING_SNAKE_CASE__=0.0		,SCREAMING_SNAKE_CASE__=0.0_2		,SCREAMING_SNAKE_CASE__=1E-06		,SCREAMING_SNAKE_CASE__=True		,**SCREAMING_SNAKE_CASE__		,)      ->				str:





             """simple docstring"""






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

             __SCREAMING_SNAKE_CASE       :Any		    =  image_size
             __SCREAMING_SNAKE_CASE       :Any		    =  num_frames
             __SCREAMING_SNAKE_CASE       :Any		    =  tubelet_size
             __SCREAMING_SNAKE_CASE       :Tuple		    =  num_channels
             __SCREAMING_SNAKE_CASE       :List[str]		    =  qkv_bias

             super().__init__(**SCREAMING_SNAKE_CASE__							)