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


_snake_case      = logging.get_logger(__name__)

_snake_case      = {}
class       _lowerCAmelCase  (		__magic_name__							):

 """simple docstring"""
 SCREAMING_SNAKE_CASE_				:					Tuple       						="llama"
 SCREAMING_SNAKE_CASE_				:					Union[str, Any]       						=["past_key_values"]

 def __init__(						self			:			str					, SCREAMING_SNAKE_CASE__			:			List[str]=3_20_00					, SCREAMING_SNAKE_CASE__			:			str=40_96					, SCREAMING_SNAKE_CASE__			:			Dict=1_10_08					, SCREAMING_SNAKE_CASE__			:			Optional[Any]=32					, SCREAMING_SNAKE_CASE__			:			Optional[int]=32					, SCREAMING_SNAKE_CASE__			:			Dict=None					, SCREAMING_SNAKE_CASE__			:			List[Any]="silu"					, SCREAMING_SNAKE_CASE__			:			Tuple=20_48					, SCREAMING_SNAKE_CASE__			:			Optional[Any]=0.02					, SCREAMING_SNAKE_CASE__			:			Any=1e-6					, SCREAMING_SNAKE_CASE__			:			Optional[int]=True					, SCREAMING_SNAKE_CASE__			:			List[str]=0					, SCREAMING_SNAKE_CASE__			:			int=1					, SCREAMING_SNAKE_CASE__			:			int=2					, SCREAMING_SNAKE_CASE__			:			int=1					, SCREAMING_SNAKE_CASE__			:			Dict=False					, SCREAMING_SNAKE_CASE__			:			Optional[Any]=None					, **SCREAMING_SNAKE_CASE__			:			Any					, ):






      """simple docstring"""



      UpperCamelCase						    =					vocab_size
      UpperCamelCase						    =					max_position_embeddings
      UpperCamelCase						    =					hidden_size
      UpperCamelCase						    =					intermediate_size
      UpperCamelCase						    =					num_hidden_layers
      UpperCamelCase						    =					num_attention_heads

      # for backward compatibility
      if num_key_value_heads is None:
           UpperCamelCase						    =					num_attention_heads

      UpperCamelCase						    =					num_key_value_heads
      UpperCamelCase						    =					hidden_act
      UpperCamelCase						    =					initializer_range
      UpperCamelCase						    =					rms_norm_eps
      UpperCamelCase						    =					pretraining_tp
      UpperCamelCase						    =					use_cache
      UpperCamelCase						    =					rope_scaling
      self._rope_scaling_validation()

      super().__init__(
          pad_token_id=SCREAMING_SNAKE_CASE__					, bos_token_id=SCREAMING_SNAKE_CASE__					, eos_token_id=SCREAMING_SNAKE_CASE__					, tie_word_embeddings=SCREAMING_SNAKE_CASE__					, **SCREAMING_SNAKE_CASE__					, )






 def      __lowerCAmelCase  (						self			:			str   ):






      """simple docstring"""



      if self.rope_scaling is None:
           return

      if not isinstance(self.rope_scaling					, SCREAMING_SNAKE_CASE__   ) 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}'   )
      UpperCamelCase						    =					self.rope_scaling.get('type'					, SCREAMING_SNAKE_CASE__   )
      UpperCamelCase						    =					self.rope_scaling.get('factor'					, SCREAMING_SNAKE_CASE__   )
      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(SCREAMING_SNAKE_CASE__					, SCREAMING_SNAKE_CASE__   ) or rope_scaling_factor <= 1.0:
           raise ValueError(F'`rope_scaling`\'s factor field must be an float > 1, got {rope_scaling_factor}'   )




from ...utils import (
    OptionalDependencyNotAvailable,
    is_flax_available,
    is_torch_available,
    is_transformers_available,
)


try:
 if not (is_transformers_available() and is_torch_available()):
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 from ...utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
 from .multicontrolnet import MultiControlNetModel
 from .pipeline_controlnet import StableDiffusionControlNetPipeline
 from .pipeline_controlnet_imgaimg import StableDiffusionControlNetImgaImgPipeline
 from .pipeline_controlnet_inpaint import StableDiffusionControlNetInpaintPipeline


if is_transformers_available() and is_flax_available():
 from .pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline


