Skip to content

Commit 0cecfc6

Browse files
committed
Add files
1 parent 104293f commit 0cecfc6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

loras/place-your-loras-here.txt

Whitespace-only changes.

modules/LoRA.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from pathlib import Path
2+
3+
from peft import PeftModel
4+
5+
import modules.shared as shared
6+
from modules.models import load_model
7+
8+
9+
def add_lora_to_model(lora_name):
10+
11+
# Is there a more efficient way of returning to the base model?
12+
if lora_name == "None":
13+
shared.model, shared.tokenizer = load_model(shared.model_name)
14+
else:
15+
shared.model = PeftModel.from_pretrained(shared.model, Path(f"loras/{lora_name}"))

0 commit comments

Comments
 (0)