From 9d1c5dca521e70e43b58d66b46981396c33a4a71 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sun, 12 Feb 2023 12:23:03 -0600 Subject: [PATCH] fix(api): correctly handle partial extras files --- api/onnx_web/convert/__main__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/onnx_web/convert/__main__.py b/api/onnx_web/convert/__main__.py index 28531f2e..46967563 100644 --- a/api/onnx_web/convert/__main__.py +++ b/api/onnx_web/convert/__main__.py @@ -176,7 +176,7 @@ def fetch_model( def convert_models(ctx: ConversionContext, args, models: Models): - if args.sources: + if args.sources and "sources" in models: for model in models.get("sources"): model = tuple_to_source(model) name = model.get("name") @@ -189,7 +189,7 @@ def convert_models(ctx: ConversionContext, args, models: Models): dest = fetch_model(ctx, name, source, model_format=model_format) logger.info("Finished downloading source: %s -> %s", source, dest) - if args.diffusion: + if args.diffusion and "diffusion" in models: for model in models.get("diffusion"): model = tuple_to_diffusion(model) name = model.get("name") @@ -215,7 +215,7 @@ def convert_models(ctx: ConversionContext, args, models: Models): source, ) - if args.upscaling: + if args.upscaling and "upscaling" in models: for model in models.get("upscaling"): model = tuple_to_upscaling(model) name = model.get("name") @@ -229,7 +229,7 @@ def convert_models(ctx: ConversionContext, args, models: Models): ) convert_upscale_resrgan(ctx, model, source) - if args.correction: + if args.correction and "correction" in models: for model in models.get("correction"): model = tuple_to_correction(model) name = model.get("name")