forked from oobabooga/text-generation-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}")) |