fix(api): continue converting other models after an error in one (#166)
This commit is contained in:
parent
b3c8fce16b
commit
c74d22aa42
|
@ -194,8 +194,12 @@ def convert_models(ctx: ConversionContext, args, models: Models):
|
||||||
else:
|
else:
|
||||||
model_format = source_format(model)
|
model_format = source_format(model)
|
||||||
source = model["source"]
|
source = model["source"]
|
||||||
dest = fetch_model(ctx, name, source, model_format=model_format)
|
|
||||||
logger.info("finished downloading source: %s -> %s", source, dest)
|
try:
|
||||||
|
dest = fetch_model(ctx, name, source, model_format=model_format)
|
||||||
|
logger.info("finished downloading source: %s -> %s", source, dest)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("error fetching source %s: %s", name, e)
|
||||||
|
|
||||||
if args.diffusion and "diffusion" in models:
|
if args.diffusion and "diffusion" in models:
|
||||||
for model in models.get("diffusion"):
|
for model in models.get("diffusion"):
|
||||||
|
@ -206,23 +210,27 @@ def convert_models(ctx: ConversionContext, args, models: Models):
|
||||||
logger.info("skipping model: %s", name)
|
logger.info("skipping model: %s", name)
|
||||||
else:
|
else:
|
||||||
model_format = source_format(model)
|
model_format = source_format(model)
|
||||||
source = fetch_model(
|
|
||||||
ctx, name, model["source"], model_format=model_format
|
|
||||||
)
|
|
||||||
|
|
||||||
if model_format in model_formats_original:
|
try:
|
||||||
convert_diffusion_original(
|
source = fetch_model(
|
||||||
ctx,
|
ctx, name, model["source"], model_format=model_format
|
||||||
model,
|
|
||||||
source,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
convert_diffusion_stable(
|
|
||||||
ctx,
|
|
||||||
model,
|
|
||||||
source,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if model_format in model_formats_original:
|
||||||
|
convert_diffusion_original(
|
||||||
|
ctx,
|
||||||
|
model,
|
||||||
|
source,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
convert_diffusion_stable(
|
||||||
|
ctx,
|
||||||
|
model,
|
||||||
|
source,
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("error converting diffusion model %s: %s", name, e)
|
||||||
|
|
||||||
if args.upscaling and "upscaling" in models:
|
if args.upscaling and "upscaling" in models:
|
||||||
for model in models.get("upscaling"):
|
for model in models.get("upscaling"):
|
||||||
model = tuple_to_upscaling(model)
|
model = tuple_to_upscaling(model)
|
||||||
|
@ -232,10 +240,14 @@ def convert_models(ctx: ConversionContext, args, models: Models):
|
||||||
logger.info("skipping model: %s", name)
|
logger.info("skipping model: %s", name)
|
||||||
else:
|
else:
|
||||||
model_format = source_format(model)
|
model_format = source_format(model)
|
||||||
source = fetch_model(
|
|
||||||
ctx, name, model["source"], model_format=model_format
|
try:
|
||||||
)
|
source = fetch_model(
|
||||||
convert_upscale_resrgan(ctx, model, source)
|
ctx, name, model["source"], model_format=model_format
|
||||||
|
)
|
||||||
|
convert_upscale_resrgan(ctx, model, source)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("error converting upscaling model %s: %s", name, e)
|
||||||
|
|
||||||
if args.correction and "correction" in models:
|
if args.correction and "correction" in models:
|
||||||
for model in models.get("correction"):
|
for model in models.get("correction"):
|
||||||
|
@ -246,11 +258,13 @@ def convert_models(ctx: ConversionContext, args, models: Models):
|
||||||
logger.info("skipping model: %s", name)
|
logger.info("skipping model: %s", name)
|
||||||
else:
|
else:
|
||||||
model_format = source_format(model)
|
model_format = source_format(model)
|
||||||
source = fetch_model(
|
try:
|
||||||
ctx, name, model["source"], model_format=model_format
|
source = fetch_model(
|
||||||
)
|
ctx, name, model["source"], model_format=model_format
|
||||||
convert_correction_gfpgan(ctx, model, source)
|
)
|
||||||
|
convert_correction_gfpgan(ctx, model, source)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("error converting correction model %s: %s", name, e)
|
||||||
|
|
||||||
def main() -> int:
|
def main() -> int:
|
||||||
parser = ArgumentParser(
|
parser = ArgumentParser(
|
||||||
|
|
Loading…
Reference in New Issue