code: def __getitem__(self, idx):
      text_sample, mode = self.indexed_dataset.get(self.doc_idx[idx])
      assert mode == 0
      img_sample, mode = self.indexed_dataset.get(self.doc_idx[idx] + 1)
      assert mode == 1
      img_pad = img_sample[0].item()
      xs = img_sample[1:].tobytes(order="C")
      xs = xs[: len(xs) - img_pad]
  
      img_sample = np.array(Image.open(io.BytesIO(xs)))
      img_sample = self.visual_transform(img_sample).reshape(-1)
  
      return {
          "text": np.array(text_sample, dtype=np.int64),
          "img": np.array(img_sample, dtype=np.float32),
      }
  
file_path: megatron-lm/megatron/data/multimodal_dataset.py
imports: from PIL import Image, UnidentifiedImageError
  import numpy
  import io
  import torch
  from torchvision.transforms import Compose, ToTensor, Normalize, ToPILImage, RandomResizedCrop, Resize
label_desc: Use image node_id 3 for calling the MultiModalDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: dict