code: def load_textattack_model_from_path(model_name, model_path):
      """Loads a pre-trained TextAttack model from its name and path.
  
      For example, model_name "lstm-yelp" and model path
      "models/classification/lstm/yelp".
      """
  
      colored_model_name = textattack.shared.utils.color_text(
          model_name, color="blue", method="ansi"
      )
      if model_name.startswith("lstm"):
          num_labels = get_textattack_model_num_labels(
              model_name, model_path
          )
          textattack.shared.logger.info(
              f"Loading pre-trained TextAttack LSTM: {colored_model_name}"
          )
          model = textattack.models.helpers.LSTMForClassification(
              model_path=model_path, num_labels=num_labels
          )
      elif model_name.startswith("cnn"):
          num_labels = get_textattack_model_num_labels(
              model_name, model_path
          )
          textattack.shared.logger.info(
              f"Loading pre-trained TextAttack CNN: {colored_model_name}"
          )
          model = textattack.models.helpers.WordCNNForClassification(
              model_path=model_path, num_labels=num_labels
          )
      elif model_name.startswith("t5"):
          model = textattack.models.helpers.T5ForTextToText(model_path)
      else:
          raise ValueError(f"Unknown textattack model {model_path}")
      return model
  
file_path: TextAttack/textattack/shared/utils/misc.py
imports: import json
  import os
  import random
  import numpy
  import torch
  import textattack
label_desc: Use image node_id 4 for calling a global function with example usage: load_textattack_model_from_path(model_name, model_path) and returns: model