kohya-ss / kohya-ss/sd-scripts

Cannot extract Lora from Safetensors model trained in Kohya, model also produces NaNs in Automatic1111

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

Description

Everything goes allright until SVD comes in:

`calculating by svd
0%| | 0/278 [00:00
svd(args)
File "C:\AI\kohya_ss\networks\extract_lora_from_models.py", line 116, in svd
U, S, Vh = torch.linalg.svd(mat)
torch._C._LinAlgError: linalg.svd: The algorithm failed to converge because the input matrix is ill-conditioned or has too many repeated singular values (error code: 319).`

Changing the precision doesn't help, neither does changing to cpu.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at networks/extract_lora_from_models.py, especially the svd entry point and torch.linalg.svd call at line 116. Reproduce the Kohya-trained Safetensors extraction failure and inspect the matrix values and convergence warning; done means the extraction completes without the reported SVD error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.