Add training metadata to output LoRA model

This commit is contained in:
space-nuko
2023-01-10 02:49:52 -08:00
parent a84ca297bd
commit 2e4ce0fdff
4 changed files with 72 additions and 5 deletions

View File

@@ -747,6 +747,20 @@ def exists(val):
def default(val, d):
return val if exists(val) else d
def model_hash(filename):
try:
with open(filename, "rb") as file:
import hashlib
m = hashlib.sha256()
file.seek(0x100000)
m.update(file.read(0x10000))
return m.hexdigest()[0:8]
except FileNotFoundError:
return 'NOFILE'
# flash attention forwards and backwards
# https://arxiv.org/abs/2205.14135