class_docstr: LabeledVideoPaths contains pairs of video path and integer index label.
class_docstr_tok: ["LabeledVideoPaths","contains","pairs","of","video","path","and","integer","index","label","."]
docstr: Factory function that creates a LabeledVideoPaths object by reading a file with the
  following format:
      <path> <integer_label>
      ...
      <path> <integer_label>
  
  Args:
      file_path (str): The path to the file to be read.
docstr_tok: ["Factory","function","that","creates","a","LabeledVideoPaths","object","by","reading","a","file","with","the","following","format",":","<","path",">","<","integer_label",">","...","<","path",">","<","integer_label",">","Args",":","file_path","(","str",")",":","The","path","to","the","file","to","be","read","."]
code: def from_csv(cls, file_path: str) -> LabeledVideoPaths:
      """
      Factory function that creates a LabeledVideoPaths object by reading a file with the
      following format:
          <path> <integer_label>
          ...
          <path> <integer_label>
  
      Args:
          file_path (str): The path to the file to be read.
      """
      assert g_pathmgr.exists(file_path), f"{file_path} not found."
      video_paths_and_label = []
      with g_pathmgr.open(file_path, "r") as f:
          for path_label in f.read().splitlines():
              line_split = path_label.rsplit(None, 1)
  
              # The video path file may not contain labels (e.g. for a test split). We
              # assume this is the case if only 1 path is found and set the label to
              # -1 if so.
              if len(line_split) == 1:
                  file_path = line_split[0]
                  label = -1
              else:
                  file_path, label = line_split
  
              video_paths_and_label.append((file_path, int(label)))
  
      assert (
          len(video_paths_and_label) > 0
      ), f"Failed to load dataset from {file_path}."
      return cls(video_paths_and_label)
  
file_path: pytorchvideo/pytorchvideo/data/labeled_video_paths.py
imports: from __future__ import annotations
  import os
  import pathlib
  from typing import List, Optional, Tuple
  from iopath.common.file_io import g_pathmgr
  from torchvision.datasets.folder import make_dataset
label_desc: Use image node_id 2 for calling the LabeledVideoPaths obj's underlying member method code with example usage: obj.from_csv(cls, file_path) and returns: cls