






from collections import OrderedDict
from typing import Any, List, Mapping, Optional

from ... import PreTrainedTokenizer, TensorType, is_torch_available
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSpec
from ...utils import logging


SCREAMING_SNAKE_CASE__      :			Union[str, Any]							=		logging.get_logger(__name__)


SCREAMING_SNAKE_CASE__      :			List[Any]							=		{
    """Salesforce/codegen-350M-nl""": """https://huggingface.co/Salesforce/codegen-350M-nl/resolve/main/config.json""",
    """Salesforce/codegen-350M-multi""": """https://huggingface.co/Salesforce/codegen-350M-multi/resolve/main/config.json""",
    """Salesforce/codegen-350M-mono""": """https://huggingface.co/Salesforce/codegen-350M-mono/resolve/main/config.json""",
    """Salesforce/codegen-2B-nl""": """https://huggingface.co/Salesforce/codegen-2B-nl/resolve/main/config.json""",
    """Salesforce/codegen-2B-multi""": """https://huggingface.co/Salesforce/codegen-2B-multi/resolve/main/config.json""",
    """Salesforce/codegen-2B-mono""": """https://huggingface.co/Salesforce/codegen-2B-mono/resolve/main/config.json""",
    """Salesforce/codegen-6B-nl""": """https://huggingface.co/Salesforce/codegen-6B-nl/resolve/main/config.json""",
    """Salesforce/codegen-6B-multi""": """https://huggingface.co/Salesforce/codegen-6B-multi/resolve/main/config.json""",
    """Salesforce/codegen-6B-mono""": """https://huggingface.co/Salesforce/codegen-6B-mono/resolve/main/config.json""",
    """Salesforce/codegen-16B-nl""": """https://huggingface.co/Salesforce/codegen-16B-nl/resolve/main/config.json""",
    """Salesforce/codegen-16B-multi""": """https://huggingface.co/Salesforce/codegen-16B-multi/resolve/main/config.json""",
    """Salesforce/codegen-16B-mono""": """https://huggingface.co/Salesforce/codegen-16B-mono/resolve/main/config.json""",
}
class 						lowerCamelCase_				(      __a ):
    a__					       =  '''codegen'''
    a__					       =  {
        '''max_position_embeddings''': '''n_positions''',
        '''hidden_size''': '''n_embd''',
        '''num_attention_heads''': '''n_head''',
        '''num_hidden_layers''': '''n_layer''',
    }







    def __init__(						self       ,					__lowerCAmelCase=5_0_4_0_0       ,					__lowerCAmelCase=2_0_4_8       ,					__lowerCAmelCase=2_0_4_8       ,					__lowerCAmelCase=4_0_9_6       ,					__lowerCAmelCase=2_8       ,					__lowerCAmelCase=1_6       ,					__lowerCAmelCase=6_4       ,					__lowerCAmelCase=None       ,					__lowerCAmelCase="gelu_new"       ,					__lowerCAmelCase=0.0       ,					__lowerCAmelCase=0.0       ,					__lowerCAmelCase=0.0       ,					__lowerCAmelCase=1E-5       ,					__lowerCAmelCase=0.02       ,					__lowerCAmelCase=True       ,					__lowerCAmelCase=5_0_2_5_6       ,					__lowerCAmelCase=5_0_2_5_6       ,					__lowerCAmelCase=False       ,					**__lowerCAmelCase       ,					):
        """simple docstring"""
        __magic_name__		:str        =      vocab_size
        __magic_name__		:Union[str, Any]        =      n_ctx
        __magic_name__		:str        =      n_positions
        __magic_name__		:int        =      n_embd
        __magic_name__		:List[str]        =      n_layer
        __magic_name__		:str        =      n_head
        __magic_name__		:Dict        =      n_inner
        __magic_name__		:Any        =      rotary_dim
        __magic_name__		:Dict        =      activation_function
        __magic_name__		:Any        =      resid_pdrop
        __magic_name__		:Tuple        =      embd_pdrop
        __magic_name__		:Tuple        =      attn_pdrop
        __magic_name__		:int        =      layer_norm_epsilon
        __magic_name__		:Any        =      initializer_range
        __magic_name__		:Union[str, Any]        =      use_cache

        __magic_name__		:List[str]        =      bos_token_id
        __magic_name__		:Optional[Any]        =      eos_token_id

        super().__init__(
            bos_token_id=A__       ,					eos_token_id=A__       ,					tie_word_embeddings=A__       ,					**A__     )







class 						lowerCamelCase_				(      __a ):







    def __init__(						self       ,					__lowerCAmelCase       ,					__lowerCAmelCase = "default"       ,					__lowerCAmelCase = None       ,					__lowerCAmelCase = False       ,					):
        """simple docstring"""
        super().__init__(A__       ,					task=A__       ,					patching_specs=A__       ,					use_past=A__     )
        if not getattr(self._config       ,					'''pad_token_id'''       ,					A__     ):
            # TODO: how to do that better?
            __magic_name__		:Union[str, Any]        =      0







    @property
    def 			A	(						self     ):
        """simple docstring"""
        __magic_name__		:int        =      OrderedDict({'''input_ids''': {0: '''batch''', 1: '''sequence'''}}     )
        if self.use_past:
            self.fill_with_past_key_values_(A__       ,					direction='''inputs'''     )
            __magic_name__		:Union[str, Any]        =      {0: '''batch''', 1: '''past_sequence + sequence'''}
        else:
            __magic_name__		:List[Any]        =      {0: '''batch''', 1: '''sequence'''}

        return common_inputs







    @property
    def 			A	(						self     ):
        """simple docstring"""
        return self._config.n_layer







    @property
    def 			A	(						self     ):
        """simple docstring"""
        return self._config.n_head







    def 			A	(						self       ,					__lowerCAmelCase       ,					__lowerCAmelCase = -1       ,					__lowerCAmelCase = -1       ,					__lowerCAmelCase = False       ,					__lowerCAmelCase = None       ,					):
        """simple docstring"""
        __magic_name__		:Any        =      super(A__       ,					self     ).generate_dummy_inputs(
            A__       ,					batch_size=A__       ,					seq_length=A__       ,					is_pair=A__       ,					framework=A__     )

        # We need to order the input in the way they appears in the forward()
        __magic_name__		:Optional[Any]        =      OrderedDict({'''input_ids''': common_inputs['''input_ids''']}     )

        # Need to add the past_keys
        if self.use_past:
            if not is_torch_available():
                raise ValueError('''Cannot generate dummy past_keys inputs without PyTorch installed.'''     )
            else:
                import torch

                __magic_name__     ,				__magic_name__		:str        =      common_inputs['''input_ids'''].shape
                # Not using the same length for past_key_values
                __magic_name__		:str        =      seqlen + 2
                __magic_name__		:Optional[Any]        =      (
                    batch,
                    self.num_attention_heads,
                    past_key_values_length,
                    self._config.hidden_size // self.num_attention_heads,
                )
                __magic_name__		:Any        =      [
                    (torch.zeros(A__     ), torch.zeros(A__     )) for _ in range(self.num_layers     )
                ]

        __magic_name__		:Any        =      common_inputs['''attention_mask''']
        if self.use_past:
            __magic_name__		:Any        =      ordered_inputs['''attention_mask'''].dtype
            __magic_name__		:Tuple        =      torch.cat(
                [ordered_inputs['''attention_mask'''], torch.ones(A__       ,					A__       ,					dtype=A__     )]       ,					dim=1     )

        return ordered_inputs







    @property
    def 			A	(						self     ):
        """simple docstring"""
        return 1_3














from __future__ import annotations

from math import pi, sqrt

def      __lowercase					( snake_case,  snake_case ):







				"""simple docstring"""






				if inductance <= 0:
								raise ValueError('''Inductance cannot be 0 or negative''' )

				elif capacitance <= 0:
								raise ValueError('''Capacitance cannot be 0 or negative''' )

				else:
								return (
								    "Resonant frequency",
								    float(1 / (2 * pi * (sqrt(inductance * capacitance ))) ),
								)


if __name__ == "__main__":
					import doctest

					doctest.testmod()






