code: def get_huggingface_lm_model(
      pretrained_model_name: str,
      config_dict: Optional[dict] = None,
      config_file: Optional[str] = None,
  ):
      """
      Returns lm model instantiated with Huggingface
  
      Args:
          pretrained_mode_name: specify this to instantiate pretrained model from Huggingface,
              e.g. bert-base-cased. For entire list, see get_huggingface_pretrained_lm_models_list().
          config_dict: model configuration dictionary used to instantiate Huggingface model from scratch
          config_file: path to model configuration file used to instantiate Huggingface model from scratch
  
      Returns:
          BertModule
      """
  
      try:
          automodel = AutoModel.from_pretrained(pretrained_model_name)
      except Exception as e:
          raise ValueError(
              f"{pretrained_model_name} is not supported by HuggingFace. {e}"
          )
  
      model_type = type(automodel).__name__
  
      if model_type in HUGGINGFACE_MODELS:
          model_class = HUGGINGFACE_MODELS[model_type]["class"]
          if config_file:
              if not os.path.exists(config_file):
                  logging.warning(
                      f"Config file was not found at {config_file}. Will attempt to use config_dict or pretrained_model_name."
                  )
              else:
                  config_class = HUGGINGFACE_MODELS[model_type][
                      "config"
                  ]
                  return model_class(
                      config_class.from_json_file(config_file)
                  )
          if config_dict:
              config_class = HUGGINGFACE_MODELS[model_type]["config"]
              return model_class(config=config_class(**config_dict))
          else:
              return model_class.from_pretrained(pretrained_model_name)
      else:
          raise ValueError(
              f"Use HuggingFace API directly in NeMo for {pretrained_model_name}"
          )
  
file_path: NeMo/nemo/collections/nlp/modules/common/huggingface/huggingface_utils.py
imports: import os
  from typing import List, Optional
  from transformers import ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_MODEL_ARCHIVE_LIST, CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST, DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST, GPT2_PRETRAINED_MODEL_ARCHIVE_LIST, ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST, AlbertConfig, AutoModel, BertConfig, CamembertConfig, DistilBertConfig, GPT2Config, RobertaConfig
  from nemo.collections.nlp.modules.common.huggingface.albert import AlbertEncoder
  from nemo.collections.nlp.modules.common.huggingface.bert import BertEncoder
  from nemo.collections.nlp.modules.common.huggingface.camembert import CamembertEncoder
  from nemo.collections.nlp.modules.common.huggingface.distilbert import DistilBertEncoder
  from nemo.collections.nlp.modules.common.huggingface.gpt2 import GPT2Encoder
  from nemo.collections.nlp.modules.common.huggingface.roberta import RobertaEncoder
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: get_huggingface_lm_model(pretrained_model_name, config_dict, config_file) and returns: model_class, model_class, model_class