Skip to main content
This guide explains how to:
  • Install requirements
  • Download base and LoRA checkpoints
  • Run the merge script
  • Use the merged model with vLLM

1. Install dependencies

These are required for:
  • loading safetensors checkpoints
  • reading LoRA configs
  • downloading models from Hugging Face

2. Download the base model checkpoint

You must use the exact same base model that was used during LoRA training. Example (Hugging Face Hub):
This gives you a directory like:
You’ll pass this as:
  • --orig_ckpt_path gpt-oss-20b-BF16

3. Download the LoRA checkpoint

Download the LoRA adapter either from the UI or via CLI into a directory, for example:
You’ll pass this as:
  • --lora_ckpt_path my-lora-adapter

4. Save the merge script

Create a file named merge_lora.py and paste the following:
Important:
--lora_ckpt_path must point to the LoRA adapter directory that contains adapter_model.safetensors (and adapter_config.json), not to the base model.

5. Run the merge

Example:
After it completes, you’ll have:
All non-.safetensors files are copied from the original checkpoint directory.

Notes & constraints

  • By default, only layers matching:
    are merged. If you trained LoRA on other modules (e.g. MLPs), extend ALLOWED_LORA_LAYERS accordingly.
  • The script will fail if:
    • The LoRA weights are not compatible with the base checkpoint
    • Some LoRA weights remain unused (non-merged) after processing all shards
This keeps merges explicit and avoids silently ignoring parts of the adapter.