code: def make_charades_df(csv_path, video_dir, classes_file):
      # load the csv
      logger.info(f"Reading from {csv_path}")
      df = pd.read_csv(csv_path)
  
      # transform the id to a pathname
      df["path"] = df["id"].map(
          lambda x: "{}/{}.mp4".format(video_dir, x)
      )
  
      # parse action labels
      df["action_labels"] = df["actions"].map(
          lambda x: [label.split(" ")[0] for label in x.split(";")]
          if pd.notnull(x)
          else []
      )
  
      # load id to class map
      with open(classes_file, "r") as f:
          class_names = f.readlines()
  
      id2classname = {}
      for c in class_names:
          c_split = c.split(" ")
          assert len(c_split) > 1
          class_id = c_split[0]
          class_name = " ".join(c_split[1:]).strip("\n")
          id2classname[class_id] = class_name
  
      # transform label ids to names
      df["action_labels"] = df["action_labels"].map(
          lambda x: [id2classname[class_id] for class_id in x]
      )
  
      # filter only these videos that actually exist
      df_exists = df[df["path"].map(lambda x: Path(x).exists())]
  
      return df_exists
  
file_path: mmf/mmf/datasets/builders/charades/_utils.py
imports: import logging
  import tempfile
  from pathlib import Path
  import pandas
  import torch
  from torchvision.datasets.video_utils import VideoClips
  from torchvision.io import read_video
label_desc: Use image node_id 1 for calling a global function with example usage: make_charades_df(csv_path, video_dir, classes_file) and returns: df_exists