in retail/recommendation-system/bqml-scann/index_server/matching.py [0:0]
def __init__(self, index_dir):
print('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)
print('ScaNN index is loadded.')