From a31df720fe1f9506280fe6aaec81004aa74e76c3 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Tue, 30 Jan 2024 17:38:52 +0530 Subject: [PATCH] add note about serialization --- docs/source/en/tutorials/using_peft_for_inference.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/source/en/tutorials/using_peft_for_inference.md b/docs/source/en/tutorials/using_peft_for_inference.md index 35b36b0ab2..f89912f3a1 100644 --- a/docs/source/en/tutorials/using_peft_for_inference.md +++ b/docs/source/en/tutorials/using_peft_for_inference.md @@ -206,3 +206,13 @@ pipe.fuse_lora(adapter_names=["pixel", "toy"]) prompt = "toy_face of a hacker with a hoodie, pixel art" image = pipe(prompt, num_inference_steps=30, generator=torch.manual_seed(0)).images[0] ``` + +## Saving a pipeline after fusing the adapters + +To properly save a pipeline after it's been loaded with the adapters, it should be serialized like so: + +```python +pipe.fuse_lora(lora_scale=1.0) +pipe.unload_lora_weights() +pipe.save_pretrained("path-to-pipeline") +```