Skip to content

Commit

Permalink
don't run when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ddPn08 committed Apr 2, 2023
1 parent b5ff4e8 commit b5c7937
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions train_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@ def save_func():
metadata["ss_training_finished_at"] = str(time.time())
print(f"saving checkpoint: {ckpt_file}")
unwrap_model(network).save_weights(ckpt_file, save_dtype, minimum_metadata if args.no_metadata else metadata)
huggingface_util.upload(ckpt_file, args, "/" + ckpt_name)
if args.huggingface_repo_id is not None:
huggingface_util.upload(ckpt_file, args, "/" + ckpt_name)

def remove_old_func(old_epoch_no):
old_ckpt_name = train_util.EPOCH_FILE_NAME.format(model_name, old_epoch_no) + "." + args.save_model_as
Expand Down Expand Up @@ -666,7 +667,8 @@ def remove_old_func(old_epoch_no):

print(f"save trained model to {ckpt_file}")
network.save_weights(ckpt_file, save_dtype, minimum_metadata if args.no_metadata else metadata)
huggingface_util.upload(ckpt_file, args, "/" + ckpt_name)
if args.huggingface_repo_id is not None:
huggingface_util.upload(ckpt_file, args, "/" + ckpt_name)
print("model saved.")


Expand Down

0 comments on commit b5c7937

Please sign in to comment.