class_docstr: BLIP captioning model.
  
  Supported model types:
      - base_coco: fine-tuned BLIP base model on COCO caption dataset (Karparthy split).
      - large_coco: fine-tuned BLIP large model on COCO caption dataset (Karparthy split).
  
  Usage:
      >>> from lavis.models import load_model
      >>> model = load_model("blip_caption", "base_coco")
      >>> model = load_model("blip_caption", "large_coco")
class_docstr_tok: ["BLIP","captioning","model",".","Supported","model","types",":","-","base_coco",":","fine-tuned","BLIP","base","model","on","COCO","caption","dataset","(","Karparthy","split",")",".","-","large_coco",":","fine-tuned","BLIP","large","model","on","COCO","caption","dataset","(","Karparthy","split",")",".","Usage",":",">",">",">","from","lavis.models","import","load_model",">",">",">","model","=","load_model","(","``","blip_caption","''",",","``","base_coco","''",")",">",">",">","model","=","load_model","(","``","blip_caption","''",",","``","large_coco","''",")"]
code: def forward_decoder(self, samples, image_embeds):
      # prepare inputs for forwarding decoder
      raw_text = samples["text_input"]
      text = self.tokenizer(
          raw_text,
          padding="longest",
          truncation=True,
          max_length=self.max_txt_len,
          return_tensors="pt",
      ).to(self.device)
      text.input_ids[:, 0] = self.tokenizer.bos_token_id
  
      # prepare targets for forwarding decoder
      decoder_targets = text.input_ids.masked_fill(
          text.input_ids == self.tokenizer.pad_token_id, -100
      )
      decoder_targets[:, : self.prompt_length] = -100
  
      # forward decoder
      image_atts = torch.ones(
          image_embeds.size()[:-1], dtype=torch.long
      ).to(self.device)
      decoder_output = self.text_decoder(
          input_ids=text.input_ids,
          attention_mask=text.attention_mask,
          encoder_hidden_states=image_embeds,
          encoder_attention_mask=image_atts,
          labels=decoder_targets,
          return_dict=True,
      )
  
      return decoder_output, decoder_targets
  
file_path: lavis/lavis/models/blip_models/blip_caption.py
imports: import torch
  from lavis.common.registry import registry
  from lavis.models.blip_models.blip import BlipBase
  from lavis.models.blip_models.blip_outputs import BlipOutput, BlipIntermediateOutput
  from lavis.models.med import XBertLMHeadDecoder
  from lavis.models.vit import VisionTransformerEncoder
label_desc: Use image node_id 3 for calling the BlipCaption obj's underlying member method code with example usage: obj.forward_decoder(samples, image_embeds) and returns: decoder_output,  decoder_targets