docstr: Overriding decoder_output method to use classifier heads to modify the generator
  logprobs. This modification allows model to incorporate attribute information
  from classifier while selecting the next tokens.
  
  Notice that the skip_director_reranking_for_all_generations is moved to Agent config as all subagents share the same model, including model weights and model configs
  Args:
      latent (torch.Tensor): decoder outputs
      skip_director_reranking_vec (torch.BoolTensor): vectors of whether to skip the modification or not
      encoder_states (Tuple[Any]): encoder states
  
  Returns:
      Modified logprobs.
docstr_tok: ["Overriding","decoder_output","method","to","use","classifier","heads","to","modify","the","generator","logprobs",".","This","modification","allows","model","to","incorporate","attribute","information","from","classifier","while","selecting","the","next","tokens",".","Notice","that","the","skip_director_reranking_for_all_generations","is","moved","to","Agent","config","as","all","subagents","share","the","same","model",",","including","model","weights","and","model","configs","Args",":","latent","(","torch.Tensor",")",":","decoder","outputs","skip_director_reranking_vec","(","torch.BoolTensor",")",":","vectors","of","whether","to","skip","the","modification","or","not","encoder_states","(","Tuple","[","Any","]",")",":","encoder","states","Returns",":","Modified","logprobs","."]
code: def decoder_output(
      self,
      latent: torch.Tensor,
      skip_director_reranking_vec: torch.BoolTensor,
      encoder_states: Optional[Tuple[Any, ...]] = None,
  ):
      """
      Overriding decoder_output method to use classifier heads to modify the generator
      logprobs. This modification allows model to incorporate attribute information
      from classifier while selecting the next tokens.
  
      Notice that the skip_director_reranking_for_all_generations is moved to Agent config as all subagents share the same model, including model weights and model configs
      Args:
          latent (torch.Tensor): decoder outputs
          skip_director_reranking_vec (torch.BoolTensor): vectors of whether to skip the modification or not
          encoder_states (Tuple[Any]): encoder states
  
      Returns:
          Modified logprobs.
      """
      classifier_outputs = F.logsigmoid(
          self.classifier_output(latent, encoder_states=encoder_states)
      )
      log_predictor_scores = F.log_softmax(
          self.generator_output(latent), dim=-1
      )
  
      if self.use_one_plus_gamma_variant:
          scores = (
              log_predictor_scores
              + self.infer_gamma * classifier_outputs
          )
      else:
          scores = (
              2.0
              * (1.0 - self.infer_mixing_weights)
              * log_predictor_scores
              + 2.0 * (self.infer_mixing_weights) * classifier_outputs
          )
      scores[skip_director_reranking_vec, :, :] = log_predictor_scores[
          skip_director_reranking_vec, :, :
      ]
      return F.log_softmax(scores, dim=-1)
  
imports: import torch
  import torch.nn.functional
  import copy
  from typing import Optional, List, Tuple, Any, Dict, Union
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.torch_agent import Batch
  from parlai.core.message import Message
  from parlai.agents.rag.retrievers import Document
  from parlai.agents.fid.fid import SearchQueryFiDAgent, WizIntGoldDocRetrieverFiDAgent
  import parlai.utils.logging
  from projects.seeker.agents.seeker_modules import ComboFidModel
  from projects.seeker.agents.seeker import ComboFidAgent, SeekerAgent
  from projects.fits.agents.director_bb2 import DirectorFidAgent, DirectorFidModelMixin
label_desc: Use image node_id 5 for calling the DirectorComboFidModel obj's underlying member method code with example usage: obj.decoder_output(latent, skip_director_reranking_vec, encoder_states) and returns: F