Skip to content

Commit

Permalink
Add files
Browse files Browse the repository at this point in the history
  • Loading branch information
oobabooga committed Mar 17, 2023
1 parent 104293f commit 0cecfc6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Empty file added loras/place-your-loras-here.txt
Empty file.
15 changes: 15 additions & 0 deletions modules/LoRA.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pathlib import Path

from peft import PeftModel

import modules.shared as shared
from modules.models import load_model


def add_lora_to_model(lora_name):

# Is there a more efficient way of returning to the base model?
if lora_name == "None":
shared.model, shared.tokenizer = load_model(shared.model_name)
else:
shared.model = PeftModel.from_pretrained(shared.model, Path(f"loras/{lora_name}"))

0 comments on commit 0cecfc6

Please sign in to comment.