class_docstr: BART Agent.
  
  Relies on the BART model implemented in fairseq.
  
  If you have a fine-tuned BART model from fairseq, you can specify the
  `--init-fairseq-model` arg, which will convert your fine-tuned model
  to a ParlAI model.
class_docstr_tok: ["BART","Agent",".","Relies","on","the","BART","model","implemented","in","fairseq",".","If","you","have","a","fine-tuned","BART","model","from","fairseq",",","you","can","specify","the","`","--","init-fairseq-model","`","arg",",","which","will","convert","your","fine-tuned","model","to","a","ParlAI","model","."]
docstr: Download and convert BART pre-trained models.
  
  Additionally, convert `init-fairseq-model` if necessary.
  
  :param opt:
      ParlAI-parsed options
  
  :return opt:
      return opt with BART-specific args.
docstr_tok: ["Download","and","convert","BART","pre-trained","models",".","Additionally",",","convert","`","init-fairseq-model","`","if","necessary",".",":","param","opt",":","ParlAI-parsed","options",":","return","opt",":","return","opt","with","BART-specific","args","."]
code: def _initialize_bart(self, opt: Opt) -> Opt:
      """
      Download and convert BART pre-trained models.
  
      Additionally, convert `init-fairseq-model` if necessary.
  
      :param opt:
          ParlAI-parsed options
  
      :return opt:
          return opt with BART-specific args.
      """
      init_model, _ = self._get_init_model(opt, None)
      if not opt.get("converting") and (
          init_model is None or not PathManager.exists(init_model)
      ):
          download(opt["datapath"])
          opt["init_model"] = os.path.join(
              opt["datapath"], "models/bart/bart_large/model"
          )
      if opt.get("init_fairseq_model"):
          opt = self._convert_model(opt)
  
      compare_init_model_opts(opt, opt)
      return opt
  
imports: import os
  import torch
  from typing import Optional, Dict, Any
  from parlai.agents.bart.convert_fairseq_to_parlai import ConversionScript
  from parlai.agents.bart.modules import BartModel
  from parlai.agents.transformer.transformer import TransformerGeneratorAgent
  from parlai.core.agents import compare_init_model_opts
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.torch_agent import History
  from parlai.utils.typing import TShared
  from parlai.utils.io import PathManager
  from parlai.zoo.bart.build import download, CONVERSION_ARGS, BART_ARGS
label_desc: Use image node_id 3 for calling the BartAgent obj's underlying member method code with example usage: obj._initialize_bart(opt) and returns: opt