class_docstr: Model described in (https://arxiv.org/abs/1811.00945).
  
  A model for producing engaging captions about an image. Given an image and
  this model will attempt to predict an appropriate
  next utterance in the dialog, in the context of a given personality.
  
  See the paper linked above for more information.
class_docstr_tok: ["Model","described","in","(","https",":","\/\/arxiv.org\/abs\/1811.00945",")",".","A","model","for","producing","engaging","captions","about","an","image",".","Given","an","image","and","this","model","will","attempt","to","predict","an","appropriate","next","utterance","in","the","dialog",",","in","the","context","of","a","given","personality",".","See","the","paper","linked","above","for","more","information","."]
docstr: Filter out invalid observations.
docstr_tok: ["Filter","out","invalid","observations","."]
code: def filter_valid_obs(self, observations, is_training):
      """
      Filter out invalid observations.
      """
      label_key = "labels" if is_training else "eval_labels"
      valid_obs = []
      valid_indexes = []
      seen_texts = set()
      for i in range(len(observations)):
          if "image" in observations[i]:
              if self.fixed_cands is not None:
                  valid_obs.append(observations[i])
                  valid_indexes.append(i)
              else:
                  text = observations[i][label_key][0]
                  if text not in seen_texts:
                      seen_texts.add(text)
                      valid_obs.append(observations[i])
                      valid_indexes.append(i)
      return valid_obs, valid_indexes
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.agents import Agent
  from parlai.core.dict import DictionaryAgent
  from parlai.utils.misc import round_sigfigs
  from .modules import TransresnetModel
  from parlai.tasks.personality_captions.build import build
  from parlai.utils.io import PathManager
  import parlai.utils.torch
  import os
  import random
  import json
  import numpy
  import torch
  import tqdm
label_desc: Use image node_id 14 for calling the TransresnetAgent obj's underlying member method code with example usage: obj.filter_valid_obs(observations, is_training) and returns: valid_obs,  valid_indexes