class_docstr: Script to convert a transformer-based fairseq model to ParlAI Model.
class_docstr_tok: ["Script","to","convert","a","transformer-based","fairseq","model","to","ParlAI","Model","."]
docstr: Run Conversion.
  
  Print sample agent act after conversion.
docstr_tok: ["Run","Conversion",".","Print","sample","agent","act","after","conversion","."]
code: def run(self):
      """
      Run Conversion.
  
      Print sample agent act after conversion.
      """
      # 1. load state
      self.state = self.load_fairseq_checkpoint()
      # 2. get parlai options
      opt = self.get_parlai_opt()
      # 3. create agent and convert model weights
      self.agent = create_agent(opt)
      converted = self.convert_model_weight(opt)
      self.agent.model.load_state_dict(converted, True)
      self.agent.opt.pop("converting", None)
      self.agent.save(self.opt["output"])
      # kill the optimizer
      Vacuum.main(model_file=self.opt["output"], no_backup=True)
      # 4. enjoy!
      self.print_agent_act()
  
imports: from collections import OrderedDict
  import os
  import torch
  from torch.serialization import default_restore_location
  from typing import Any, Dict, List
  from parlai.core.agents import create_agent
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.script import ParlaiScript
  from parlai.utils.io import PathManager
  from parlai.scripts.vacuum import Vacuum
label_desc: Use image node_id 2 for calling the ConversionScript obj's underlying member method code with example usage: obj.run() without return types