code: def __init__(self, opt, shared=None):
      super().__init__(opt, shared)
      self._vectorize_text = lru_cache(int(2**20))(
          self._vectorize_text
      )
  
      # knowledge truncate defaults to the same as --truncate
      self.knowledge_truncate = opt.get("knowledge_truncate")
      if not self.knowledge_truncate:
          self.knowledge_truncate = opt["truncate"]
      self.max_knowledge = opt.get("max_knowledge")
      self.knowledge_alpha = opt["knowledge_alpha"]
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from itertools import chain
  from functools import lru_cache
  import torch
  import numpy
  from parlai.utils.torch import padded_tensor
  from parlai.utils.misc import round_sigfigs
  from parlai.agents.transformer.transformer import TransformerGeneratorAgent
  from .modules import EndToEndModel
  from parlai.tasks.wizard_of_wikipedia.agents import TOKEN_KNOWLEDGE
label_desc: Use image node_id 1 to create a new EndToEndAgent object from inherited base classes: _GenericWizardAgent with example: obj = EndToEndAgent(opt, shared)