Commit 500d9a32 authored by AUTOMATIC's avatar AUTOMATIC
Browse files

add --lora-dir commandline option

parent 4a8fe096
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -177,12 +177,12 @@ def lora_Conv2d_forward(self, input):
def list_available_loras():
    available_loras.clear()

    os.makedirs(lora_dir, exist_ok=True)
    os.makedirs(shared.cmd_opts.lora_dir, exist_ok=True)

    candidates = \
        glob.glob(os.path.join(lora_dir, '**/*.pt'), recursive=True) + \
        glob.glob(os.path.join(lora_dir, '**/*.safetensors'), recursive=True) + \
        glob.glob(os.path.join(lora_dir, '**/*.ckpt'), recursive=True)
        glob.glob(os.path.join(shared.cmd_opts.lora_dir, '**/*.pt'), recursive=True) + \
        glob.glob(os.path.join(shared.cmd_opts.lora_dir, '**/*.safetensors'), recursive=True) + \
        glob.glob(os.path.join(shared.cmd_opts.lora_dir, '**/*.ckpt'), recursive=True)

    for filename in sorted(candidates):
        if os.path.isdir(filename):
@@ -193,7 +193,6 @@ def list_available_loras():
        available_loras[name] = LoraOnDisk(name, filename)


lora_dir = os.path.join(shared.models_path, "Lora")
available_loras = {}
loaded_loras = []

+6 −0
Original line number Diff line number Diff line
import os
from modules import paths


def preload(parser):
    parser.add_argument("--lora-dir", type=str, help="Path to directory with Lora networks.", default=os.path.join(paths.models_path, 'Lora'))
+1 −1
Original line number Diff line number Diff line
@@ -31,5 +31,5 @@ class ExtraNetworksPageLora(ui_extra_networks.ExtraNetworksPage):
            }

    def allowed_directories_for_previews(self):
        return [lora.lora_dir]
        return [shared.cmd_opts.lora_dir]