class_docstr: Dataset for supervised fine-tuning.
code: def __init__(self, data_path: str, tokenizer, multimodal_cfg: dict):
      if data_path.endswith(".json"):
          super(NevaDataset, self).__init__(
              data_path, tokenizer, multimodal_cfg
          )
  
      elif data_path.endswith(".jsonl"):
          super(NevaDataset, self).__init__(
              None, tokenizer, multimodal_cfg
          )
          logging.warning("Loading image inputs from SteerLM Dataset")
          image_folder = multimodal_cfg["image_folder"]
          for line in open(data_path, "r"):
              record = json.loads(line)
  
              # This currently supports only a single image
              # search for <img src="/absolute/path/to/image" in the conversation
              #   add it as record['image'], remove src tag from the <img> tag
  
              record["image"] = []
              for turn in record["conversations"]:
                  matches = re.finditer(
                      '<img src="([^"]+)"', turn["value"]
                  )
                  for match in matches:
                      image_name = match.group(1).split("/")[-1]
                      image_path = os.path.join(
                          image_folder, image_name
                      )
                      if not os.path.isfile(image_path):
                          logging.warning(
                              f"Image not found: {image_path}"
                          )
                          continue
                      record["image"].append(image_name)  # url
                  turn["value"] = re.sub(
                      '<img src="([^"]+)">',
                      DEFAULT_IMAGE_TOKEN,
                      turn["value"],
                  )
  
              self.list_data_dict.append(record)
  
      else:
          raise ValueError(
              f"Formatting of {data_path} is not supported in Neva."
          )
  
imports: import copy
  import json
  import logging
  import os
  import re
  import tarfile
  from dataclasses import dataclass
  from typing import Any, Dict, List, Sequence, Union
  import torch
  import torch.nn.functional
  import transformers
  from einops import rearrange
  from omegaconf import DictConfig
  from PIL import Image
  from torch.utils.data import Dataset, default_collate
  from transformers import CLIPImageProcessor
  import nemo.collections.multimodal.data.neva.conversation
  from nemo.collections.nlp.modules.common.megatron.utils import get_ltor_masks_and_position_ids
label_desc: Use image node_id 1 to create a new NevaDataset object from inherited base classes: LazySupervisedDataset with example: obj = NevaDataset(data_path, tokenizer, multimodal_cfg)