code: def add(self, text_dataset):
      # Encode chunks.
      self.encode(text_dataset)
  
      # Add codes to index.
      self.add_codes()
  
      # Wait for (single-process) adding to complete.
      torch.distributed.barrier()
  
      # Remove codes.
      self.remove_codes()
  
file_path: megatron-lm/tools/retro/index/indexes/faiss_par_add.py
imports: import numpy
  import os
  import psutil
  import shutil
  import torch
  from tqdm import tqdm
  from megatron import get_retro_args, print_rank_0
  from tools.bert_embedding import BertEmbedder
  from tools.bert_embedding.utils import get_missing_blocks_by_rank
  from tools.retro.external_libs import faiss, h5py
  from tools.retro.index.utils import get_added_codes_dir, get_added_code_paths
  from .faiss_base import FaissBaseIndex
label_desc: Use image node_id 5 for calling the FaissParallelAddIndex obj's underlying member method code with example usage: obj.add(text_dataset) without return types