Fix LoRA loading and conditioning to match training notebook #23

Merged
llabeyrie merged 1 commits from fix/lora-loading-and-conditioning into main 2026-03-19 23:31:31 +00:00

1 Commits

Author SHA1 Message Date
fe830dea2e Fix LoRA loading and conditioning to match training notebook
card_generator_adapter.py had two mismatches with the training notebook:

1. LoRA loading: used pipe.load_lora_weights() (diffusers format) but the
   adapter was saved with PEFT's save_pretrained() — keys didn't match,
   so no LoRA weights were actually applied. Now uses
   PeftModel.from_pretrained() + merge_and_unload().

2. Conditioning: built a natural language prompt, but the LoRA was trained
   on json.dumps(meta) serialization. Now uses JSON serialization to match.
2026-03-20 00:28:05 +01:00