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: Set interactive mode defaults.
  
  In interactive mode, we set `ignore_bad_candidates` to True.
  Additionally, we change the `eval_candidates` to the option
  specified in `--interactive-candidates`, which defaults to False.
  
  Interactive mode possibly changes the fixed candidates path if it
  does not exist, automatically creating a candidates file from the
  specified task.
docstr_tok: ["Set","interactive","mode","defaults",".","In","interactive","mode",",","we","set","`","ignore_bad_candidates","`","to","True",".","Additionally",",","we","change","the","`","eval_candidates","`","to","the","option","specified","in","`","--","interactive-candidates","`",",","which","defaults","to","False",".","Interactive","mode","possibly","changes","the","fixed","candidates","path","if","it","does","not","exist",",","automatically","creating","a","candidates","file","from","the","specified","task","."]
code: def set_interactive_mode(self, mode, shared=False):
      """
      Set interactive mode defaults.
  
      In interactive mode, we set `ignore_bad_candidates` to True.
      Additionally, we change the `eval_candidates` to the option
      specified in `--interactive-candidates`, which defaults to False.
  
      Interactive mode possibly changes the fixed candidates path if it
      does not exist, automatically creating a candidates file from the
      specified task.
      """
      super().set_interactive_mode(mode, shared)
      if not mode:
          # Not in interactive mode, nothing to do
          return
  
      # Override eval_candidates to interactive_candidates
      self.eval_candidates = self.opt.get(
          "interactive_candidates", "fixed"
      )
      if self.eval_candidates == "fixed":
          # Set fixed candidates path if it does not exist
          if (
              self.fixed_candidates_path is None
              or self.fixed_candidates_path == ""
          ):
              # Attempt to get a standard candidate set for the given task
              path = self.get_task_candidates_path()
              if path:
                  if not shared:
                      logging.info(
                          f"Setting fixed_candidates path to: {path}"
                      )
                  self.fixed_candidates_path = path
  
      # Ignore bad candidates in interactive mode
      self.ignore_bad_candidates = True
  
      return
  
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 5 for calling the TorchRankerAgent obj's underlying member method code with example usage: obj.set_interactive_mode(mode, shared) without return types