CivArchive
    Sort LyCORIS from LORA script - v3.0
    Preview 1509260

    I often dump everything I download in the lora folder. Turns out the LyCORIS models are supposed to go in a different folder.

    I wrote this python script to find all the LyCORIS that were placed in the wrong folder.

    e.g.

    > python.exe find_lyco.py D:\\stable-diffusion-webui\\models\\lora
    ----------------------------------
    | Looking for .safetensors files |
    ----------------------------------
    D:\stable-diffusion-webui\models\lora\a.safetensors
    D:\stable-diffusion-webui\models\lora\subdir\b.safetensors
    D:\stable-diffusion-webui\models\lora\c.safetensors
    ----------------------------------
    | Found the following LORA files |
    ----------------------------------
    D:\stable-diffusion-webui\models\lora\a.safetensors
    D:\stable-diffusion-webui\models\lora\subdir\b.safetensors
    -------------------------------------
    | Found the following LyCORIS files |
    -------------------------------------
    D:\stable-diffusion-webui\models\lora\c.safetensors

    Description

    • Now always checks model as the metadata sometimes lies and says lora when the file is lycoris.

    • Added feature to have the script move LyCORIS models to a target directory. It also moves related preview and info files and maintains the directory structure. The script prompts for confirmation before moving any files.

    FAQ

    Comments (15)

    TheOnlyHolyMolyJul 11, 2023
    CivitAI

    If you use "use lycoris to handle lora" feature on SDNext it will be irrelevant to split them apart... you can just dump them together and stop worrying

    NoArticle9567120Jul 12, 2023

    Interesting, might try this

    cgmodh596Jul 12, 2023

    no. Certain lycos outputs an error called - Bad Lora layer name

    ditaJul 11, 2023
    CivitAI

    I've mostly avoided this issue by naming downloads either xxx.lora.safetensors or yyy.lyco.safetensors and even zzz.base.safetensors (ST-format base models) and www.ti.safetensors (ST-format embeddings).

    You just have to remember in your prompts to change <lora:xxx:1> to <lora:xxx.lora:1> and so on, such as <lora:add_detail.lora:0.8>.

    If you use the tag-complete extension in webui, it will pop up the correct names if you use <l: for LoRAs, <lyco: for LyCORIS, or <e: for embeddings, and a few letters, so you don't even have to remember to add it in your prompt.

    blooestJul 14, 2023

    You don't even have to specify the type. <example will match anything with example in the name, and complete the prompt appropriately.

    ditaJul 17, 2023

    @blooest Ah, thanks for the tip. I didn't realize that.

    OtherPerspectiveJul 12, 2023
    CivitAI

    This list for loras works fine but I get an error on the actual lycoris list:

    -------------------------------------

    | Found the following LyCORIS files |

    -------------------------------------

    Traceback (most recent call last):

    File "C:\stable-diffusion-webui\find_lyco.py", line 135, in <module>

    main()

    File "C:\stable-diffusion-webui\find_lyco.py", line 88, in main

    if is_lyco(header):

    File "C:\stable-diffusion-webui\find_lyco.py", line 31, in is_lyco

    metadata = header.get("__metadata__")

    AttributeError: 'NoneType' object has no attribute 'get'

    OtherPerspectiveJul 12, 2023

    Looks like code blocks don't work on this site, sorry about that

    m99
    Author
    Jul 12, 2023

    That error means the last it failed to read the last file in the "Looking for .safetensors files" section. The original intention was to skip over broken files but I forgot to implement that. If you add "if header is None:(newline and indent) continue" after line 85, it should fix the issue. Otherwise just move the file it couldn't read out of the directory.

    OtherPerspectiveJul 13, 2023

    @m99 That seemed to work. It identified 15 lycos and 14 of those were actually just loras

    wktraJul 12, 2023
    CivitAI

    Is there a benefit to separating Lora vs Lyco?

    m99
    Author
    Jul 12, 2023

    Depends what version and what extensions your using. Others here have commented they put everything in the lora folder or everything in the lycoris folder and it worked fine.

    If you specify block weights on your loras, lora and lyco have a different number of weights that need to be specified so that might be an edge case where you'd need to have them in the right directory where they'd otherwise work fine being all together.

    DegenFurAug 2, 2023
    CivitAI

    I just spent over 5 hours fixing this exact issue, less than 10 tabs left to check I browse your account to find this. fml.

    Cool work none the less.

    thebigstrongzebra316Aug 11, 2023
    CivitAI

    Now it can find them. But could it also.. move them for me? Or I gotta be all manual from here? D:

    Edit: Nevermind, it does that. Though, I wouldn't know for sure, I can't get it to work. I lack the braincells.

    1541802Nov 9, 2023
    CivitAI

    but what do I do with it? I assume put
    python find_lyco.py

    in a cmd window from the lora folder but, nothing seems to happen other than

    Usage:

    python find_lyco.py [path_to_directory_to_scan]

    or

    python find_lyco.py [path_to_directory_to_scan] [target_lycoris_directory]

    If a target directory is supplied, confirmation will be asked before moving files.

    If no target directory is supplied, this script will not move any files.

    but, that doesn't mean anything to me. Any help?

    Other
    Other
    by m99

    Details

    Downloads
    779
    Platform
    CivitAI
    Platform Status
    Available
    Created
    7/11/2023
    Updated
    5/15/2026
    Deleted
    -

    Files

    Available On (1 platform)

    Same model published on other platforms. May have additional downloads or version variants.