class_docstr: [`Blip2Config`] is the configuration class to store the configuration of a [`Blip2ForConditionalGeneration`]. It is
  used to instantiate a BLIP-2 model according to the specified arguments, defining the vision model, Q-Former model
  and language model configs. Instantiating a configuration with the defaults will yield a similar configuration to
  that of the BLIP-2 [Salesforce/blip2-opt-2.7b](https://huggingface.co/Salesforce/blip2-opt-2.7b) architecture.
  
  Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
  documentation from [`PretrainedConfig`] for more information.
  
  Args:
      vision_config (`dict`, *optional*):
          Dictionary of configuration options used to initialize [`Blip2VisionConfig`].
      qformer_config (`dict`, *optional*):
          Dictionary of configuration options used to initialize [`Blip2QFormerConfig`].
      text_config (`dict`, *optional*):
          Dictionary of configuration options used to initialize any [`PretrainedConfig`].
      num_query_tokens (`int`, *optional*, defaults to 32):
          The number of query tokens passed through the Transformer.
  
      kwargs (*optional*):
          Dictionary of keyword arguments.
  
  Example:
  
  ```python
  >>> from transformers import (
  ...     Blip2VisionConfig,
  ...     Blip2QFormerConfig,
  ...     OPTConfig,
  ...     Blip2Config,
  ...     Blip2ForConditionalGeneration,
  ... )
  
  >>> # Initializing a Blip2Config with Salesforce/blip2-opt-2.7b style configuration
  >>> configuration = Blip2Config()
  
  >>> # Initializing a Blip2ForConditionalGeneration (with random weights) from the Salesforce/blip2-opt-2.7b style configuration
  >>> model = Blip2ForConditionalGeneration(configuration)
  
  >>> # Accessing the model configuration
  >>> configuration = model.config
  
  >>> # We can also initialize a Blip2Config from a Blip2VisionConfig, Blip2QFormerConfig and any PretrainedConfig
  
  >>> # Initializing BLIP-2 vision, BLIP-2 Q-Former and language model configurations
  >>> vision_config = Blip2VisionConfig()
  >>> qformer_config = Blip2QFormerConfig()
  >>> text_config = OPTConfig()
  
  >>> config = Blip2Config.from_text_vision_configs(vision_config, qformer_config, text_config)
  ```
class_docstr_tok: ["[","`","Blip2Config","`","]","is","the","configuration","class","to","store","the","configuration","of","a","[","`","Blip2ForConditionalGeneration","`","]",".","It","is","used","to","instantiate","a","BLIP-2","model","according","to","the","specified","arguments",",","defining","the","vision","model",",","Q-Former","model","and","language","model","configs",".","Instantiating","a","configuration","with","the","defaults","will","yield","a","similar","configuration","to","that","of","the","BLIP-2","[","Salesforce\/blip2-opt-2.7b","]","(","https",":","\/\/huggingface.co\/Salesforce\/blip2-opt-2.7b",")","architecture",".","Configuration","objects","inherit","from","[","`","PretrainedConfig","`","]","and","can","be","used","to","control","the","model","outputs",".","Read","the","documentation","from","[","`","PretrainedConfig","`","]","for","more","information",".","Args",":","vision_config","(","`","dict","`",",","*","optional","*",")",":","Dictionary","of","configuration","options","used","to","initialize","[","`","Blip2VisionConfig","`","]",".","qformer_config","(","`","dict","`",",","*","optional","*",")",":","Dictionary","of","configuration","options","used","to","initialize","[","`","Blip2QFormerConfig","`","]",".","text_config","(","`","dict","`",",","*","optional","*",")",":","Dictionary","of","configuration","options","used","to","initialize","any","[","`","PretrainedConfig","`","]",".","num_query_tokens","(","`","int","`",",","*","optional","*",",","defaults","to","32",")",":","The","number","of","query","tokens","passed","through","the","Transformer",".","kwargs","(","*","optional","*",")",":","Dictionary","of","keyword","arguments",".","Example",":","``","`","python",">",">",">","from","transformers","import","(","...","Blip2VisionConfig",",","...","Blip2QFormerConfig",",","...","OPTConfig",",","...","Blip2Config",",","...","Blip2ForConditionalGeneration",",","...",")",">",">",">","#","Initializing","a","Blip2Config","with","Salesforce\/blip2-opt-2.7b","style","configuration",">",">",">","configuration","=","Blip2Config","(",")",">",">",">","#","Initializing","a","Blip2ForConditionalGeneration","(","with","random","weights",")","from","the","Salesforce\/blip2-opt-2.7b","style","configuration",">",">",">","model","=","Blip2ForConditionalGeneration","(","configuration",")",">",">",">","#","Accessing","the","model","configuration",">",">",">","configuration","=","model.config",">",">",">","#","We","can","also","initialize","a","Blip2Config","from","a","Blip2VisionConfig",",","Blip2QFormerConfig","and","any","PretrainedConfig",">",">",">","#","Initializing","BLIP-2","vision",",","BLIP-2","Q-Former","and","language","model","configurations",">",">",">","vision_config","=","Blip2VisionConfig","(",")",">",">",">","qformer_config","=","Blip2QFormerConfig","(",")",">",">",">","text_config","=","OPTConfig","(",")",">",">",">","config","=","Blip2Config.from_text_vision_configs","(","vision_config",",","qformer_config",",","text_config",")","``","`"]
docstr: Instantiate a [`Blip2Config`] (or a derived class) from a BLIP-2 vision model, Q-Former and language model
  configurations.
  
  Returns:
      [`Blip2Config`]: An instance of a configuration object
docstr_tok: ["Instantiate","a","[","`","Blip2Config","`","]","(","or","a","derived","class",")","from","a","BLIP-2","vision","model",",","Q-Former","and","language","model","configurations",".","Returns",":","[","`","Blip2Config","`","]",":","An","instance","of","a","configuration","object"]
code: def from_vision_qformer_text_configs(
      cls,
      vision_config: Blip2VisionConfig,
      qformer_config: Blip2QFormerConfig,
      text_config: PretrainedConfig,
      **kwargs,
  ):
      r"""
      Instantiate a [`Blip2Config`] (or a derived class) from a BLIP-2 vision model, Q-Former and language model
      configurations.
  
      Returns:
          [`Blip2Config`]: An instance of a configuration object
      """
  
      return cls(
          vision_config=vision_config.to_dict(),
          qformer_config=qformer_config.to_dict(),
          text_config=text_config.to_dict(),
          **kwargs,
      )
  
file_path: transformers/src/transformers/models/blip_2/configuration_blip_2.py
imports: import os
  from typing import Union
  from ...configuration_utils import PretrainedConfig
  from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
  from ...utils import logging
  from ..auto import CONFIG_MAPPING
label_desc: Use image node_id 2 for calling the Blip2Config obj's underlying member method code with example usage: obj.from_vision_qformer_text_configs(cls, vision_config, qformer_config, text_config) and returns: cls