Merge pull request #290 from orenwang/main

fix exception on training model in diffusers format
This commit is contained in:
Kohya S
2023-03-19 21:59:57 +09:00
committed by GitHub

View File

@@ -1351,10 +1351,13 @@ def model_hash(filename):
return m.hexdigest()[0:8]
except FileNotFoundError:
return "NOFILE"
except IsADirectoryError:
return 'IsADirectory'
def calculate_sha256(filename):
"""New model hash used by stable-diffusion-webui"""
try:
hash_sha256 = hashlib.sha256()
blksize = 1024 * 1024
@@ -1363,6 +1366,10 @@ def calculate_sha256(filename):
hash_sha256.update(chunk)
return hash_sha256.hexdigest()
except FileNotFoundError:
return 'NOFILE'
except IsADirectoryError:
return 'IsADirectory'
def precalculate_safetensors_hashes(tensors, metadata):