kohya-ss / kohya-ss/sd-scripts

resize_lora.py scale = network_alpha / network_dim TypeError: unsupported operand type(s) for /: 'NoneType' and 'NoneType'

Open
#2,169 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

some loras seem incompatible with the resize utility? the script can't detect the original dimension and alpha of the LoRA models from the model's metadata?

```
17:29:00-754074 INFO Executing command:
C:\_stability_matrix\Data\Packages\kohya\venv\Scripts\
python.exe
C:/_stability_matrix/Data/Packages/kohya/sd-scripts/ne
tworks/resize_lora.py --save_precision fp16 --save_to
C:/_stability_matrix/Data/Models/Lora/t4zz-v23-test.sa
fetensors --model
C:/_stability_matrix/Data/Models/Lora/t4zz-v23.safeten
sors --new_rank 32 --device cuda --dynamic_method
sv_fro --dynamic_param 0.94 --verbose
2025-08-05 17:29:09 INFO loading Model... resize_lora.py:321
2025-08-05 17:29:10 INFO Resizing Lora... resize_lora.py:324
Traceback (most recent call last):
File "C:\_stability_matrix\Data\Packages\kohya\sd-scripts\networks\resize_lora.py", line 412, in
resize(args)
File "C:\_stability_matrix\Data\Packages\kohya\sd-scripts\networks\resize_lora.py", line 325, in resize
state_dict, old_dim, new_alpha = resize_lora_model(
File "C:\_stability_matrix\Data\Packages\kohya\sd-scripts\networks\resize_lora.py", line 211, in resize_lora_model
scale = network_alpha / network_dim
TypeError: unsupported operand type(s) for /: 'NoneType' and 'NoneType'
```

i trained the lora with ai-toolkit with these parameters.
```
linear: 128
linear_alpha: 128
```
i can provide the lora if it helps.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with networks/resize_lora.py, especially resize_lora_model around line 211, and reproduce the failure using the command and ai-toolkit-trained safetensors model from the report. Check how the original dimension and alpha are obtained from model metadata when both are None. Done means the utility handles this model or reports a clear incompatibility instead of raising the shown TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.