code: def merge_model(options, base_model):
      first_weight = base_model.model.layers[0].self_attn.q_proj.weight
      first_weight_old = first_weight.clone()
  
      lora_model = PeftModel.from_pretrained(
          base_model,
          options.lora_weights,
      )
  
      assert torch.allclose(first_weight_old, first_weight)
  
      print("Merging . . .")
      lora_model = lora_model.merge_and_unload()
      lora_model.train(False)
  
      assert not torch.allclose(first_weight_old, first_weight)
      lora_model_sd = lora_model.state_dict()
      deloreanized_sd = {
          k.replace("base_model.model.", ""): v
          for k, v in lora_model_sd.items()
          if "lora" not in k
      }
      return deloreanized_sd
  
file_path: DeepKE/example/llm/InstructKGC/src/inference_vllm.py
imports: import os
  import json
  import torch
  from dataclasses import dataclass, field
  from transformers import HfArgumentParser
  from peft import PeftModel
  from vllm.sampling_params import SamplingParams
  from utils.prompter import Prompter
  from utils.general_utils import get_model_tokenizer, get_model_name
  from utils.vllm_llm import LLM
label_desc: Use image node_id 2 for calling a global function with example usage: merge_model(options, base_model) and returns: deloreanized_sd