mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-09 06:45:09 +00:00
fix exception on training model in diffusers format
This commit is contained in:
@@ -1183,10 +1183,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
|
||||
|
||||
@@ -1195,6 +1198,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):
|
||||
|
||||
Reference in New Issue
Block a user