




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


_lowerCamelCase     :		str								=       logging.get_logger(__name__)

_lowerCamelCase     :		Tuple								=       {
    """EleutherAI/gpt-neox-20b""": """https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json""",
    # See all GPTNeoX models at https://huggingface.co/models?filter=gpt_neox
}


class     UpperCamelCase_   (			UpperCAmelCase__					):

    '''simple docstring'''






    UpperCAmelCase__							  =				'''gpt_neox'''


    def __init__(      self				:     List[str] ,			UpperCAmelCase__				:     List[Any]=50_432 ,			UpperCAmelCase__				:     List[str]=6_144 ,			UpperCAmelCase__				:     List[str]=44 ,			UpperCAmelCase__				:     int=64 ,			UpperCAmelCase__				:     Tuple=24_576 ,			UpperCAmelCase__				:     Tuple="gelu" ,			UpperCAmelCase__				:     List[str]=0.25 ,			UpperCAmelCase__				:     Optional[int]=10_000 ,			UpperCAmelCase__				:     int=0.0 ,			UpperCAmelCase__				:     Optional[Any]=0.0 ,			UpperCAmelCase__				:     List[Any]=0.1 ,			UpperCAmelCase__				:     List[str]=2_048 ,			UpperCAmelCase__				:     Optional[Any]=0.02 ,			UpperCAmelCase__				:     int=1e-5 ,			UpperCAmelCase__				:     Union[str, Any]=True ,			UpperCAmelCase__				:     List[str]=0 ,			UpperCAmelCase__				:     int=2 ,			UpperCAmelCase__				:     List[Any]=False ,			UpperCAmelCase__				:     int=True ,			UpperCAmelCase__				:     Optional[int]=None ,			**UpperCAmelCase__				:     Optional[Any] ,			)						->List[Any]:





           '''simple docstring'''

           super().__init__(bos_token_id=UpperCAmelCase__ ,			eos_token_id=UpperCAmelCase__ ,			**UpperCAmelCase__)
           A__							=   vocab_size
           A__							=   max_position_embeddings
           A__							=   hidden_size
           A__							=   num_hidden_layers
           A__							=   num_attention_heads
           A__							=   intermediate_size
           A__							=   hidden_act
           A__							=   rotary_pct
           A__							=   rotary_emb_base
           A__							=   attention_dropout
           A__							=   hidden_dropout
           A__							=   classifier_dropout
           A__							=   initializer_range
           A__							=   layer_norm_eps
           A__							=   use_cache
           A__							=   tie_word_embeddings
           A__							=   use_parallel_residual
           A__							=   rope_scaling
           self._rope_scaling_validation()

           if self.hidden_size % self.num_attention_heads != 0:
                  raise ValueError(
                      '''The hidden size is not divisble by the number of attention heads! Make sure to update them!''')





    def 	SCREAMING_SNAKE_CASE							(      self				:     Optional[Any])						->List[str]:





           '''simple docstring'''

           if self.rope_scaling is None:
                  return

           if not isinstance(self.rope_scaling ,			UpperCAmelCase__) or len(self.rope_scaling) != 2:
                  raise ValueError(
                      '''`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, '''
                      f"""got {self.rope_scaling}""")
           A__							=   self.rope_scaling.get('''type''' ,			UpperCAmelCase__)
           A__							=   self.rope_scaling.get('''factor''' ,			UpperCAmelCase__)
           if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
                  raise ValueError(
                      f"""`rope_scaling`'s name field must be one of ['linear', 'dynamic'], got {rope_scaling_type}""")
           if rope_scaling_factor is None or not isinstance(UpperCAmelCase__ ,			UpperCAmelCase__) or rope_scaling_factor <= 1.0:
                  raise ValueError(f"""`rope_scaling`'s factor field must be an float > 1, got {rope_scaling_factor}""")








from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_tf_available,
    is_torch_available,
)


_lowerCamelCase     :		Tuple								=       {
    """configuration_speech_to_text""": ["""SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Speech2TextConfig"""],
    """processing_speech_to_text""": ["""Speech2TextProcessor"""],
}

try:
  if not is_sentencepiece_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCamelCase     :		int								=       ["""Speech2TextTokenizer"""]

try:
  if not is_speech_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCamelCase     :		Optional[int]								=       ["""Speech2TextFeatureExtractor"""]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCamelCase     :		Optional[Any]								=       [
      """TF_SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFSpeech2TextForConditionalGeneration""",
      """TFSpeech2TextModel""",
      """TFSpeech2TextPreTrainedModel""",
  ]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _lowerCamelCase     :		List[Any]								=       [
      """SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """Speech2TextForConditionalGeneration""",
      """Speech2TextModel""",
      """Speech2TextPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_speech_to_text import SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, SpeechaTextConfig
  from .processing_speech_to_text import SpeechaTextProcessor

  try:
    if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_speech_to_text import SpeechaTextTokenizer

  try:
    if not is_speech_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .feature_extraction_speech_to_text import SpeechaTextFeatureExtractor

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_speech_to_text import (
        TF_SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFSpeechaTextForConditionalGeneration,
        TFSpeechaTextModel,
        TFSpeechaTextPreTrainedModel,
    )

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_speech_to_text import (
        SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
        SpeechaTextForConditionalGeneration,
        SpeechaTextModel,
        SpeechaTextPreTrainedModel,
    )

else:
  import sys

  _lowerCamelCase     :		Union[str, Any]								=       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


