Merge pull request #187 from space-nuko/add-commit-hash

Add commit hash to metadata
This commit is contained in:
Kohya S
2023-02-14 19:52:30 +09:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import math
import os
import random
import hashlib
import subprocess
from io import BytesIO
from tqdm import tqdm
@@ -1100,6 +1101,13 @@ def addnet_hash_safetensors(b):
return hash_sha256.hexdigest()
def get_git_revision_hash() -> str:
try:
return subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
except:
return "(unknown)"
# flash attention forwards and backwards
# https://arxiv.org/abs/2205.14135

View File

@@ -356,7 +356,8 @@ def train(args):
"ss_reg_dataset_dirs": json.dumps(train_dataset.reg_dataset_dirs_info),
"ss_tag_frequency": json.dumps(train_dataset.tag_frequency),
"ss_bucket_info": json.dumps(train_dataset.bucket_info),
"ss_training_comment": args.training_comment # will not be updated after training
"ss_training_comment": args.training_comment, # will not be updated after training
"ss_sd_scripts_commit_hash": train_util.get_git_revision_hash()
}
# uncomment if another network is added