class_docstr: Dense index using Faiss. It is used to index vectors.
  Faiss is a library for efficient similarity search and clustering of dense vectors.
  It contains algorithms that search in sets of vectors of any size, up to ones that possibly do not fit in RAM.
  You can find more information about Faiss here:
  - For index types and the string factory: https://github.com/facebookresearch/faiss/wiki/The-index-factory
  - For GPU settings: https://github.com/facebookresearch/faiss/wiki/Faiss-on-the-GPU
class_docstr_tok: ["Dense","index","using","Faiss",".","It","is","used","to","index","vectors",".","Faiss","is","a","library","for","efficient","similarity","search","and","clustering","of","dense","vectors",".","It","contains","algorithms","that","search","in","sets","of","vectors","of","any","size",",","up","to","ones","that","possibly","do","not","fit","in","RAM",".","You","can","find","more","information","about","Faiss","here",":","-","For","index","types","and","the","string","factory",":","https",":","\/\/github.com\/facebookresearch\/faiss\/wiki\/The-index-factory","-","For","GPU","settings",":","https",":","\/\/github.com\/facebookresearch\/faiss\/wiki\/Faiss-on-the-GPU"]
docstr: Create a Dense index using Faiss. You can specify `device` if you want to run it on GPU (`device` must be the GPU index).
  You can find more information about Faiss here:
  - For `string factory`: https://github.com/facebookresearch/faiss/wiki/The-index-factory
docstr_tok: ["Create","a","Dense","index","using","Faiss",".","You","can","specify","`","device","`","if","you","want","to","run","it","on","GPU","(","`","device","`","must","be","the","GPU","index",")",".","You","can","find","more","information","about","Faiss","here",":","-","For","`","string","factory","`",":","https",":","\/\/github.com\/facebookresearch\/faiss\/wiki\/The-index-factory"]
code: def __init__(
      self,
      device: Optional[Union[int, List[int]]] = None,
      string_factory: Optional[str] = None,
      metric_type: Optional[int] = None,
      custom_index: Optional["faiss.Index"] = None,
  ):
      """
      Create a Dense index using Faiss. You can specify `device` if you want to run it on GPU (`device` must be the GPU index).
      You can find more information about Faiss here:
      - For `string factory`: https://github.com/facebookresearch/faiss/wiki/The-index-factory
      """
      if string_factory is not None and custom_index is not None:
          raise ValueError(
              "Please specify either `string_factory` or `custom_index` but not both."
          )
      if device is not None and custom_index is not None:
          raise ValueError(
              "Cannot pass both 'custom_index' and 'device'. "
              "Pass 'custom_index' already transferred to the target device instead."
          )
      self.device = device
      self.string_factory = string_factory
      self.metric_type = metric_type
      self.faiss_index = custom_index
      if not _has_faiss:
          raise ImportError(
              "You must install Faiss to use FaissIndex. To do so you can run `conda install -c pytorch faiss-cpu` or `conda install -c pytorch faiss-gpu`. "
              "A community supported package is also available on pypi: `pip install faiss-cpu` or `pip install faiss-gpu`. "
              "Note that pip may not have the latest version of FAISS, and thus, some of the latest features and bug fixes may not be available."
          )
  
imports: import importlib.util
  import os
  import tempfile
  from pathlib import PurePath
  from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Union
  import fsspec
  import numpy
  from .utils import logging
  from .utils import tqdm
label_desc: Use image node_id 1 to create a new FaissIndex object from inherited base classes: BaseIndex with example: obj = FaissIndex(device, string_factory, metric_type, custom_index)