Skip to content

Commit

Permalink
fix(api): correctly blend LoRAs into UNet during conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Apr 7, 2023
1 parent 1cfc538 commit 25176fe
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions api/onnx_web/convert/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def convert_models(ctx: ConversionContext, args, models: Models):
)

if "unet" not in blend_models:
blend_models["text_encoder"] = load_model(
blend_models["unet"] = load_model(
path.join(dest, "unet", ONNX_MODEL)
)

Expand All @@ -365,10 +365,15 @@ def convert_models(ctx: ConversionContext, args, models: Models):
blend_loras(
ctx,
blend_models["text_encoder"],
[lora_name],
[lora_source],
[(lora_source, lora_weight)],
"text_encoder",
lora_weights=[lora_weight],
)

blend_loras(
ctx,
blend_models["unet"],
[(lora_source, lora_weight)],
"unet",
)

if "tokenizer" in blend_models:
Expand Down

0 comments on commit 25176fe

Please sign in to comment.