Skip to content

Commit

Permalink
Create a Model Merging docs page.
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanJDick committed Jun 3, 2024
1 parent d564b44 commit 77fdbf7
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docs/guides/model_merge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Model Merging

`invoke-training` provides utility scripts for several common model merging workflows. This page contains a summary of the available tools.

## `extract_lora_from_model_diff.py`

Extract a LoRA model that represents the difference between two base models.

Note that the extracted LoRA model is a lossy representation of the difference between the models, so some degradation in quality is expected.

For usage docs, run:
```bash
python src/invoke_training/model_merge/scripts/extract_lora_from_model_diff.py -h
```

## `merge_lora_into_model.py`

Merge a LoRA model into a base model to produce a new base model.

For usage docs, run:
```bash
python src/invoke_training/model_merge/scripts/merge_lora_into_model.py -h
```

## `merge_models.py`

Merge 2 or more base models to produce a single base model (using either LERP or SLERP). This is a simple merge strategy that merges all model weights in the same way.

For usage docs, run:
```bash
python src/invoke_training/model_merge/scripts/merge_models.py -h
```

## `merge_task_models_to_base_model.py`

Merge 1 or more task-specific base models into a single starting base model (using either [TIES](https://arxiv.org/abs/2306.01708) or [DARE](https://arxiv.org/abs/2311.03099)). This merge strategy aims to preserve the task-specific behaviors of the task models while making only small changes to the original base model. This approach enables multiple task models to be merged without excessive interference between them.

If you want to merge a task-specific LoRA into a base model using this strategy, first use `merge_lora_into_model.py` to produce a task-specific base model, then merge that new base model using this strategy.

For usage docs, run:
```bash
python src/invoke_training/model_merge/scripts/merge_task_models_to_base_model.py -h
```

0 comments on commit 77fdbf7

Please sign in to comment.