CivArchive
    Resize Loras Batch Script - v1.0
    Preview 2700807

    Just a small batch file to resize .safetensors loras in bulk.

    The resize logic and its dependencies are taken from https://github.com/bmaltais/kohya_ss, i only added the batch file calling the python script.

    Usage:

    2.01: i dun goofed. ok, here is v2.0 in bug-free working condition.

    2.0: Extract the archive to a location of your choice and place all files you want to get resized in either the big, med or small subfolder. Execute res-lora.bat. The conversion uses the suggested settings of firemanbrakeneck: big = sv 0.94 / rank 32, med = 0.92 / 24, small = 0.9 / 16.

    1.0: Extract the archive to a location of your choice and place all files you want to get resized in the res-lora folder. Execute res-lora.bat. The conversion uses the default settings of kohya_ss' lora resizer: fp16 precision, cuda, method sv_fro with a value of 0.9, except for the rank, where i use 64, and places the resized files in the resized subfolder. all these settings can be changed in the batch call, together with the targeted file extension (in case you got loras in another format).

    Known Issues:

    Not all loras can be converted, my best guess is that newer types are not supported, yet.

    if it cannot find your python.exe make sure its path was added to the PATH system variable of windows correctly.

    Description

    initial release

    FAQ

    Comments (8)

    firemanbrakeneckSep 28, 2023· 1 reaction
    CivitAI

    Nice job, bud. Personally I made the modification in resize itself, it's cross platform (probably) though a bit more annoying to maintain.

    Small suggestion - make a few folders for the target size (eg I have big = sv 0.94 / rank 32, med = 0.92 / 24, small = 0.9 / 16), that way you just have to dump each model in the preferred folder instead of changing parameters. Sv is rather unpredictable in final size but it does seem to be a more optimal form of compression. I think that rank has a very negligible effect when sv is used (a cap of some sort), whereas very minute changes in sv make the size run wild.

    You are basically correct about loras of newer type being unconvertable currently. To be precise, these seem to be lohas / hadamard product structure (they have four layers per block, hada_{w1 / w2}_{a / b}, instead of the usual lora_up / lora_down); there's a section that detects network_dim based on a lora_down, plus a few more places matching down and up during the resize. Relatively rare models from what I've seen.

    https://github.com/huggingface/diffusers/issues/4133#issuecomment-1640183234

    Kairen92Sep 28, 2023
    CivitAI

    Does this have any impact on the quality of the LORAs?

    NextMealSep 28, 2023· 6 reactions

    Reducing dimensions always comes with information loss, but I remember seeing people reducing dimensions of overfitted LoRAs actually improve the results if the model remember too many unimportant details.

    IndolentCatSep 28, 2023· 7 reactions

    Yes, as @NextMeal said, if the LoRA is fine on weight 1, you risk losing likeness on characters/people. And on my experience reducing my own, is helps with overfitting, so I'd recommend it for styles, maybe concepts, but really discourage it for real people.

    Kairen92Sep 28, 2023

    Thank you both @NextMeal and @IndolentCat, that was a very helpful explanation. Also just to be clear, does overfitted LORAs also means overcooked LORAs?

    IndolentCatSep 28, 2023· 4 reactions

    @Kairen92 If is overcooked to the point the colors are oversaturated or gets random things on the subjects, like some "girl packs", I don't think just reducing the size would fix it.

    nishuOct 4, 2023

    @NextMeal if i m using 4k images for sd1.5 training, will they reduced automatically in khoyass? or i would have to do something after completing training?
    or i should crop images to exact 768 dimensions?

    NextMealOct 4, 2023

    @nishu If you have 4k*4k images for the training but you max resolution is set to be 512*512, those images will be downsized to fit the bucket before training. You can adjust max resolution to 1024*1024 or higher depending on your hardware to make the Lora work better on generating high res images by default. But since SD15 originally was trained on 512*512, you probably cannot expect it to output 1k or above perfectly without highres-fix (but training with highres can certainly help though) You generally don’t need to crop images but I heard if you have too many different buckets then it would be better to crop some of them to reduce the number of different Aspect ratios, because too many buckets can be harmful for the training.

    Other
    Other

    Details

    Downloads
    138
    Platform
    CivitAI
    Platform Status
    Available
    Created
    9/28/2023
    Updated
    5/14/2026
    Deleted
    -

    Files

    resizeLorasBatch_v10.zip

    Mirrors

    CivitAI (1 mirrors)

    Available On (1 platform)

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