





"""simple docstring"""





import contextlib
import faulthandler
import io
import multiprocessing
import os
import platform
import signal
import tempfile
def  __A   (_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)					->List[str]:





  """simple docstring"""


  lowerCAmelCase__			:List[str]											=							multiprocessing.Manager()
  lowerCAmelCase__			:Any											=							manager.list()

  lowerCAmelCase__			:Optional[int]											=							multiprocessing.Process(target=_SCREAMING_SNAKE_CASE     ,   args=(check_program, result, timeout)			)
  p.start()
  p.join(timeout=timeout + 1			)
  if p.is_alive():
    p.kill()

  if not result:
    result.append('timed out'			)

  return {
      "task_id": task_id,
      "passed": result[0] == "passed",
      "result": result[0],
      "completion_id": completion_id,
  }
def  __A   (_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)					->Dict:





  """simple docstring"""


  with create_tempdir():
    # These system calls are needed when cleaning up tempdir.
    import os
    import shutil

    lowerCAmelCase__			:List[Any]											=							shutil.rmtree
    lowerCAmelCase__			:List[Any]											=							os.rmdir
    lowerCAmelCase__			:Optional[int]											=							os.chdir

    # Disable functionalities that can make destructive changes to the test.
    reliability_guard()

    # Run program.
    try:
      lowerCAmelCase__			:List[str]											=							{}
      with swallow_io():
        with time_limit(_SCREAMING_SNAKE_CASE			):
          exec(_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)
      result.append('passed'			)
    except TimeoutException:
      result.append('timed out'			)
    except BaseException as e:
      result.append(F"failed: {e}"			)

    # Needed for cleaning up.
    lowerCAmelCase__			:Any											=							rmtree
    lowerCAmelCase__			:List[str]											=							rmdir
    lowerCAmelCase__			:List[Any]											=							chdir
@contextlib.contextmanager
def  __A   (_SCREAMING_SNAKE_CASE			)					->Dict:





  """simple docstring"""


  def signal_handler(_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			):
    raise TimeoutException('Timed out!'			)

  signal.setitimer(signal.ITIMER_REAL     ,   _SCREAMING_SNAKE_CASE			)
  signal.signal(signal.SIGALRM     ,   _SCREAMING_SNAKE_CASE			)
  try:
    yield
  finally:
    signal.setitimer(signal.ITIMER_REAL     ,   0			)
@contextlib.contextmanager
def  __A   ()					->Any:





  """simple docstring"""


  lowerCAmelCase__			:Optional[Any]											=							WriteOnlyStringIO()
  with contextlib.redirect_stdout(_SCREAMING_SNAKE_CASE			):
    with contextlib.redirect_stderr(_SCREAMING_SNAKE_CASE			):
      with redirect_stdin(_SCREAMING_SNAKE_CASE			):
        yield
@contextlib.contextmanager
def  __A   ()					->int:





  """simple docstring"""


  with tempfile.TemporaryDirectory() as dirname:
    with chdir(_SCREAMING_SNAKE_CASE			):
      yield dirname






class 					_lowerCAmelCase   (     lowerCamelCase_       ):
       """simple docstring"""




       pass






class 					_lowerCAmelCase   (     io.StringIO       ):
       """simple docstring"""




       def      snake_case						(    self    , *__UpperCAmelCase    , **__UpperCAmelCase      ):



         '''simple docstring'''

         raise OSError






       def      snake_case						(    self    , *__UpperCAmelCase    , **__UpperCAmelCase      ):



         '''simple docstring'''

         raise OSError






       def      snake_case						(    self    , *__UpperCAmelCase    , **__UpperCAmelCase      ):



         '''simple docstring'''

         raise OSError






       def      snake_case						(    self    , *__UpperCAmelCase    , **__UpperCAmelCase      ):



         '''simple docstring'''

         return False






class 					_lowerCAmelCase   (     contextlib._RedirectStream       ):  # type: ignore
       """simple docstring"""




       __magic_name__     :Tuple		  =					"""stdin"""






@contextlib.contextmanager
def  __A   (_SCREAMING_SNAKE_CASE			)					->Dict:





  """simple docstring"""


  if root == ".":
    yield
    return
  lowerCAmelCase__			:Any											=							os.getcwd()
  os.chdir(_SCREAMING_SNAKE_CASE			)
  try:
    yield
  except BaseException as exc:
    raise exc
  finally:
    os.chdir(_SCREAMING_SNAKE_CASE			)




def  __A   (_SCREAMING_SNAKE_CASE=None			)					->Optional[int]:





  """simple docstring"""


  if maximum_memory_bytes is not None:
    import resource

    resource.setrlimit(resource.RLIMIT_AS     ,   (maximum_memory_bytes, maximum_memory_bytes)			)
    resource.setrlimit(resource.RLIMIT_DATA     ,   (maximum_memory_bytes, maximum_memory_bytes)			)
    if not platform.uname().system == "Darwin":
      resource.setrlimit(resource.RLIMIT_STACK     ,   (maximum_memory_bytes, maximum_memory_bytes)			)

  faulthandler.disable()

  import builtins

  lowerCAmelCase__			:Optional[Any]											=							None
  lowerCAmelCase__			:List[str]											=							None

  import os

  lowerCAmelCase__			:int											=							'1'

  lowerCAmelCase__			:str											=							None
  lowerCAmelCase__			:str											=							None
  lowerCAmelCase__			:Optional[int]											=							None
  lowerCAmelCase__			:Optional[int]											=							None
  lowerCAmelCase__			:Any											=							None
  lowerCAmelCase__			:Optional[Any]											=							None
  lowerCAmelCase__			:List[Any]											=							None
  lowerCAmelCase__			:Tuple											=							None
  lowerCAmelCase__			:Union[str, Any]											=							None
  lowerCAmelCase__			:int											=							None
  lowerCAmelCase__			:Union[str, Any]											=							None
  lowerCAmelCase__			:Optional[int]											=							None
  lowerCAmelCase__			:Optional[Any]											=							None
  lowerCAmelCase__			:Tuple											=							None
  lowerCAmelCase__			:Union[str, Any]											=							None
  lowerCAmelCase__			:List[str]											=							None
  lowerCAmelCase__			:int											=							None
  lowerCAmelCase__			:Optional[int]											=							None
  lowerCAmelCase__			:int											=							None
  lowerCAmelCase__			:List[str]											=							None
  lowerCAmelCase__			:Optional[Any]											=							None
  lowerCAmelCase__			:str											=							None
  lowerCAmelCase__			:List[str]											=							None
  lowerCAmelCase__			:List[str]											=							None
  lowerCAmelCase__			:Any											=							None
  lowerCAmelCase__			:List[Any]											=							None
  lowerCAmelCase__			:str											=							None

  import shutil

  lowerCAmelCase__			:int											=							None
  lowerCAmelCase__			:Tuple											=							None
  lowerCAmelCase__			:int											=							None

  import subprocess

  lowerCAmelCase__			:Any											=							None  # type: ignore

  lowerCAmelCase__			:List[str]											=							None

  import sys

  lowerCAmelCase__			:List[str]											=							None
  lowerCAmelCase__			:Dict											=							None
  lowerCAmelCase__			:List[Any]											=							None
  lowerCAmelCase__			:Optional[int]											=							None
  lowerCAmelCase__			:Dict											=							None







'''simple docstring'''







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


lowerCAmelCase_					:    Dict      	=			logging.get_logger(__name__)

lowerCAmelCase_					:    int      	=			{
    'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json',
}
class 				__SCREAMING_SNAKE_CASE  (lowerCamelCase_      ):






				"""simple docstring"""







				__a            ='gpt_bigcode'
				__a            =['past_key_values']
				__a            ={
				    'hidden_size': 'n_embd',
				    'max_position_embeddings': 'n_positions',
				    'num_attention_heads': 'n_head',
				    'num_hidden_layers': 'n_layer',
				}




				def __init__(  self     :					Optional[Any]					,				__a     :					Tuple=5_02_57					,				__a     :					str=10_24					,				__a     :					Dict=7_68					,				__a     :					Tuple=12					,				__a     :					str=12					,				__a     :					Optional[int]=None					,				__a     :					Dict="gelu_pytorch_tanh"					,				__a     :					Tuple=0.1					,				__a     :					Tuple=0.1					,				__a     :					Union[str, Any]=0.1					,				__a     :					Tuple=1e-5					,				__a     :					str=0.02					,				__a     :					Dict=True					,				__a     :					Union[str, Any]=True					,				__a     :					Optional[int]=5_02_56					,				__a     :					Optional[int]=5_02_56					,				__a     :					Union[str, Any]=True					,				__a     :					Dict=True					,				__a     :					Union[str, Any]=True					,				**__a     :					List[Any]					,				):
								_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=__a					,				eos_token_id=__a					,				**__a					)
