class_docstr: BLIP Image-Text Matching (ITM) model.
  
  Supported model types:
      - base: fine-tuned BLIP retrieval weights on COCO dataset (Karpathy split).
      - large: fine-tuned BLIP retrieval weights on COCO dataset (Karpathy split).
  
  Usage:
      >>> from lavis.models import load_model
      >>> model = load_model("blip_image_text_matching", "base")
      >>> model = load_model("blip_image_text_matching", "large")
class_docstr_tok: ["BLIP","Image-Text","Matching","(","ITM",")","model",".","Supported","model","types",":","-","base",":","fine-tuned","BLIP","retrieval","weights","on","COCO","dataset","(","Karpathy","split",")",".","-","large",":","fine-tuned","BLIP","retrieval","weights","on","COCO","dataset","(","Karpathy","split",")",".","Usage",":",">",">",">","from","lavis.models","import","load_model",">",">",">","model","=","load_model","(","``","blip_image_text_matching","''",",","``","base","''",")",">",">",">","model","=","load_model","(","``","blip_image_text_matching","''",",","``","large","''",")"]
code: def from_config(cls, cfg=None):
      image_encoder = VisionTransformerEncoder.from_config(cfg)
      text_encoder = XBertEncoder.from_config(cfg)
  
      embed_dim = cfg.get("embed_dim", 256)
      max_txt_len = cfg.get("max_txt_len", 35)
  
      model = cls(
          image_encoder=image_encoder,
          text_encoder=text_encoder,
          embed_dim=embed_dim,
          max_txt_len=max_txt_len,
      )
  
      model.load_checkpoint_from_config(cfg)
  
      return model
  
file_path: lavis/lavis/models/blip_models/blip_image_text_matching.py
imports: import torch
  import torch.nn.functional
  from lavis.common.registry import registry
  from lavis.models.blip_models.blip import BlipBase
  from torch import nn
  from lavis.models.med import XBertEncoder
  from lavis.models.vit import VisionTransformerEncoder
label_desc: Use image node_id 4 for calling the BlipITM obj's underlying member method code with example usage: obj.from_config(cls, cfg) and returns: model