Skip to content

convert_lora_safetensor_to_diffusers #2829

Closed
@NicholasKao1029

Description

@NicholasKao1029

this script https://github.com/huggingface/diffusers/blob/main/scripts/convert_lora_safetensor_to_diffusers.py integrates the lora into the Pipeline and then outputs said Pipeline.

Is there a method to turn the .safetensors Lora to a .bin file to be loaded in dynamically similar to the snippet below

from diffusers import StableDiffusionPipeline
import torch

model_path = "sayakpaul/sd-model-finetuned-lora-t4"
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
pipe.unet.load_attn_procs(model_path)
pipe.to("cuda")

prompt = "A pokemon with blue eyes."
image = pipe(prompt, num_inference_steps=30, guidance_scale=7.5, cross_attention_kwargs={"scale": 0.5}).images[0]
image.save("pokemon.png")

As seen here https://huggingface.co/docs/diffusers/training/lora

My complaint is there is a lot of redundancy in the model if you want different loras to be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions