docstr: Load db file based on the format and return back a randomly sampled
  list of 'num_samples' objects from DB.
  
  Args:
      db_file (str): Path to DB file
      num_samples (int): Number of samples that will be generated
  
  Raises:
      ValueError: Raised if DB file is not among ".json|.jsonl|.npy"
  
  Returns:
      Tupe(List[Object], str): A tuple containing both the selected data and
      actual file path
docstr_tok: ["Load","db","file","based","on","the","format","and","return","back","a","randomly","sampled","list","of","'num_samples","'","objects","from","DB",".","Args",":","db_file","(","str",")",":","Path","to","DB","file","num_samples","(","int",")",":","Number","of","samples","that","will","be","generated","Raises",":","ValueError",":","Raised","if","DB","file","is","not","among","``",".json|.jsonl|.npy","''","Returns",":","Tupe","(","List","[","Object","]",",","str",")",":","A","tuple","containing","both","the","selected","data","and","actual","file","path"]
code: def _load_db_file(self, db_file: str, num_samples: int):
      """Load db file based on the format and return back a randomly sampled
      list of 'num_samples' objects from DB.
  
      Args:
          db_file (str): Path to DB file
          num_samples (int): Number of samples that will be generated
  
      Raises:
          ValueError: Raised if DB file is not among ".json|.jsonl|.npy"
  
      Returns:
          Tupe(List[Object], str): A tuple containing both the selected data and
          actual file path
      """
      file_type = None
      if db_file.endswith(".npy"):
          file_type = "npy"
          data = np.load(db_file, allow_pickle=True)
          selected_data = np.random.choice(
              data[1:], size=num_samples, replace=False
          )
      elif db_file.endswith(".jsonl"):
          file_type = "jsonl"
          with open(db_file) as f:
              data = []
              for item in f.readlines():
                  data.append(json.loads(item.strip("\n")))
              selected_data = np.random.choice(
                  data, size=num_samples, replace=False
              )
  
      # Expecting JSON to be in COCOJSONFormat or contain "data" attribute
      elif db_file.endswith(".json"):
          file_type = "json"
          with open(db_file) as f:
              data = json.load(f)
              selected_data = np.random.choice(
                  data, size=num_samples, replace=False
              )
      else:
          raise ValueError(
              "Unexpected DB file type. Valid options {json|jsonl|npy}"
          )
  
      return selected_data, file_type
  
file_path: mmf/tools/scripts/tests/generate_test_data.py
imports: import argparse
  import json
  import os
  import shutil
  import numpy
  from tools.scripts.features.lmdb_conversion import LMDBConversion
label_desc: Use image node_id 5 for calling the TestDataBuilder obj's underlying member method code with example usage: obj._load_db_file(db_file, num_samples) and returns: selected_data,  file_type