code: def get_model(model_name, root_path=default_root_path):
      check_root()
      ckpt = os.path.join(
          root_path, "pretrain/nre/" + model_name + ".pth.tar"
      )
      if model_name == "wiki80_cnn_softmax":
          download_pretrain(model_name, root_path=root_path)
          download("glove", root_path=root_path)
          download("wiki80", root_path=root_path)
          wordi2d = json.load(
              open(
                  os.path.join(
                      root_path,
                      "pretrain/glove/glove.6B.50d_word2id.json",
                  )
              )
          )
          word2vec = np.load(
              os.path.join(
                  root_path, "pretrain/glove/glove.6B.50d_mat.npy"
              )
          )
          rel2id = json.load(
              open(
                  os.path.join(
                      root_path, "benchmark/wiki80/wiki80_rel2id.json"
                  )
              )
          )
          sentence_encoder = encoder.CNNEncoder(
              token2id=wordi2d,
              max_length=40,
              word_size=50,
              position_size=5,
              hidden_size=230,
              blank_padding=True,
              kernel_size=3,
              padding_size=1,
              word2vec=word2vec,
              dropout=0.5,
          )
          m = model.SoftmaxNN(sentence_encoder, len(rel2id), rel2id)
          m.load_state_dict(
              torch.load(ckpt, map_location="cpu")["state_dict"]
          )
          return m
      elif model_name in [
          "wiki80_bert_softmax",
          "wiki80_bertentity_softmax",
      ]:
          download_pretrain(model_name, root_path=root_path)
          download("bert_base_uncased", root_path=root_path)
          download("wiki80", root_path=root_path)
          rel2id = json.load(
              open(
                  os.path.join(
                      root_path, "benchmark/wiki80/wiki80_rel2id.json"
                  )
              )
          )
          if "entity" in model_name:
              sentence_encoder = encoder.BERTEntityEncoder(
                  max_length=80,
                  pretrain_path=os.path.join(
                      root_path, "pretrain/bert-base-uncased"
                  ),
              )
          else:
              sentence_encoder = encoder.BERTEncoder(
                  max_length=80,
                  pretrain_path=os.path.join(
                      root_path, "pretrain/bert-base-uncased"
                  ),
              )
          m = model.SoftmaxNN(sentence_encoder, len(rel2id), rel2id)
          m.load_state_dict(
              torch.load(ckpt, map_location="cpu")["state_dict"]
          )
          return m
      elif model_name in [
          "tacred_bert_softmax",
          "tacred_bertentity_softmax",
      ]:
          download_pretrain(model_name, root_path=root_path)
          download("bert_base_uncased", root_path=root_path)
          download("tacred", root_path=root_path)
          rel2id = json.load(
              open(
                  os.path.join(
                      root_path, "benchmark/tacred/tacred_rel2id.json"
                  )
              )
          )
          if "entity" in model_name:
              sentence_encoder = encoder.BERTEntityEncoder(
                  max_length=80,
                  pretrain_path=os.path.join(
                      root_path, "pretrain/bert-base-uncased"
                  ),
              )
          else:
              sentence_encoder = encoder.BERTEncoder(
                  max_length=80,
                  pretrain_path=os.path.join(
                      root_path, "pretrain/bert-base-uncased"
                  ),
              )
          m = model.SoftmaxNN(sentence_encoder, len(rel2id), rel2id)
          m.load_state_dict(
              torch.load(ckpt, map_location="cpu")["state_dict"]
          )
          return m
      else:
          raise NotImplementedError
  
imports: from .None import encoder
  from .None import model
  from .None import framework
  import torch
  import os
  import sys
  import json
  import numpy
  import logging
label_desc: Use image node_id 13 for calling a global function with example usage: get_model(model_name, root_path) and returns: m, m, m