Support LoRA

This commit is contained in:
nkchocoai
2024-02-18 15:21:31 +09:00
parent 73b27ab350
commit 0d2afa545d
5 changed files with 59 additions and 15 deletions
+18
View File
@@ -0,0 +1,18 @@
import hashlib
cache_model_hash = {}
def calc_hash(filename):
if filename in cache_model_hash:
return cache_model_hash[filename]
sha256_hash = hashlib.sha256()
with open(filename, "rb") as f:
for byte_block in iter(lambda: f.read(4096), b""):
sha256_hash.update(byte_block)
model_hash = sha256_hash.hexdigest()[:10]
cache_model_hash[filename] = model_hash
return model_hash