class_docstr: Memory decoder.
  
  Given a line of context input, generate a memory to write.
class_docstr_tok: ["Memory","decoder",".","Given","a","line","of","context","input",",","generate","a","memory","to","write","."]
docstr: Extract memory lines from batch generated memories.
  
  Prefixes accordingly, and combines on one line if necessary.
  
  :param raw_memories:
      raw memory generations. sometimes we need skip the memories because
      nothing was generated
  
  :return memories:
      return prefixed and filtered memories
docstr_tok: ["Extract","memory","lines","from","batch","generated","memories",".","Prefixes","accordingly",",","and","combines","on","one","line","if","necessary",".",":","param","raw_memories",":","raw","memory","generations",".","sometimes","we","need","skip","the","memories","because","nothing","was","generated",":","return","memories",":","return","prefixed","and","filtered","memories"]
code: def _extract_from_raw_memories(
      self, raw_memories: List[str]
  ) -> List[str]:
      """
      Extract memory lines from batch generated memories.
  
      Prefixes accordingly, and combines on one line if necessary.
  
      :param raw_memories:
          raw memory generations. sometimes we need skip the memories because
          nothing was generated
  
      :return memories:
          return prefixed and filtered memories
      """
      partner_prefix = "partner's persona:"
      self_prefix = "your persona:"
      num_ctxt = len(raw_memories)
      memories = []
      partner_memories = []
      self_memories = []
      for idx in range(num_ctxt):
          if raw_memories[idx] == NOPERSONA:
              continue
          if idx % 2 == 0:
              partner_memories.append(raw_memories[idx])
              prefix = partner_prefix
          else:
              self_memories.append(raw_memories[idx])
              prefix = self_prefix
          if not self.one_line_memories:
              memories.append(f"{prefix} {raw_memories[idx]}")
      if self.one_line_memories:
          if partner_memories:
              memories.append(
                  f"{partner_prefix} {' '.join(partner_memories)}"
              )
          if self_memories:
              memories.append(
                  f"{self_prefix} {' '.join(self_memories)}"
              )
  
      return memories
  
imports: from enum import Enum, auto
  import os
  import string
  import time
  import torch
  import torch.nn
  from typing import List, Tuple, Dict, Optional, Any
  from parlai.agents.rag.retrievers import clean_vec
  from parlai.core.agents import create_agent_from_model_file, create_agent_from_shared
  from parlai.core.build_data import modelzoo_path
  from parlai.core.dict import DictionaryAgent
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.torch_agent import TorchAgent
  from parlai.tasks.msc.agents import NOPERSONA
  import parlai.utils.logging
label_desc: Use image node_id 3 for calling the MemoryDecoder obj's underlying member method code with example usage: obj._extract_from_raw_memories(raw_memories) and returns: memories