From b0abb327d822f8fe4c0180a4a725c0e362182b8f Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 23 Mar 2023 22:02:09 -0300 Subject: [PATCH] Update LoRA.py --- modules/LoRA.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/LoRA.py b/modules/LoRA.py index 1c03826b..aa68ad32 100644 --- a/modules/LoRA.py +++ b/modules/LoRA.py @@ -14,7 +14,11 @@ def add_lora_to_model(lora_name): from peft import PeftModel - reload_model() + # If a LoRA had been previously loaded, or if we want + # to unload a LoRA, reload the model + if shared.lora_name != "None" or lora_name == "None": + reload_model() + shared.lora_name = lora_name if lora_name != "None": print(f"Adding the LoRA {lora_name} to the model...")