Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LoRA] support LyCORIS #5102

Merged
merged 32 commits into from
Sep 20, 2023
Merged

[LoRA] support LyCORIS #5102

merged 32 commits into from
Sep 20, 2023

Conversation

sayakpaul
Copy link
Member

@sayakpaul sayakpaul commented Sep 19, 2023

What does this PR do?

Fixes #5079.

Usage example

from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
from diffusers.utils import make_image_grid
import torch

pipe = StableDiffusionPipeline.from_single_file(
    "Amixx.safetensors",
    safety_checker=None,
    torch_dtype=torch.float16,
)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(
    pipe.scheduler.config, use_karras_sigmas=True
)
pipe.load_lora_weights(".",  weight_name="edgLycorisMugler-light.safetensors")
pipe.to("cuda")

# Weighting in prompts isn't natively supported in diffusers (be aware). It's just copy-pasted from CivitAI.
prompt = "((Masterpiece, best quality,edgQuality)),smirk,smug,white hair, Haute_Couture, blue gown,golden embroidery, woman wearing a Haute_Couture dress, (((edgTM, wearing edgTM_style fashion, eccentric clothing))),feathers, <lora:edgLycorisMugler-light:1>"
neg_prompt = "(low quality, worst quality:1.4),(holding,multiple limbs, mutated limbs, mutated human, poorly drawn human body:1.5)"

images = pipe(
    prompt, negative_prompt=neg_prompt,
    num_inference_steps=25, guidance_scale=6.0,
    generator=torch.manual_seed(2014727055),
    num_images_per_prompt=4
).images
make_image_grid(images, 1, len(images)).save("results.png")

Ensure the following models are downloaded before running the pipeline:

get https://civitai.com/api/download/models/141190 -O Amixx.safetensors
wget https://civitai.com/api/download/models/159507 -O edgLycorisMugler-light.safetensors

Cc: @George0726.

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super, maybe also one slow test?

@sayakpaul
Copy link
Member Author

@patrickvonplaten done!

Okay for you to merge once the CI is partially green (barring the documentation workflow)?

@sayakpaul
Copy link
Member Author

Failing tests are flaky. Merging.

@sayakpaul sayakpaul merged commit e312b23 into main Sep 20, 2023
10 of 12 checks passed
@sayakpaul sayakpaul deleted the lycoris-fix- branch September 20, 2023 09:30
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* better condition.

* debugging

* how about now?

* how about now?

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* support for lycoris.

* style

* add: lycoris test

* fix from_pretrained call.

* fix assertion values.
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* better condition.

* debugging

* how about now?

* how about now?

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* debugging

* support for lycoris.

* style

* add: lycoris test

* fix from_pretrained call.

* fix assertion values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Loading Lyrocis by load_lora_weights
2 participants