TencentARC / PhotoMaker

PhotoMaker
https://photo-maker.github.io/
Other
8.63k stars 675 forks source link

How add another Loras model? #127

Open Citramones opened 4 months ago

Citramones commented 4 months ago

Is it possible to download other lora models for sdxl 1.0 and somehow use them? and how to do this?

Paper99 commented 4 months ago

Of course,

pipe = PhotoMakerStableDiffusionXLPipeline.from_pretrained(
    base_model_path,  # can change to any base model based on SDXL
    torch_dtype=torch.bfloat16, 
    use_safetensors=True, 
    variant="fp16"
).to(device)

### Load PhotoMaker checkpoint
pipe.load_photomaker_adapter(
    os.path.dirname(photomaker_path),
    subfolder="",
    weight_name=os.path.basename(photomaker_path),
    trigger_word="img"  # define the trigger word
)     

pipe.load_lora_weights(os.path.dirname(lora_path), weight_name=lora_model_name, adapter_name="xl_more_art-full")
pipe.set_adapters(["photomaker", "xl_more_art-full"], adapter_weights=[1.0, 0.5])

pipe.fuse_lora()
Paper99 commented 4 months ago

Just change the lora_path and adapter_name

Citramones commented 3 months ago

Just change the lora_path and adapter_name

thx, maybe u know how to correctly set the adapter_weights parameter sometimes the image turns out without any style at all, although the words triggers for lora are used and I also encountered the problem that the face also does not match the photo