CivArchive
    ← All articles
    Published May 20, 2024by Queria

    Resizing SDXL loras in seconds (instead of minutes)

    959 views23 reactions1 comments on CivitAI39 collected
    sdxltool guidesdxl loralora

    Well, at least for me (3060ti) resizing SDXL loras takes upwards of 6 minutes with the regular resizing scripts, with this new repo it only takes a few seconds.

    Github repo: https://github.com/elias-gaeros/resize_lora
    You can probably use the venv of the webui to execute the script (I used the forge venv), for that you just need to open cmd, then paste the path to your webui venv activation bat (example: E:\stable-diffusion-webui-forge\venv\Scripts\activate.bat), now with the environment active you can execute the script to resize the lora with python "path to resize_lora.py" "path to model the lora was trained on .safetensors" "path to the lora.safetensors" -o "path to where the resized lora will be saved" -r fro_ckpt=1,thr=-2.0

    Example: python X:\avirtual\resize_lora\resize_lora.py E:\stable-diffusion-webui\models\Stable-diffusion\pony.safetensors X:\LoRa\glavakolhoza_shyvana-000006.safetensors -o X:\LoRa -v -r fro_ckpt=1,thr=-2.0 this will output a 13mb glavakolhoza_shyvana-000006_th-2.00_fro_ckpt1.00.safetensors file in the X:\LoRa folder

    (if you have spaces in the path you have to add quotes to the path, e.g. "C:\my folder")

    The compression level is tweaked by the thr value, you can also try spn_ckpt instead of fro_ckpt, they seem almost identical though, spn with a thr of -1.1 is roughly equivalent to a thr of -2 on fro

    All of them follow the same order, the original lora followed by the resized one with a threshold of -2.4, -2.2, -2 and without the lora

    https://i.imgur.com/xYubOUx.jpeg
    original (200mb), -2.4 (28mb), -2.2 (12mb), -2.0 (6mb), without
    gwen https://civitai.com/models/465937/gwen-league-of-legends-comission-lora-ponyxl-nsfw-support

    GwenLoLXL, blue eye, heterochromia, symbol-shaped pupil, star (symbol), blue hair, drill hair, hair bow, black bow, trwin drills, twintails, long hair, bangs, ahoge, medium breasts, puffy short sleeves, white dress, score 9, score 8 up, score 7 up


    https://i.imgur.com/HnXreX9.jpeg
    original (200mb), -2.4 (25mb), -2.2 (10mb), -2.0 (4mb), without

    della duck https://civitai.com/models/149490/della-duck-or-ducktales-2017-pdxl-and-15

    1girl, outside, beach, standing, solo, furry, duck, della duck, beak, white skin, white body, white hair, short hair, ponytail, eyes closed, orange legs (brass leg, prosthetic leg), teeth, looking at viewer, breasts, crop top, swimming trunks, smile, mouth closed, hand heart

    https://i.imgur.com/vSxHx3T.jpeg
    original (200mb), -2.4 (28mb), -2.2 (11mb), -2.0 (5mb), without

    fox xanatos https://civitai.com/models/465990/fox-xanatos

    score_9, score_8_up, score_7_up, looking at viewer, BlackArmor_FoxXanatos_ownwaifu, 1girl, eye mask, facial tattoo, green eyes, long hair, orange hair, lipstick, makeup, red lips, black armor, ninja, shoulder armor, black choker, black gloves, black nails, jacket

    https://i.imgur.com/WhKwVdt.jpeg
    original (200mb), -2.4 (56mb), -2.2 (29mb), -2.0 (13mb), without

    Shyvana https://civitai.com/models/465674/shyvana-league-of-legends-for-pony

    score_9, score_8_up,score_7_up, glavakolhoza_shyvana, toned, outdoors, fantasy armour, purple skin, purple freckles, yellow eyes, big breasts, relaxed pose, armored gloves, long hair, twin braids

    One thing you will notice with the resized loras is that they may adhere better to prompts, specially stylization ones, resizing the lora seems to have a similar effect to the block tweaking from my other guide, probably because by removing excess weights overfit loras become more flexible, leaving only the essential bits; of course you can also resize style loras, but I only used characters in the examples so you have a better idea of which threshold to use because I think its easier to spot degradation from the resizing in characters than in styles.