code: def test_bart(model_name):
      # test from pretrained
      assert len(list_pretrained_bart()) > 0
      with tempfile.TemporaryDirectory() as root:
          cfg, tokenizer, params_path, _ = get_pretrained_bart(
              model_name, load_backbone=True, root=root
          )
          assert cfg.MODEL.vocab_size == len(tokenizer.vocab)
          # test standard bart encoder and decoder
          bart_model = BartModel.from_cfg(cfg)
          bart_model.load_parameters(params_path)
          # test bart encoder and decoder with pooler
          bart_model_with_pooler = BartModel.from_cfg(
              cfg, use_pooler=True, classifier_activation=False
          )
          bart_model_with_pooler.load_parameters(params_path)
  
file_path: gluon-nlp/tests/test_models_bart.py
imports: import pytest
  import mxnet
  import tempfile
  import numpy
  import numpy.testing
  from gluonnlp.models.bart import BartModel, list_pretrained_bart, get_pretrained_bart, bart_cfg_reg
  from gluonnlp.utils.testing import verify_backbone_fp16
label_desc: Use image node_id 2 for calling a global function with example usage: test_bart(model_name) without return types