Skip to content

Commit

Permalink
pop weights if available kohya-ss#1247
Browse files Browse the repository at this point in the history
  • Loading branch information
kohya-ss authored and A4P7J1N7M05OT committed May 12, 2024
1 parent 2be64b3 commit a3f77bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion train_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ def save_model_hook(models, weights, output_dir):
if not isinstance(model, type(accelerator.unwrap_model(network))):
remove_indices.append(i)
for i in reversed(remove_indices):
weights.pop(i)
if len(weights) > i:
weights.pop(i)
# print(f"save model hook: {len(weights)} weights will be saved")

def load_model_hook(models, input_dir):
Expand Down

0 comments on commit a3f77bf

Please sign in to comment.