class_docstr: Builds a faiss index from a data store containing stored keys (i.e., decoder hidden states for k-NN-based MT).
  
  :param config: a KNNConfig object containing the index configuration information
  :param use_gpu: build index on a gpu
  :param device_id: device id if building index on gpu
docstr: Add items to the index in blocks -- used for a large number of items (must call `init_faiss_index` first).
docstr_tok: ["Add","items","to","the","index","in","blocks","--","used","for","a","large","number","of","items","(","must","call","`","init_faiss_index","`","first",")","."]
code: def block_add_items(
      self,
      index,
      keys: np.ndarray,
      block_size: int = C.DEFAULT_DATA_STORE_BLOCK_SIZE,
  ):
      """Add items to the index in blocks -- used for a large number of items (must call `init_faiss_index` first)."""
      item_count, key_dim = keys.shape
      assert key_dim == self.config.dimension
  
      n_blocks = item_count // block_size
      for i in range(n_blocks):
          logger.debug(f"adding block no.{i}")
          start = block_size * i
          end = block_size * (i + 1)
          index.add(
              keys[start:end].astype(np.float32)
          )  # unfortunately, faiss index only supports float32
  
      if block_size * n_blocks < item_count:
          start = block_size * n_blocks
          index.add(keys[start:item_count].astype(np.float32))
  
imports: from dataclasses import dataclass
  import logging
  import numpy
  import os
  import shutil
  from typing import Optional
  from .None import arguments
  from sockeye import config, utils, constants
  from sockeye.log import setup_main_logger
label_desc: Use image node_id 4 for calling the FaissIndexBuilder obj's underlying member method code with example usage: obj.block_add_items(index, keys, block_size) without return types