Skip to content

Commit 0540c33

Browse files
committed
pop weights if available kohya-ss#1247
1 parent 52652cb commit 0540c33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

train_network.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,8 @@ def save_model_hook(models, weights, output_dir):
481481
if not isinstance(model, type(accelerator.unwrap_model(network))):
482482
remove_indices.append(i)
483483
for i in reversed(remove_indices):
484-
weights.pop(i)
484+
if len(weights) > i:
485+
weights.pop(i)
485486
# print(f"save model hook: {len(weights)} weights will be saved")
486487

487488
def load_model_hook(models, input_dir):

0 commit comments

Comments
 (0)