[PR #290] [MERGED] implement loading ggml lora adapters through the modelfile #35954

Closed
opened 2026-04-22 20:41:40 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/290
Author: @mxyng
Created: 8/5/2023
Status: Merged
Merged: 8/11/2023
Merged by: @mxyng

Base: mainHead: add-adapter-layers


📝 Commits (2)

  • 6de5d03 implement loading ggml lora adapters through the modelfile
  • 37c9a8e add lora docs

📊 Changes

6 files changed (+75 additions, -14 deletions)

View changed files

📝 docs/modelfile.md (+10 -1)
📝 llm/llama.go (+16 -1)
📝 llm/llm.go (+2 -2)
📝 parser/parser.go (+1 -1)
📝 server/images.go (+45 -8)
📝 server/routes.go (+1 -1)

📄 Description

LoRA adapters can be added to Ollama models through the Modelfile and automatically applied when the model is loaded:

FROM llama2:13b
TEMPLATE {{ .Prompt }}
ADAPTER ./llama2-13b-storywriter-lora.ggml.bin

A few caveats:

  • LoRA adapters must be GGML. If the adapter isn't GGML, it can be converted with the convert-lora-to-ggml.py script in https://github.com/ggerganov/llama.cpp
  • Using adapters with quantized weights might not produce good results
  • Using adapters disables mmap
  • It's possible to apply multiple adapters but
    1. Ordering is important
    2. There may be unintended side effects since most adapters are not intended to be layered on other adapters
    3. Performance may degrade with more adapters

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/290 **Author:** [@mxyng](https://github.com/mxyng) **Created:** 8/5/2023 **Status:** ✅ Merged **Merged:** 8/11/2023 **Merged by:** [@mxyng](https://github.com/mxyng) **Base:** `main` ← **Head:** `add-adapter-layers` --- ### 📝 Commits (2) - [`6de5d03`](https://github.com/ollama/ollama/commit/6de5d032e1da8f7a2a15010a5422cbddc5d0b932) implement loading ggml lora adapters through the modelfile - [`37c9a8e`](https://github.com/ollama/ollama/commit/37c9a8eea98626bb32b05ec2a82279082317f0d6) add lora docs ### 📊 Changes **6 files changed** (+75 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `docs/modelfile.md` (+10 -1) 📝 `llm/llama.go` (+16 -1) 📝 `llm/llm.go` (+2 -2) 📝 `parser/parser.go` (+1 -1) 📝 `server/images.go` (+45 -8) 📝 `server/routes.go` (+1 -1) </details> ### 📄 Description LoRA adapters can be added to Ollama models through the Modelfile and automatically applied when the model is loaded: ``` FROM llama2:13b TEMPLATE {{ .Prompt }} ADAPTER ./llama2-13b-storywriter-lora.ggml.bin ``` A few caveats: * LoRA adapters must be GGML. If the adapter isn't GGML, it can be converted with the `convert-lora-to-ggml.py` script in https://github.com/ggerganov/llama.cpp * Using adapters with quantized weights might not produce good results * Using adapters disables mmap * It's possible to apply multiple adapters but 1. Ordering is important 2. There may be unintended side effects since most adapters are not intended to be layered on other adapters 3. Performance may degrade with more adapters --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-22 20:41:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#35954