pop weights if available #1247

This commit is contained in:
Kohya S
2024-04-21 17:45:29 +09:00
parent 52652cba1a
commit 0540c33aca

View File

@@ -481,6 +481,7 @@ class NetworkTrainer:
if not isinstance(model, type(accelerator.unwrap_model(network))): if not isinstance(model, type(accelerator.unwrap_model(network))):
remove_indices.append(i) remove_indices.append(i)
for i in reversed(remove_indices): for i in reversed(remove_indices):
if len(weights) > i:
weights.pop(i) weights.pop(i)
# print(f"save model hook: {len(weights)} weights will be saved") # print(f"save model hook: {len(weights)} weights will be saved")