From 65faf257d6f98e930072a3535e4d1f0d8bad19ec Mon Sep 17 00:00:00 2001 From: Alex Umnov Date: Thu, 8 Feb 2024 20:41:00 +0100 Subject: [PATCH 1/4] Updated lora inference instructions --- examples/dreambooth/README.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/examples/dreambooth/README.md b/examples/dreambooth/README.md index 972fe6e8cffb..fb3e9c96ba54 100644 --- a/examples/dreambooth/README.md +++ b/examples/dreambooth/README.md @@ -376,18 +376,15 @@ After training, LoRA weights can be loaded very easily into the original pipelin load the original pipeline: ```python -from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler -import torch - -pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16) -pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) -pipe.to("cuda") +import os +from diffusers import StableDiffusionPipeline +pipe = StableDiffusionPipeline.from_pretrained(os.environ["MODEL_NAME"]).to("cuda") ``` -Next, we can load the adapter layers into the UNet with the [`load_attn_procs` function](https://huggingface.co/docs/diffusers/api/loaders#diffusers.loaders.UNet2DConditionLoadersMixin.load_attn_procs). +Next, we can load the adapter layers into the pipeline with the [`load_lora_weights` function](https://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adapters#lora). ```python -pipe.unet.load_attn_procs("patrickvonplaten/lora_dreambooth_dog_example") +pipe.load_lora_weights(os.environ["OUTPUT_DIR"]) ``` Finally, we can run the model in inference. From e95c300176bfbd95352b24f9d0518bbc8df4e515 Mon Sep 17 00:00:00 2001 From: Alex Umnov Date: Fri, 9 Feb 2024 11:00:10 +0100 Subject: [PATCH 2/4] Update examples/dreambooth/README.md Co-authored-by: Sayak Paul --- examples/dreambooth/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/dreambooth/README.md b/examples/dreambooth/README.md index fb3e9c96ba54..369fb924f398 100644 --- a/examples/dreambooth/README.md +++ b/examples/dreambooth/README.md @@ -384,7 +384,7 @@ pipe = StableDiffusionPipeline.from_pretrained(os.environ["MODEL_NAME"]).to("cud Next, we can load the adapter layers into the pipeline with the [`load_lora_weights` function](https://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adapters#lora). ```python -pipe.load_lora_weights(os.environ["OUTPUT_DIR"]) +pipe.load_lora_weights("path-to-the-lora-checkpoint") ``` Finally, we can run the model in inference. From a77a98ea43ba51c54ad51c1ff1c2bb4007e550fa Mon Sep 17 00:00:00 2001 From: Alex Umnov Date: Fri, 9 Feb 2024 11:03:34 +0100 Subject: [PATCH 3/4] Update README.md --- examples/dreambooth/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/dreambooth/README.md b/examples/dreambooth/README.md index 369fb924f398..b0b68edaaef1 100644 --- a/examples/dreambooth/README.md +++ b/examples/dreambooth/README.md @@ -376,9 +376,8 @@ After training, LoRA weights can be loaded very easily into the original pipelin load the original pipeline: ```python -import os from diffusers import StableDiffusionPipeline -pipe = StableDiffusionPipeline.from_pretrained(os.environ["MODEL_NAME"]).to("cuda") +pipe = StableDiffusionPipeline.from_pretrained("base-model-name").to("cuda") ``` Next, we can load the adapter layers into the pipeline with the [`load_lora_weights` function](https://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adapters#lora). From a534bc93cd25da6259ad62f92cf3f4cc3c51b1d7 Mon Sep 17 00:00:00 2001 From: Alex Umnov Date: Fri, 9 Feb 2024 11:53:47 +0100 Subject: [PATCH 4/4] Update README.md --- examples/dreambooth/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/dreambooth/README.md b/examples/dreambooth/README.md index b0b68edaaef1..eb025eefc3ec 100644 --- a/examples/dreambooth/README.md +++ b/examples/dreambooth/README.md @@ -376,8 +376,8 @@ After training, LoRA weights can be loaded very easily into the original pipelin load the original pipeline: ```python -from diffusers import StableDiffusionPipeline -pipe = StableDiffusionPipeline.from_pretrained("base-model-name").to("cuda") +from diffusers import DiffusionPipeline +pipe = DiffusionPipeline.from_pretrained("base-model-name").to("cuda") ``` Next, we can load the adapter layers into the pipeline with the [`load_lora_weights` function](https://huggingface.co/docs/diffusers/main/en/using-diffusers/loading_adapters#lora).