fix(api): avoid loading encoder twice when using LoRAs and inversions together
This commit is contained in:
parent
9f9b73b780
commit
af326a784f
|
@ -236,15 +236,17 @@ def load_pipeline(
|
||||||
list(zip(inversion_models, inversion_weights, inversion_names)),
|
list(zip(inversion_models, inversion_weights, inversion_names)),
|
||||||
)
|
)
|
||||||
|
|
||||||
# should be pretty small and should not need external data
|
|
||||||
components["text_encoder"] = OnnxRuntimeModel(
|
|
||||||
OnnxRuntimeModel.load_model(
|
|
||||||
text_encoder.SerializeToString(),
|
|
||||||
provider=device.ort_provider(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
components["tokenizer"] = tokenizer
|
components["tokenizer"] = tokenizer
|
||||||
|
|
||||||
|
# should be pretty small and should not need external data
|
||||||
|
if loras is None or len(loras) == 0:
|
||||||
|
components["text_encoder"] = OnnxRuntimeModel(
|
||||||
|
OnnxRuntimeModel.load_model(
|
||||||
|
text_encoder.SerializeToString(),
|
||||||
|
provider=device.ort_provider(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# test LoRA blending
|
# test LoRA blending
|
||||||
if loras is not None and len(loras) > 0:
|
if loras is not None and len(loras) > 0:
|
||||||
lora_names, lora_weights = zip(*loras)
|
lora_names, lora_weights = zip(*loras)
|
||||||
|
|
Loading…
Reference in New Issue