class_docstr: Note that ScaNNSearcher cannot currently be used within the model. In future versions, it might however be included.
docstr: Build scann searcher.
docstr_tok: ["Build","scann","searcher","."]
code: def __init__(
      self,
      db,
      num_neighbors,
      dimensions_per_block=2,
      num_leaves=1000,
      num_leaves_to_search=100,
      training_sample_size=100000,
  ):
      """Build scann searcher."""
  
      from scann.scann_ops.py.scann_ops_pybind import builder as Builder
  
      builder = Builder(
          db=db,
          num_neighbors=num_neighbors,
          distance_measure="dot_product",
      )
      builder = builder.tree(
          num_leaves=num_leaves,
          num_leaves_to_search=num_leaves_to_search,
          training_sample_size=training_sample_size,
      )
      builder = builder.score_ah(
          dimensions_per_block=dimensions_per_block
      )
  
      self.searcher = builder.build()
  
file_path: transformers/src/transformers/models/realm/retrieval_realm.py
imports: import os
  from typing import Optional, Union
  import numpy
  from huggingface_hub import hf_hub_download
  from ...None import AutoTokenizer
  from ...utils import logging
label_desc: Use image node_id 1 to create a new ScaNNSearcher object  with example: obj = ScaNNSearcher(db, num_neighbors, dimensions_per_block, num_leaves, num_leaves_to_search, training_sample_size)