1
0
Fork 0

feat(api): create hash file for models without one

This commit is contained in:
Sean Sube 2023-06-27 08:17:21 -05:00
parent 16cf5bb863
commit 7c8dc7a6b6
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 6 additions and 0 deletions

View File

@ -288,6 +288,7 @@ def convert_diffusion_diffusers(
dest_path = path.join(conversion.model_path, name) dest_path = path.join(conversion.model_path, name)
model_index = path.join(dest_path, "model_index.json") model_index = path.join(dest_path, "model_index.json")
model_cnet = path.join(dest_path, "cnet", ONNX_MODEL) model_cnet = path.join(dest_path, "cnet", ONNX_MODEL)
model_hash = path.join(dest_path, "hash.txt")
# diffusers go into a directory rather than .onnx file # diffusers go into a directory rather than .onnx file
logger.info( logger.info(
@ -299,6 +300,11 @@ def convert_diffusion_diffusers(
cnet_only = False cnet_only = False
if path.exists(dest_path) and path.exists(model_index): if path.exists(dest_path) and path.exists(model_index):
if "hash" in model and not path.exists(model_hash):
logger.info("ONNX model does not have hash file, adding one")
with open(model_hash, "w") as f:
f.write(model["hash"])
if not single_vae and not path.exists(model_cnet): if not single_vae and not path.exists(model_cnet):
logger.info( logger.info(
"ONNX model was converted without a ControlNet UNet, converting one" "ONNX model was converted without a ControlNet UNet, converting one"