





import os
import sys
import unittest


_UpperCAmelCase             =							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
_UpperCAmelCase             =							os.path.join(git_repo_path, 'src', 'transformers')

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

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


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






class        snake_case_    (		unittest.TestCase						):






  def 				UpperCAmelCase__						(							self			:					int      )->Optional[int]:






   '''simple docstring'''

   __lowerCAmelCase					:	Optional[int]      =       find_backend("""    _import_structure[\"models.albert\"].append(\"AlbertTokenizerFast\")"""      )
   self.assertIsNone(_snake_case      )

   __lowerCAmelCase					:	List[str]      =       find_backend("""    if not is_tokenizers_available():"""      )
   self.assertEqual(_snake_case       ,  """tokenizers"""      )

   __lowerCAmelCase					:	Tuple      =       find_backend("""    if not is_tensorflow_text_available():"""      )
   self.assertEqual(_snake_case       ,  """tensorflow_text"""      )

   __lowerCAmelCase					:	Any      =       find_backend("""    if not (is_sentencepiece_available() and is_tokenizers_available()):"""      )
   self.assertEqual(_snake_case       ,  """sentencepiece_and_tokenizers"""      )

   __lowerCAmelCase					:	Dict      =       find_backend(
       """    if not (is_sentencepiece_available() and is_tensorflow_text_available()):"""      )
   self.assertEqual(_snake_case       ,  """sentencepiece_and_tensorflow_text"""      )

   __lowerCAmelCase					:	List[Any]      =       find_backend(
       """    if not (is_sentencepiece_available() and is_tokenizers_available() and is_vision_available()):"""      )
   self.assertEqual(_snake_case       ,  """sentencepiece_and_tokenizers_and_vision"""      )






  def 				UpperCAmelCase__						(							self			:					int      )->int:






   '''simple docstring'''

   __lowerCAmelCase					:	int      =       read_init()
   # We don't assert on the exact list of keys to allow for smooth grow of backend-specific objects
   self.assertIn("""torch"""       ,  _snake_case      )
   self.assertIn("""tensorflow_text"""       ,  _snake_case      )
   self.assertIn("""sentencepiece_and_tokenizers"""       ,  _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 				UpperCAmelCase__						(							self			:					Dict      )->List[str]:






   '''simple docstring'''

   __lowerCAmelCase					:	Tuple      =       create_dummy_object("""CONSTANT"""       ,  """'torch'"""      )
   self.assertEqual(_snake_case       ,  """\nCONSTANT = None\n"""      )

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

   __lowerCAmelCase					:	Union[str, Any]      =       """
class FakeClass(metaclass=DummyObject):
    _backends = 'torch'

    def __init__(self, *args, **kwargs):
        requires_backends(self, 'torch')
"""
   __lowerCAmelCase					:	List[str]      =       create_dummy_object("""FakeClass"""       ,  """'torch'"""      )
   self.assertEqual(_snake_case       ,  _snake_case      )






  def 				UpperCAmelCase__						(							self			:					Tuple      )->str:






   '''simple docstring'''

   __lowerCAmelCase					:	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\"])
"""
   __lowerCAmelCase					:	Dict      =       create_dummy_files({"""torch""": ["""CONSTANT""", """function""", """FakeClass"""]}      )
   self.assertEqual(dummy_files["""torch"""]       ,  _snake_case      )






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


_UpperCAmelCase             =							logging.get_logger(__name__)

_UpperCAmelCase             =							{
    'microsoft/biogpt': 'https://huggingface.co/microsoft/biogpt/resolve/main/config.json',
    # See all BioGPT models at https://huggingface.co/models?filter=biogpt
}






class        snake_case_    (		__lowercase						):
  A_      							=   'biogpt'






  def __init__(							self			:					int       ,  _snake_case			:					Any=42384       ,  _snake_case			:					Any=1024       ,  _snake_case			:					List[Any]=24       ,  _snake_case			:					Any=16       ,  _snake_case			:					List[str]=4096       ,  _snake_case			:					Dict="gelu"       ,  _snake_case			:					Tuple=0.1       ,  _snake_case			:					str=0.1       ,  _snake_case			:					Tuple=1024       ,  _snake_case			:					Tuple=0.02       ,  _snake_case			:					Tuple=1E-12       ,  _snake_case			:					Optional[int]=True       ,  _snake_case			:					Optional[int]=True       ,  _snake_case			:					Any=0.0       ,  _snake_case			:					Tuple=0.0       ,  _snake_case			:					str=1       ,  _snake_case			:					Dict=0       ,  _snake_case			:					str=2       ,  **_snake_case			:					Union[str, Any]       ,  )->Dict:






   '''simple docstring'''

   __lowerCAmelCase					:	List[Any]      =       vocab_size
   __lowerCAmelCase					:	Dict      =       max_position_embeddings
   __lowerCAmelCase					:	str      =       hidden_size
   __lowerCAmelCase					:	Dict      =       num_hidden_layers
   __lowerCAmelCase					:	List[Any]      =       num_attention_heads
   __lowerCAmelCase					:	Optional[Any]      =       intermediate_size
   __lowerCAmelCase					:	int      =       hidden_act
   __lowerCAmelCase					:	Any      =       hidden_dropout_prob
   __lowerCAmelCase					:	Any      =       attention_probs_dropout_prob
   __lowerCAmelCase					:	Any      =       initializer_range
   __lowerCAmelCase					:	int      =       layer_norm_eps
   __lowerCAmelCase					:	Optional[int]      =       scale_embedding
   __lowerCAmelCase					:	List[Any]      =       use_cache
   __lowerCAmelCase					:	str      =       layerdrop
   __lowerCAmelCase					:	Dict      =       activation_dropout
   super().__init__(pad_token_id=_snake_case       ,  bos_token_id=_snake_case       ,  eos_token_id=_snake_case       ,  **_snake_case      )