code: def load_huggingface_model(
      state_dict, config, hf_checkpoint_name="facebook/bart-base"
  ):
      model = BartForConditionalGeneration(config).eval()
      model.model.load_state_dict(state_dict)
      if hasattr(model, "lm_head"):
          model.lm_head = make_linear_from_emb(model.model.shared)
      return model
  
file_path: lightseq/examples/training/fairseq/ls_finetune_bart/convert_lightseq_to_huggingface.py
imports: import argparse
  from pathlib import Path
  import fairseq
  import torch
  from packaging import version
  from torch import nn
  from transformers import BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer
  from lightseq.training.cli.fs_modules import LSBARTModel
  from fairseq.models.bart import BARTModel
label_desc: Use image node_id 7 for calling a global function with example usage: load_huggingface_model(state_dict, config, hf_checkpoint_name) and returns: model