class_docstr: [`SamConfig`] is the configuration class to store the configuration of a [`SamModel`]. It is used to instantiate a
  SAM model according to the specified arguments, defining the vision model, prompt-encoder model and mask decoder
  configs. Instantiating a configuration with the defaults will yield a similar configuration to that of the
  SAM-ViT-H [facebook/sam-vit-huge](https://huggingface.co/facebook/sam-vit-huge) 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 (Union[`dict`, `SamVisionConfig`], *optional*):
          Dictionary of configuration options used to initialize [`SamVisionConfig`].
      prompt_encoder_config (Union[`dict`, `SamPromptEncoderConfig`], *optional*):
          Dictionary of configuration options used to initialize [`SamPromptEncoderConfig`].
      mask_decoder_config (Union[`dict`, `SamMaskDecoderConfig`], *optional*):
          Dictionary of configuration options used to initialize [`SamMaskDecoderConfig`].
  
      kwargs (*optional*):
          Dictionary of keyword arguments.
  
  Example:
  
  ```python
  >>> from transformers import (
  ...     SamVisionConfig,
  ...     SamPromptEncoderConfig,
  ...     SamMaskDecoderConfig,
  ...     SamModel,
  ... )
  
  >>> # Initializing a SamConfig with `"facebook/sam-vit-huge"` style configuration
  >>> configuration = SamConfig()
  
  >>> # Initializing a SamModel (with random weights) from the `"facebook/sam-vit-huge"` style configuration
  >>> model = SamModel(configuration)
  
  >>> # Accessing the model configuration
  >>> configuration = model.config
  
  >>> # We can also initialize a SamConfig from a SamVisionConfig, SamPromptEncoderConfig, and SamMaskDecoderConfig
  
  >>> # Initializing SAM vision, SAM Q-Former and language model configurations
  >>> vision_config = SamVisionConfig()
  >>> prompt_encoder_config = SamPromptEncoderConfig()
  >>> mask_decoder_config = SamMaskDecoderConfig()
  
  >>> config = SamConfig(vision_config, prompt_encoder_config, mask_decoder_config)
  ```
class_docstr_tok: ["[","`","SamConfig","`","]","is","the","configuration","class","to","store","the","configuration","of","a","[","`","SamModel","`","]",".","It","is","used","to","instantiate","a","SAM","model","according","to","the","specified","arguments",",","defining","the","vision","model",",","prompt-encoder","model","and","mask","decoder","configs",".","Instantiating","a","configuration","with","the","defaults","will","yield","a","similar","configuration","to","that","of","the","SAM-ViT-H","[","facebook\/sam-vit-huge","]","(","https",":","\/\/huggingface.co\/facebook\/sam-vit-huge",")","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","(","Union","[","`","dict","`",",","`","SamVisionConfig","`","]",",","*","optional","*",")",":","Dictionary","of","configuration","options","used","to","initialize","[","`","SamVisionConfig","`","]",".","prompt_encoder_config","(","Union","[","`","dict","`",",","`","SamPromptEncoderConfig","`","]",",","*","optional","*",")",":","Dictionary","of","configuration","options","used","to","initialize","[","`","SamPromptEncoderConfig","`","]",".","mask_decoder_config","(","Union","[","`","dict","`",",","`","SamMaskDecoderConfig","`","]",",","*","optional","*",")",":","Dictionary","of","configuration","options","used","to","initialize","[","`","SamMaskDecoderConfig","`","]",".","kwargs","(","*","optional","*",")",":","Dictionary","of","keyword","arguments",".","Example",":","``","`","python",">",">",">","from","transformers","import","(","...","SamVisionConfig",",","...","SamPromptEncoderConfig",",","...","SamMaskDecoderConfig",",","...","SamModel",",","...",")",">",">",">","#","Initializing","a","SamConfig","with","`","``","facebook\/sam-vit-huge","''","`","style","configuration",">",">",">","configuration","=","SamConfig","(",")",">",">",">","#","Initializing","a","SamModel","(","with","random","weights",")","from","the","`","``","facebook\/sam-vit-huge","''","`","style","configuration",">",">",">","model","=","SamModel","(","configuration",")",">",">",">","#","Accessing","the","model","configuration",">",">",">","configuration","=","model.config",">",">",">","#","We","can","also","initialize","a","SamConfig","from","a","SamVisionConfig",",","SamPromptEncoderConfig",",","and","SamMaskDecoderConfig",">",">",">","#","Initializing","SAM","vision",",","SAM","Q-Former","and","language","model","configurations",">",">",">","vision_config","=","SamVisionConfig","(",")",">",">",">","prompt_encoder_config","=","SamPromptEncoderConfig","(",")",">",">",">","mask_decoder_config","=","SamMaskDecoderConfig","(",")",">",">",">","config","=","SamConfig","(","vision_config",",","prompt_encoder_config",",","mask_decoder_config",")","``","`"]
code: def __init__(
      self,
      vision_config=None,
      prompt_encoder_config=None,
      mask_decoder_config=None,
      initializer_range=0.02,
      **kwargs,
  ):
      super().__init__(**kwargs)
      vision_config = vision_config if vision_config is not None else {}
      prompt_encoder_config = (
          prompt_encoder_config
          if prompt_encoder_config is not None
          else {}
      )
      mask_decoder_config = (
          mask_decoder_config if mask_decoder_config is not None else {}
      )
  
      if isinstance(vision_config, SamVisionConfig):
          vision_config = vision_config.to_dict()
      if isinstance(prompt_encoder_config, SamPromptEncoderConfig):
          prompt_encoder_config = prompt_encoder_config.to_dict()
      if isinstance(mask_decoder_config, SamMaskDecoderConfig):
          mask_decoder_config = mask_decoder_config.to_dict()
  
      self.vision_config = SamVisionConfig(**vision_config)
      self.prompt_encoder_config = SamPromptEncoderConfig(
          **prompt_encoder_config
      )
      self.mask_decoder_config = SamMaskDecoderConfig(
          **mask_decoder_config
      )
      self.initializer_range = initializer_range
  
file_path: transformers/src/transformers/models/sam/configuration_sam.py
imports: from ...configuration_utils import PretrainedConfig
  from ...utils import logging
label_desc: Use image node_id 1 to create a new SamConfig object from inherited base classes: PretrainedConfig with example: obj = SamConfig(vision_config, prompt_encoder_config, mask_decoder_config, initializer_range)