소스 검색

Update LoRA.py

oobabooga 2 년 전
부모
커밋
b0abb327d8
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      modules/LoRA.py

+ 5 - 1
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...")