






import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


__a   :							Dict						= logging.getLogger()


@unittest.skip("Temporarily disable the doc tests."	)
@require_torch
@require_tf
@slow
class    __lowercase   (						unittest.TestCase	):







     '''simple docstring'''




     def 		lowerCAmelCase_  (					self							:      Optional[int]			,						UpperCamelCase_							:      Path			,						UpperCamelCase_							:      Union[str, None] = None			,						UpperCamelCase_							:      Union[List[str], None] = None			,						UpperCamelCase_							:      Union[str, List[str], None] = None			,						UpperCamelCase_							:      bool = True			,						):


         """simple docstring"""



         __A       =						[file for file in os.listdir(UpperCamelCase_					) if os.path.isfile(os.path.join(UpperCamelCase_			,						UpperCamelCase_					)					)]

         if identifier is not None:
             __A       =						[file for file in files if identifier in file]

         if n_identifier is not None:
             if isinstance(UpperCamelCase_			,						UpperCamelCase_					):
                 for n_ in n_identifier:
                     __A       =						[file for file in files if n_ not in file]
             else:
                 __A       =						[file for file in files if n_identifier not in file]

         __A       =						ignore_files or []
         ignore_files.append("""__init__.py"""					)
         __A       =						[file for file in files if file not in ignore_files]

         for file in files:
             # Open all files
             print("""Testing"""			,						UpperCamelCase_					)

             if only_modules:
                 __A       =						file.split("""."""					)[0]
                 try:
                     __A       =						getattr(UpperCamelCase_			,						UpperCamelCase_					)
                     __A       =						doctest.DocTestSuite(UpperCamelCase_					)
                     __A       =						unittest.TextTestRunner().run(UpperCamelCase_					)
                     self.assertIs(len(result.failures					)			,						0					)
                 except AttributeError:
                     logger.info(F"{module_identifier} is not a module."					)
             else:
                 __A       =						doctest.testfile(str("""..""" / directory / file					)			,						optionflags=doctest.ELLIPSIS					)
                 self.assertIs(result.failed			,						0					)




     def 		lowerCAmelCase_  (					self							:      Union[str, Any]					):


         """simple docstring"""



         __A       =						Path("""src/transformers"""					)
         __A       =						"""modeling"""
         __A       =						[
             """modeling_ctrl.py""",
             """modeling_tf_ctrl.py""",
         ]
         self.analyze_directory(UpperCamelCase_			,						identifier=UpperCamelCase_			,						ignore_files=UpperCamelCase_					)




     def 		lowerCAmelCase_  (					self							:      Dict					):


         """simple docstring"""



         __A       =						Path("""src/transformers"""					)
         __A       =						"""tokenization"""
         self.analyze_directory(UpperCamelCase_			,						identifier=UpperCamelCase_					)




     def 		lowerCAmelCase_  (					self							:      str					):


         """simple docstring"""



         __A       =						Path("""src/transformers"""					)
         __A       =						"""configuration"""
         self.analyze_directory(UpperCamelCase_			,						identifier=UpperCamelCase_					)




     def 		lowerCAmelCase_  (					self							:      Any					):


         """simple docstring"""



         __A       =						Path("""src/transformers"""					)
         __A       =						["""configuration""", """modeling""", """tokenization"""]
         self.analyze_directory(UpperCamelCase_			,						n_identifier=UpperCamelCase_					)





     def 		lowerCAmelCase_  (					self							:      int					):


         """simple docstring"""



         __A       =						Path("""docs/source"""					)
         __A       =						["""favicon.ico"""]
         self.analyze_directory(UpperCamelCase_			,						ignore_files=UpperCamelCase_			,						only_modules=UpperCamelCase_					)












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


__a   :							Dict						= logging.get_logger(__name__)

__a   :							Dict						= {
    "bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}


class    __lowercase   (						lowercase_	):







     '''simple docstring'''
     SCREAMING_SNAKE_CASE     =					"gpt_bigcode"
     SCREAMING_SNAKE_CASE     =					["past_key_values"]
     SCREAMING_SNAKE_CASE     =					{
         "hidden_size": "n_embd",
         "max_position_embeddings": "n_positions",
         "num_attention_heads": "n_head",
         "num_hidden_layers": "n_layer",
     }




     def __init__(					self							:      List[str]			,						UpperCamelCase_							:      Dict=50_257			,						UpperCamelCase_							:      int=1_024			,						UpperCamelCase_							:      List[Any]=768			,						UpperCamelCase_							:      str=12			,						UpperCamelCase_							:      Union[str, Any]=12			,						UpperCamelCase_							:      Optional[Any]=None			,						UpperCamelCase_							:      Tuple="gelu_pytorch_tanh"			,						UpperCamelCase_							:      Optional[Any]=0.1			,						UpperCamelCase_							:      List[str]=0.1			,						UpperCamelCase_							:      Optional[int]=0.1			,						UpperCamelCase_							:      int=1e-5			,						UpperCamelCase_							:      Tuple=0.02			,						UpperCamelCase_							:      Any=True			,						UpperCamelCase_							:      List[Any]=True			,						UpperCamelCase_							:      Dict=50_256			,						UpperCamelCase_							:      Optional[Any]=50_256			,						UpperCamelCase_							:      int=True			,						UpperCamelCase_							:      List[Any]=True			,						UpperCamelCase_							:      List[Any]=True			,						**UpperCamelCase_							:      int			,						):


         """simple docstring"""



         __A       =						vocab_size
         __A       =						n_positions
         __A       =						n_embd
         __A       =						n_layer
         __A       =						n_head
         __A       =						n_inner
         __A       =						activation_function
         __A       =						resid_pdrop
         __A       =						embd_pdrop
         __A       =						attn_pdrop
         __A       =						layer_norm_epsilon
         __A       =						initializer_range
         __A       =						scale_attn_weights
         __A       =						use_cache
         __A       =						attention_softmax_in_fpaa
         __A       =						scale_attention_softmax_in_fpaa
         __A       =						multi_query

         __A       =						bos_token_id
         __A       =						eos_token_id

         super().__init__(bos_token_id=UpperCamelCase_			,						eos_token_id=UpperCamelCase_			,						**UpperCamelCase_					)




