"""simple docstring"""


import os
import sys
import unittest


lowerCAmelCase_:					Union[str, Any]        =					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_:					List[str]        =					os.path.join(git_repo_path, "src", "transformers")

lowerCAmelCase_:					Any        =					'''
{0} = None
'''

lowerCAmelCase_:					Dict        =					'''
class {0}(metaclass=DummyObject):
    _backends = {1}

    def __init__(self, *args, **kwargs):
        requires_backends(self, {1})
'''


lowerCAmelCase_:					str        =					'''
def {0}(*args, **kwargs):
    requires_backends({0}, {1})
'''






class    a__    (   unittest.TestCase	):


   def 	snake_case__	(     self  ):
        '''simple docstring'''



        lowercase__				 =							find_backend("    _import_structure[\"models.albert\"].append(\"AlbertTokenizerFast\")"  )
        self.assertIsNone(__SCREAMING_SNAKE_CASE  )

        lowercase__				 =							find_backend("    if not is_tokenizers_available():"  )
        self.assertEqual(__SCREAMING_SNAKE_CASE,				"tokenizers"  )

        lowercase__				 =							find_backend("    if not is_tensorflow_text_available():"  )
        self.assertEqual(__SCREAMING_SNAKE_CASE,				"tensorflow_text"  )

        lowercase__				 =							find_backend("    if not (is_sentencepiece_available() and is_tokenizers_available()):"  )
        self.assertEqual(__SCREAMING_SNAKE_CASE,				"sentencepiece_and_tokenizers"  )

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

        lowercase__				 =							find_backend(
            "    if not (is_sentencepiece_available() and is_tokenizers_available() and is_vision_available()):"  )
        self.assertEqual(__SCREAMING_SNAKE_CASE,				"sentencepiece_and_tokenizers_and_vision"  )


   def 	snake_case__	(     self  ):
        '''simple docstring'''



        lowercase__				 =							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("tensorflow_text",				__SCREAMING_SNAKE_CASE  )
        self.assertIn("sentencepiece_and_tokenizers",				__SCREAMING_SNAKE_CASE  )

        # Likewise, we can't assert on the exact content of a key
        self.assertIn("BertModel",				objects["torch"]  )
        self.assertIn("TFBertModel",				objects["tf"]  )
        self.assertIn("FlaxBertModel",				objects["flax"]  )
        self.assertIn("BertModel",				objects["torch"]  )
        self.assertIn("TFBertTokenizer",				objects["tensorflow_text"]  )
        self.assertIn("convert_slow_tokenizer",				objects["sentencepiece_and_tokenizers"]  )


   def 	snake_case__	(     self  ):
        '''simple docstring'''



        lowercase__				 =							create_dummy_object("CONSTANT",				"\'torch\'"  )
        self.assertEqual(__SCREAMING_SNAKE_CASE,				"\nCONSTANT = None\n"  )

        lowercase__				 =							create_dummy_object("function",				"\'torch\'"  )
        self.assertEqual(
            __SCREAMING_SNAKE_CASE,				"\ndef function(*args, **kwargs):\n    requires_backends(function, \'torch\')\n"  )

        lowercase__				 =							"\nclass FakeClass(metaclass=DummyObject):\n    _backends = \'torch\'\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, \'torch\')\n"
        lowercase__				 =							create_dummy_object("FakeClass",				"\'torch\'"  )
        self.assertEqual(__SCREAMING_SNAKE_CASE,				__SCREAMING_SNAKE_CASE  )


   def 	snake_case__	(     self  ):
        '''simple docstring'''



        lowercase__				 =							"# This file is autogenerated by the command `make fix-copies`, do not edit.\nfrom ..utils import DummyObject, requires_backends\n\n\nCONSTANT = None\n\n\ndef function(*args, **kwargs):\n    requires_backends(function, [\"torch\"])\n\n\nclass FakeClass(metaclass=DummyObject):\n    _backends = [\"torch\"]\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, [\"torch\"])\n"
        lowercase__				 =							create_dummy_files({"torch": ["CONSTANT", "function", "FakeClass"]}  )
        self.assertEqual(dummy_files["torch"],				__SCREAMING_SNAKE_CASE  )





"""simple docstring"""


from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCAmelCase_:					str     =					logging.get_logger(__name__)

lowerCAmelCase_:					List[Any]     =					{
    "facebook/data2vec-vision-base-ft": (
        "https://huggingface.co/facebook/data2vec-vision-base-ft/resolve/main/config.json"
    ),
}






class    a__    (   _a	):
   snake_case_							=      "data2vec-vision"


   def __init__(     self,				_UpperCAmelCase=768,				_UpperCAmelCase=12,				_UpperCAmelCase=12,				_UpperCAmelCase=3072,				_UpperCAmelCase="gelu",				_UpperCAmelCase=0.0,				_UpperCAmelCase=0.0,				_UpperCAmelCase=0.02,				_UpperCAmelCase=1E-12,				_UpperCAmelCase=224,				_UpperCAmelCase=16,				_UpperCAmelCase=3,				_UpperCAmelCase=False,				_UpperCAmelCase=False,				_UpperCAmelCase=False,				_UpperCAmelCase=False,				_UpperCAmelCase=0.1,				_UpperCAmelCase=0.1,				_UpperCAmelCase=True,				_UpperCAmelCase=[3, 5, 7, 11],				_UpperCAmelCase=[1, 2, 3, 6],				_UpperCAmelCase=True,				_UpperCAmelCase=0.4,				_UpperCAmelCase=256,				_UpperCAmelCase=1,				_UpperCAmelCase=False,				_UpperCAmelCase=255,				**_UpperCAmelCase,				):
        '''simple docstring'''



        super().__init__(**_UpperCAmelCase  )

        lowercase__				 =							hidden_size
        lowercase__				 =							num_hidden_layers
        lowercase__				 =							num_attention_heads
        lowercase__				 =							intermediate_size
        lowercase__				 =							hidden_act
        lowercase__				 =							hidden_dropout_prob
        lowercase__				 =							attention_probs_dropout_prob
        lowercase__				 =							initializer_range
        lowercase__				 =							layer_norm_eps

        lowercase__				 =							image_size
        lowercase__				 =							patch_size
        lowercase__				 =							num_channels
        lowercase__				 =							use_mask_token
        lowercase__				 =							use_absolute_position_embeddings
        lowercase__				 =							use_relative_position_bias
        lowercase__				 =							use_shared_relative_position_bias
        lowercase__				 =							layer_scale_init_value
        lowercase__				 =							drop_path_rate
        lowercase__				 =							use_mean_pooling
        # decode head attributes (semantic segmentation)
        lowercase__				 =							out_indices
        lowercase__				 =							pool_scales
        # auxiliary head attributes (semantic segmentation)
        lowercase__				 =							use_auxiliary_head
        lowercase__				 =							auxiliary_loss_weight
        lowercase__				 =							auxiliary_channels
        lowercase__				 =							auxiliary_num_convs
        lowercase__				 =							auxiliary_concat_input
        lowercase__				 =							semantic_loss_ignore_index






class    a__    (   _a	):
   snake_case_							=      version.parse("1.11"	)


   @property
   def 	snake_case__	(     self  ):
        '''simple docstring'''



        return OrderedDict(
            [
                ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
            ]  )


   @property
   def 	snake_case__	(     self  ):
        '''simple docstring'''



        return 1E-4




