


"""simple docstring"""



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


__snake_case   			=    logging.get_logger(__name__)

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







class _lowerCAmelCase				(      snake_case_	):
   __UpperCAmelCase :       Optional[Any]							  =  '''gpt_bigcode'''
   __UpperCAmelCase :       Any							  =  ['''past_key_values''']
   __UpperCAmelCase :       List[str]							  =  {
       '''hidden_size''': '''n_embd''',
       '''max_position_embeddings''': '''n_positions''',
       '''num_attention_heads''': '''n_head''',
       '''num_hidden_layers''': '''n_layer''',
   }







   def __init__(	self						,	UpperCamelCase__=5_0257						,	UpperCamelCase__=1024						,	UpperCamelCase__=768						,	UpperCamelCase__=12						,	UpperCamelCase__=12						,	UpperCamelCase__=None						,	UpperCamelCase__="gelu_pytorch_tanh"						,	UpperCamelCase__=0.1						,	UpperCamelCase__=0.1						,	UpperCamelCase__=0.1						,	UpperCamelCase__=1e-5						,	UpperCamelCase__=0.02						,	UpperCamelCase__=True						,	UpperCamelCase__=True						,	UpperCamelCase__=5_0256						,	UpperCamelCase__=5_0256						,	UpperCamelCase__=True						,	UpperCamelCase__=True						,	UpperCamelCase__=True						,	**UpperCamelCase__						,	)	->		List[Any]:

       '''simple docstring'''




       snake_case    :      Any      					=    vocab_size
       snake_case    :      Union[str, Any]      					=    n_positions
       snake_case    :      Optional[int]      					=    n_embd
       snake_case    :      Any      					=    n_layer
       snake_case    :      Union[str, Any]      					=    n_head
       snake_case    :      Optional[int]      					=    n_inner
       snake_case    :      Any      					=    activation_function
       snake_case    :      List[str]      					=    resid_pdrop
       snake_case    :      Optional[Any]      					=    embd_pdrop
       snake_case    :      Any      					=    attn_pdrop
       snake_case    :      Union[str, Any]      					=    layer_norm_epsilon
       snake_case    :      Tuple      					=    initializer_range
       snake_case    :      List[Any]      					=    scale_attn_weights
       snake_case    :      int      					=    use_cache
       snake_case    :      str      					=    attention_softmax_in_fpaa
       snake_case    :      List[str]      					=    scale_attention_softmax_in_fpaa
       snake_case    :      Tuple      					=    multi_query

       snake_case    :      Optional[int]      					=    bos_token_id
       snake_case    :      Optional[Any]      					=    eos_token_id

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









"""simple docstring"""



from typing import Dict

from .base import GenericTensor, Pipeline







class _lowerCAmelCase				(      snake_case_	):







   def  lowerCamelCase		(	self						,	UpperCamelCase__=None						,	UpperCamelCase__=None						,	UpperCamelCase__=None						,	**UpperCamelCase__						)	->		Union[str, Any]:

       '''simple docstring'''




       if tokenize_kwargs is None:
           snake_case    :      Optional[Any]      					=    {}

       if truncation is not None:
           if "truncation" in tokenize_kwargs:
               raise ValueError(
                   "truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)"						)
           snake_case    :      List[str]      					=    truncation

       snake_case    :      Union[str, Any]      					=    tokenize_kwargs

       snake_case    :      List[Any]      					=    {}
       if return_tensors is not None:
           snake_case    :      Tuple      					=    return_tensors

       return preprocess_params, {}, postprocess_params







   def  lowerCamelCase		(	self						,	UpperCamelCase__						,	**UpperCamelCase__						)	->		Dict[str, GenericTensor]:

       '''simple docstring'''




       snake_case    :      List[Any]      					=    self.framework
       snake_case    :      str      					=    self.tokenizer(UpperCamelCase__						,	return_tensors=UpperCamelCase__						,	**UpperCamelCase__						)
       return model_inputs







   def  lowerCamelCase		(	self						,	UpperCamelCase__						)	->		Tuple:

       '''simple docstring'''




       snake_case    :      int      					=    self.model(**UpperCamelCase__						)
       return model_outputs







   def  lowerCamelCase		(	self						,	UpperCamelCase__						,	UpperCamelCase__=False						)	->		Union[str, Any]:

       '''simple docstring'''




       if return_tensors:
           return model_outputs[0]
       if self.framework == "pt":
           return model_outputs[0].tolist()
       elif self.framework == "tf":
           return model_outputs[0].numpy().tolist()







   def __call__(	self						,	*UpperCamelCase__						,	**UpperCamelCase__						)	->		Union[str, Any]:

       '''simple docstring'''




       return super().__call__(*UpperCamelCase__						,	**UpperCamelCase__						)





