class_docstr: Abstract TorchRankerAgent class; only meant to be extended.
  
  TorchRankerAgents aim to provide convenient functionality for building ranking
  models. This includes:
  
  - Training/evaluating on candidates from a variety of sources.
  - Computing hits@1, hits@5, mean reciprical rank (MRR), and other metrics.
  - Caching representations for fast runtime when deploying models to production.
class_docstr_tok: ["Abstract","TorchRankerAgent","class",";","only","meant","to","be","extended",".","TorchRankerAgents","aim","to","provide","convenient","functionality","for","building","ranking","models",".","This","includes",":","-","Training\/evaluating","on","candidates","from","a","variety","of","sources",".","-","Computing","hits","@","1",",","hits","@","5",",","mean","reciprical","rank","(","MRR",")",",","and","other","metrics",".","-","Caching","representations","for","fast","runtime","when","deploying","models","to","production","."]
docstr: Convert a batch of candidates from text to vectors.
  
  :param cands_batch:
      a [batchsize] list of candidates (strings)
  :returns:
      a [num_cands] list of candidate vectors
  
  By default, candidates are simply vectorized (tokens replaced by token ids).
  A child class may choose to overwrite this method to perform vectorization as
  well as encoding if so desired.
docstr_tok: ["Convert","a","batch","of","candidates","from","text","to","vectors",".",":","param","cands_batch",":","a","[","batchsize","]","list","of","candidates","(","strings",")",":","returns",":","a","[","num_cands","]","list","of","candidate","vectors","By","default",",","candidates","are","simply","vectorized","(","tokens","replaced","by","token","ids",")",".","A","child","class","may","choose","to","overwrite","this","method","to","perform","vectorization","as","well","as","encoding","if","so","desired","."]
code: def vectorize_fixed_candidates(
      self, cands_batch, add_start=False, add_end=False
  ):
      """
      Convert a batch of candidates from text to vectors.
  
      :param cands_batch:
          a [batchsize] list of candidates (strings)
      :returns:
          a [num_cands] list of candidate vectors
  
      By default, candidates are simply vectorized (tokens replaced by token ids).
      A child class may choose to overwrite this method to perform vectorization as
      well as encoding if so desired.
      """
      return [
          self._vectorize_text(
              cand,
              truncate=self.label_truncate,
              truncate_left=False,
              add_start=add_start,
              add_end=add_end,
          )
          for cand in cands_batch
      ]
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from typing import Dict, Any
  from abc import abstractmethod
  from itertools import islice
  import os
  from tqdm import tqdm
  import random
  import torch
  from parlai.core.opt import Opt
  from parlai.utils.distributed import is_distributed
  from parlai.core.torch_agent import TorchAgent, Output
  from parlai.utils.misc import warn_once
  from parlai.utils.io import PathManager
  from parlai.utils.torch import padded_3d, total_parameters, trainable_parameters, PipelineHelper
  from parlai.utils.fp16 import FP16SafeCrossEntropy
  from parlai.core.metrics import AverageMetric
  import parlai.utils.logging
label_desc: Use image node_id 26 for calling the TorchRankerAgent obj's underlying member method code with example usage: obj.vectorize_fixed_candidates(cands_batch, add_start, add_end) and returns: unknown