1
0
Fork 0

feat(api): read model hash from file

This commit is contained in:
Sean Sube 2023-06-27 07:28:59 -05:00
parent 0029943c7d
commit e3a458a736
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 8 additions and 1 deletions

View File

@ -95,7 +95,14 @@ def str_params(
model_name = path.basename(path.normpath(params.model)) model_name = path.basename(path.normpath(params.model))
logger.debug("getting model hash for %s", model_name) logger.debug("getting model hash for %s", model_name)
model_hash = get_extra_hashes().get(model_name, "unknown") model_hash = get_extra_hashes().get(model_name, None)
if model_hash is None:
model_hash_path = path.join(params.model, "hash.txt")
if path.exists(model_hash_path):
with open(model_hash_path, "r") as f:
model_hash = f.readline()
model_hash = model_hash or "unknown"
hash_map = { hash_map = {
model_name: model_hash, model_name: model_hash,
} }