class_docstr: An index which can be deserialized from the files built using https://github.com/facebookresearch/DPR. We use
  default faiss index parameters as specified in that repository.
  
  Args:
      vector_size (`int`):
          The dimension of indexed vectors.
      index_path (`str`):
          A path to a *directory* containing index files compatible with [`~models.rag.retrieval_rag.LegacyIndex`]
class_docstr_tok: ["An","index","which","can","be","deserialized","from","the","files","built","using","https",":","\/\/github.com\/facebookresearch\/DPR",".","We","use","default","faiss","index","parameters","as","specified","in","that","repository",".","Args",":","vector_size","(","`","int","`",")",":","The","dimension","of","indexed","vectors",".","index_path","(","`","str","`",")",":","A","path","to","a","*","directory","*","containing","index","files","compatible","with","[","`","~models.rag.retrieval_rag.LegacyIndex","`","]"]
code: def _deserialize_index(self):
      logger.info(f"Loading index from {self.index_path}")
      resolved_index_path = self._resolve_path(
          self.index_path, self.INDEX_FILENAME + ".index.dpr"
      )
      self.index = faiss.read_index(resolved_index_path)
      resolved_meta_path = self._resolve_path(
          self.index_path, self.INDEX_FILENAME + ".index_meta.dpr"
      )
      if not strtobool(os.environ.get("TRUST_REMOTE_CODE", "False")):
          raise ValueError(
              "This part uses `pickle.load` which is insecure and will execute arbitrary code that is potentially "
              "malicious. It's recommended to never unpickle data that could have come from an untrusted source, or "
              "that could have been tampered with. If you already verified the pickle data and decided to use it, "
              "you can set the environment variable `TRUST_REMOTE_CODE` to `True` to allow it."
          )
      with open(resolved_meta_path, "rb") as metadata_file:
          self.index_id_to_db_id = pickle.load(metadata_file)
      assert (
          len(self.index_id_to_db_id) == self.index.ntotal
      ), "Deserialized index_id_to_db_id should match faiss index size"
  
imports: import os
  import pickle
  import time
  from typing import Iterable, List, Optional, Tuple
  import numpy
  from ...tokenization_utils import PreTrainedTokenizer
  from ...tokenization_utils_base import BatchEncoding
  from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends, strtobool
  from .configuration_rag import RagConfig
  from .tokenization_rag import RagTokenizer
label_desc: Use image node_id 4 for calling the LegacyIndex obj's underlying member method code with example usage: obj._deserialize_index() without return types