def __init__()

in retail/recommendation-system/bqml-scann/tfx_pipeline/item_matcher.py [0:0]


  def __init__(self, index_dir):
    logging.info('Loading ScaNN index...')
    scann_module = tf.saved_model.load(index_dir)
    self.scann_index = scann.scann_ops.searcher_from_module(scann_module)
    tokens_file_path = os.path.join(index_dir, TOKENS_FILE_NAME)
    with tf.io.gfile.GFile(tokens_file_path, 'rb') as handle:
      self.tokens = pickle.load(handle)
    logging.info('ScaNN index is loaded.')