code: def load_model(model_name: str, device="cuda"):
      print("Loading model...")
      if "openai" in model_name:
          model_wrapped = CompletionsOpenAI(
              engine=model_name.replace("openai-", ""), format_fn=None
          )
      else:
          tokenizer = transformers.AutoTokenizer.from_pretrained(
              model_name
          )
          model = transformers.AutoModelForCausalLM.from_pretrained(
              model_name,
              torch_dtype=torch.bfloat16,
              trust_remote_code=True,
              device_map="auto",
          )
          model_wrapped = HF_LM(
              model, tokenizer, device=device, format_fn=None
          )
      return model_wrapped
  
file_path: interpret-text/python/interpret_text/generative/app_hierarchical.py
imports: import streamlit
  import os
  import torch
  import pandas
  import transformers
  from accelerate import Accelerator
  from functools import partial
  from lime_tools.explainers import LocalExplanationHierarchical, LocalExplanationSentenceEmbedder, LocalExplanationLikelihood
  from lime_tools.text_utils import split_into_sentences, extract_non_overlapping_ngrams
  from model_lib.openai_tooling import CompletionsOpenAI
  from model_lib.hf_tooling import HF_LM
  from model_lib.streamlit_frontend import css, explanation_text, start_frontend, ProgressBar
label_desc: Use image node_id 1 for calling a global function with example usage: load_model(model_name, device) and returns: model_wrapped