kohya-ss / kohya-ss/sd-scripts

Resizing LoRA produces unusable model

Open
#904 2 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

When I change the size of LoRA with this script:
```
python3 "networks/resize_lora.py" --save_precision fp16 \
--save_to "/models/Lora/ling_v3_a16.safetensors" \
--model "/models/Lora/ling_v3_a.safetensors" \
--new_rank 16 \
--device cuda --dynamic_method sv_fro --dynamic_param 0.9 \
--verbose
```
regardless of the selected "**new_rank**", the size of the resulting file is only about 8MB. And when I try to use this file in the AUTOMATIC1111 WebUI an error appears:

**RuntimeError: output with shape [3072, 1] doesn't match the broadcast shape [3072, 3072]**

So, resizer (**networks/resize_lora.py**) can't make working LoRA. Any result of resizing is corrupted and just doesn't work.

Example of LoRA, which I used as a source for resizing:
https://drive.google.com/file/d/1Z3F3uI6T9JDB6ZXzwaYB9-QtkzS6zpwq/view?usp=drive_link

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with networks/resize_lora.py and reproduce the reported command using the linked source LoRA, checking the generated safetensors file for its rank and tensor shapes. Compare the resized output with what AUTOMATIC1111 expects and verify that a selected new_rank produces a usable model without the reported broadcast-shape error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.