code: def get_textattack_model_num_labels(model_name, model_path):
      """Reads `train_args.json` and gets the number of labels for a trained
      model, if present."""
      model_cache_path = textattack.shared.utils.download_from_s3(
          model_path
      )
      train_args_path = os.path.join(
          model_cache_path, "train_args.json"
      )
      if not os.path.exists(train_args_path):
          textattack.shared.logger.warn(
              f"train_args.json not found in model path {model_path}. Defaulting to 2 labels."
          )
          return 2
      else:
          args = json.loads(open(train_args_path).read())
          return args.get("num_labels", 2)
  
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 3 for calling a global function with example usage: get_textattack_model_num_labels(model_name, model_path) and returns: int, args