Skip to content

Add --svd_lowrank_niter option to resize_lora.py#2296

Merged
kohya-ss merged 1 commit intosd3from
add-svd-lowrank-niter
Mar 29, 2026
Merged

Add --svd_lowrank_niter option to resize_lora.py#2296
kohya-ss merged 1 commit intosd3from
add-svd-lowrank-niter

Conversation

@kohya-ss
Copy link
Copy Markdown
Owner

Summary

  • Add --svd_lowrank_niter option to resize_lora.py to control the number of iterations for torch.svd_lowrank on large matrices (>2048 dims)
  • Default is 2 (same behavior as Use torch.svd_lowrank for large matrices in resize_lora.py #2240), set to 0 to disable and use full SVD
  • Allows users to tune the quality/speed tradeoff (e.g. niter=7 for higher quality at minimal extra cost)

Test plan

  • Verified with Qwen-Image LoRA: default (niter=2) runs in ~2s, niter=7 in ~3s, niter=0 (full SVD) in ~18min
  • --verbose output is nearly identical across all niter values

🤖 Generated with Claude Code

Allow users to control the number of iterations for torch.svd_lowrank
on large matrices. Default is 2 (matching PR #2240 behavior). Set to 0
to disable svd_lowrank and use full SVD instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kohya-ss kohya-ss merged commit 89b246f into sd3 Mar 29, 2026
3 checks passed
@kohya-ss kohya-ss deleted the add-svd-lowrank-niter branch March 29, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant