code: def main():
      from labml_nn.transformers.knn.build_index import load_experiment
  
      # Load the experiment. Replace the run uuid with you run uuid from
      # [training the model](train_model.html).
      conf = load_experiment("4984b85c20bf11eb877a69c1a03717cd")
      # Set model to evaluation mode
      conf.model.eval()
  
      # Load index
      index, keys_store, vals_store = load_index(conf)
      # List of weights given to $k$-NN prediction. We will evaluate the validation loss for
      # each of the weights
      knn_weights = [i / 20 for i in range(10)]
      # Evaluate validation loss
      losses, n_samples = validation_loss(
          knn_weights, None, conf, index, keys_store, vals_store
      )
      # Output the losses for each of `knn_weights`.
      inspect(
          {
              c: np.sum(losses[i]) / np.sum(n_samples)
              for i, c in enumerate(knn_weights)
          }
      )
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/transformers/knn/eval_knn.py
imports: from typing import Optional, List
  import faiss
  import numpy
  import torch
  from labml import monit, lab
  from labml.logger import inspect
  from labml_nn.transformers.knn.train_model import Configs
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types