






"""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', 'transformers')

__lowerCamelCase							=  '\n{0} = None\n'

__lowerCamelCase							=  '\nclass {0}(metaclass=DummyObject):\n    _backends = {1}\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, {1})\n'


__lowerCamelCase							=  '\ndef {0}(*args, **kwargs):\n    requires_backends({0}, {1})\n'



class       __A		(   unittest.TestCase			):

					def   lowerCamelCase__   (			self  :      Optional[Any]					)			->							Tuple:
											__magic_name__:	Any							=       find_backend("""    _import_structure[\"models.albert\"].append(\"AlbertTokenizerFast\")"""					)
											self.assertIsNone(__UpperCAmelCase					)

											__magic_name__:	Union[str, Any]							=       find_backend("""    if not is_tokenizers_available():"""					)
											self.assertEqual(__UpperCAmelCase     ,		"""tokenizers"""					)

											__magic_name__:	Dict							=       find_backend("""    if not is_tensorflow_text_available():"""					)
											self.assertEqual(__UpperCAmelCase     ,		"""tensorflow_text"""					)

											__magic_name__:	Dict							=       find_backend("""    if not (is_sentencepiece_available() and is_tokenizers_available()):"""					)
											self.assertEqual(__UpperCAmelCase     ,		"""sentencepiece_and_tokenizers"""					)

											__magic_name__:	int							=       find_backend(
											    """    if not (is_sentencepiece_available() and is_tensorflow_text_available()):"""					)
											self.assertEqual(__UpperCAmelCase     ,		"""sentencepiece_and_tensorflow_text"""					)

											__magic_name__:	str							=       find_backend(
											    """    if not (is_sentencepiece_available() and is_tokenizers_available() and is_vision_available()):"""					)
											self.assertEqual(__UpperCAmelCase     ,		"""sentencepiece_and_tokenizers_and_vision"""					)

					def   lowerCamelCase__   (			self  :      str					)			->							List[Any]:
											__magic_name__:	Union[str, 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"""     ,		__UpperCAmelCase					)
											self.assertIn("""tensorflow_text"""     ,		__UpperCAmelCase					)
											self.assertIn("""sentencepiece_and_tokenizers"""     ,		__UpperCAmelCase					)

											# 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   lowerCamelCase__   (			self  :      Any					)			->							str:
											__magic_name__:	List[str]							=       create_dummy_object("""CONSTANT"""     ,		"""\'torch\'"""					)
											self.assertEqual(__UpperCAmelCase     ,		"""\nCONSTANT = None\n"""					)

											__magic_name__:	Optional[int]							=       create_dummy_object("""function"""     ,		"""\'torch\'"""					)
											self.assertEqual(
											    __UpperCAmelCase     ,		"""\ndef function(*args, **kwargs):\n    requires_backends(function, \'torch\')\n"""					)

											__magic_name__:	Optional[int]							=       """
class FakeClass(metaclass=DummyObject):
    _backends = \'torch\'

    def __init__(self, *args, **kwargs):
        requires_backends(self, \'torch\')
"""
											__magic_name__:	Union[str, Any]							=       create_dummy_object("""FakeClass"""     ,		"""\'torch\'"""					)
											self.assertEqual(__UpperCAmelCase     ,		__UpperCAmelCase					)






					def   lowerCamelCase__   (			self  :      Tuple					)			->							List[str]:
											__magic_name__:	str							=       """# 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\"])
"""
											__magic_name__:	Optional[Any]							=       create_dummy_files({"""torch""": ["""CONSTANT""", """function""", """FakeClass"""]}					)
											self.assertEqual(dummy_files["""torch"""]     ,		__UpperCAmelCase					)








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


a_								=       logging.get_logger(__name__)

a_								=       {
    """google/canine-s""": """https://huggingface.co/google/canine-s/resolve/main/config.json""",
    # See all CANINE models at https://huggingface.co/models?filter=canine
}



class 			__lowerCAmelCase  (						lowerCAmelCase__ ):
 lowerCAmelCase__							       =	"""canine"""




 def __init__(    self						,					__UpperCAmelCase=768						,					__UpperCAmelCase=12						,					__UpperCAmelCase=12						,					__UpperCAmelCase=3072						,					__UpperCAmelCase="gelu"						,					__UpperCAmelCase=0.1						,					__UpperCAmelCase=0.1						,					__UpperCAmelCase=16384						,					__UpperCAmelCase=16						,					__UpperCAmelCase=0.02						,					__UpperCAmelCase=1E-1_2						,					__UpperCAmelCase=0						,					__UpperCAmelCase=0Xe_000						,					__UpperCAmelCase=0Xe_001						,					__UpperCAmelCase=4						,					__UpperCAmelCase=4						,					__UpperCAmelCase=8						,					__UpperCAmelCase=16384						,					__UpperCAmelCase=128						,					**__UpperCAmelCase						,					):



    '''simple docstring'''
    super().__init__(pad_token_id=__UpperCAmelCase						,					bos_token_id=__UpperCAmelCase						,					eos_token_id=__UpperCAmelCase						,					**__UpperCAmelCase					)

    __lowerCamelCase    				=     max_position_embeddings
    __lowerCamelCase    				=     hidden_size
    __lowerCamelCase    				=     num_hidden_layers
    __lowerCamelCase    				=     num_attention_heads
    __lowerCamelCase    				=     intermediate_size
    __lowerCamelCase    				=     hidden_act
    __lowerCamelCase    				=     hidden_dropout_prob
    __lowerCamelCase    				=     attention_probs_dropout_prob
    __lowerCamelCase    				=     initializer_range
    __lowerCamelCase    				=     type_vocab_size
    __lowerCamelCase    				=     layer_norm_eps

    # Character config:
    __lowerCamelCase    				=     downsampling_rate
    __lowerCamelCase    				=     upsampling_kernel_size
    __lowerCamelCase    				=     num_hash_functions
    __lowerCamelCase    				=     num_hash_buckets
    __lowerCamelCase    				=     local_transformer_stride






