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


lowercase__	:Dict										=					logging.get_logger(__name__)

lowercase__	:int										=					{}







class        lowercase	(      SCREAMING_SNAKE_CASE__	):
							lowercase_ : Union[str, Any]       ='''llama'''
							lowercase_ : List[Any]       =['''past_key_values''']




							def __init__(       self     ,A__=3_2_0_0_0     ,A__=4_0_9_6     ,A__=1_1_0_0_8     ,A__=3_2     ,A__=3_2     ,A__=None     ,A__="silu"     ,A__=2_0_4_8     ,A__=0.02     ,A__=1E-6     ,A__=True     ,A__=0     ,A__=1     ,A__=2     ,A__=1     ,A__=False     ,A__=None     ,**A__     ,):
												lowercase					=		vocab_size
												lowercase					=		max_position_embeddings
												lowercase					=		hidden_size
												lowercase					=		intermediate_size
												lowercase					=		num_hidden_layers
												lowercase					=		num_attention_heads

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

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

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





							def 				A__   (       self):
												if self.rope_scaling is None:
																	return

												if not isinstance(self.rope_scaling     ,A__) 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}')
												lowercase					=		self.rope_scaling.get('''type'''     ,A__)
												lowercase					=		self.rope_scaling.get('''factor'''     ,A__)
												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(A__     ,A__) 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_torch_available


lowercase__	:Tuple										=					{
    "configuration_instructblip": [
        "INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "InstructBlipConfig",
        "InstructBlipQFormerConfig",
        "InstructBlipVisionConfig",
    ],
    "processing_instructblip": ["InstructBlipProcessor"],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowercase__	:List[str]										=					[
							    "INSTRUCTBLIP_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "InstructBlipQFormerModel",
							    "InstructBlipPreTrainedModel",
							    "InstructBlipForConditionalGeneration",
							    "InstructBlipVisionModel",
							]

if TYPE_CHECKING:
							from .configuration_instructblip import (
							    INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    InstructBlipConfig,
							    InstructBlipQFormerConfig,
							    InstructBlipVisionConfig,
							)
							from .processing_instructblip import InstructBlipProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_instructblip import (
														    INSTRUCTBLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
														    InstructBlipForConditionalGeneration,
														    InstructBlipPreTrainedModel,
														    InstructBlipQFormerModel,
														    InstructBlipVisionModel,
														)

else:
							import sys

							lowercase__	:List[str]										=					_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




