feat: make hash generation multi-threaded, change --rebuild-hash-cache from bool to int

keep in mind that most likely the drive is going to be the bottleneck now
This commit is contained in:
Manuel Schmid
2024-07-08 15:08:32 +02:00
parent df2dd194cc
commit edd886cea4
4 changed files with 35 additions and 22 deletions
-2
View File
@@ -176,13 +176,11 @@ def generate_temp_filename(folder='./outputs/', extension='png'):
def sha256(filename, use_addnet_hash=False, length=HASH_SHA256_LENGTH):
print(f"Calculating sha256 for {filename}: ", end='')
if use_addnet_hash:
with open(filename, "rb") as file:
sha256_value = addnet_hash_safetensors(file)
else:
sha256_value = calculate_sha256(filename)
print(f"{sha256_value}")
return sha256_value[:length] if length is not None else sha256_value